27

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!

3
  • 1
    --datadir is for chaindata too, but not for DAG
    – romanoza
    Mar 2, 2016 at 8: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 3, 2016 at 1:47
  • 1
    Just copy your (backed up) keystore folder to the folder pointed by --datadir. Passwords remain the same.
    – romanoza
    Mar 3, 2016 at 8:25

4 Answers 4

29

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
6
  • 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 3, 2016 at 1:36
  • @eth @JackWinters I have read through the docs extensively here (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 3, 2016 at 1: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 Mar 3, 2016 at 10:06
  • Thank you @JackWinters, that did it. geth --datadir path/to/SD/datadir --ipcdisable
    – FugueWeb
    Mar 3, 2016 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, 2016 at 11:04
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

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
-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).

2
  • 1
    Hi there. Can you explain what your answer has to do with the question...? :) Jun 10, 2017 at 6:36
  • 2
    @Justin, Did you mean to post this somewhere else? Please consider deleting from this page, as it does not answer the question.
    – Tesa
    Jun 10, 2017 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.