28

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!

FugueWeb
  • 457
  • 1
  • 4
  • 9
  • 1
    --datadir is for chaindata too, but not for DAG – romanoza Mar 02 '16 at 08:13
  • To put my question more simply, if I have my password and keystore backed up but lose my computer, how exactly would I recover the ether? I have read the back up and restore docs but don't feel like this answer is stated plain and simple (i.e., step one, step two, step three, etc.). If someone gives me the answer, I'm happy to put in the pull request to improve the docs. – FugueWeb Mar 03 '16 at 01:47
  • 1
    Just copy your (backed up) keystore folder to the folder pointed by --datadir. Passwords remain the same. – romanoza Mar 03 '16 at 08:25

4 Answers4

30

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
JackWinters
  • 3,413
  • 2
  • 17
  • 29
  • Thanks for your response. I have executed this command with the path leading to my SD card (which auto-generated chaindata and nodes, but threw an error). So I manually created keystore and added my key into it. However, I am getting an error that reads "Error starting protocol stack - /path/to/sd/card/geth.ipc bind: operation not permitted" – FugueWeb Mar 03 '16 at 01:36
  • @eth @JackWinters I have read through the docs extensively here (https://github.com/ethereum/go-ethereum/wiki/Managing-your-accounts), but I'm still not quite getting how to start geth with my existing accounts but with the blockchain (e.g., large file) located on external media. – FugueWeb Mar 03 '16 at 01:37
  • 2
    The issue seems to be related to the use of an external drive. In this reddit post Péter Szilágyi suggests adding --ipcdisable or --ipcpath some/path/on/linux/geth.ipc flags – JackWinters Mar 03 '16 at 10:06
  • Thank you @JackWinters, that did it.

    geth --datadir path/to/SD/datadir --ipcdisable

    – FugueWeb Mar 03 '16 at 23:24
  • Regarding to that "open IPC socket"-issue: Is SMB supported? Because I'd like to mount a Microsoft Azure File Storage into my ~/.ethereum directory - and I need IPC. – Munchkin Sep 14 '16 at 11:04
  • @Munchkin if you use the --ipcpath flag you can specify where the IPC socket is created. If you just put it somewhere on your local drive it should work fine. I would guess that the error is from trying to create an IPC socket on a FAT device – Tjaden Hess Sep 16 '16 at 01:32
5

Start geth with the flag --datadir "path/to/the/directory-you-want". See https://ethereum.gitbooks.io/frontier-guide/content/cli.html.

The default directory is:

  • Mac: ~/Library/Ethereum
  • Linux: ~/.ethereum
  • Windows: %LOCALAPPDATA%/Ethereum (source says %APPDATA% but that's incorrect)

Taken from: https://geth.ethereum.org/docs/install-and-build/backup-restore

Elijah
  • 103
  • 4
MrChico
  • 1,786
  • 14
  • 19
0

This question outlines how one can run a Geth node using an external configuration file.

In addition to the answers above, you could generate configuration files such that nodes can be run for different networks/configuration options with their data stored in different directories using simple commands.

For example

geth --config usb-config.toml
Thomas Clowes
  • 4,385
  • 2
  • 19
  • 43
-3

After messing around I found out that you need to disable the "Adjust for daylight savings" setting (assuming it is telling you that you are off by ~1hr).