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!

    `--datadir` is for `chaindata` too, but not for DAG

    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.

    Just copy your (backed up) `keystore` folder to the folder pointed by `--datadir`. Passwords remain the same.

  • JackWinters

    JackWinters Correct answer

    5 years ago

    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

    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"

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

    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

    Thank you @JackWinters, that did it. `geth --datadir path/to/SD/datadir --ipcdisable`

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

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM