[Ethereum] Possible to store the blockchain in a different directory


I'm running geth on Linux within a Chromebook. The blockchain is being stored within ~/.ethereum, along with other important files. Problem is, the storage capacity on my Chromebook is quite limited so it is difficult to keep the data under the user directory.

I have an SD card where I'd like to save the blockchain while keeping the geth installation in the home directory and local to the computer. How can I do this? I don't believe this has to do with --datadir (that's just for the keystore, right?). Any guidance or documentation is helpful, since I basically can't sync with the network with my limited storage as is. Thanks!

Best Answer

The --datadir flag specifies the location data directory.

geth --datadir <path to data directory>

This directory should contain the following subdirectories:

  • chaindata
  • keystore
  • nodes

On start up GETH will try to open IPC (inter-process communication) unix socket within your data directory geth.ipc. However FAT32 file systems do not support the necessary operations to create unix sockets. Therefore if the directory is on a FAT32 file system (e.g. external flash drive) you will need to either:

  • Disable inter-process communication by adding --ipcdisable flag
  • If you wish to use the IPC console you can specify that geth.ipc should be on a linux file system ipcpath --ipcpath some/path/on/linux/geth.ipc
Related Topic