15

I am currently performing the initial sync to the default directory, but my drive is nearly full. How do I move (and subsequently sync) the blockchain to another drive without losing the progress?

3 Answers 3

17

This is, fortunately, fairly trivial and you won't lose any of the progress. It is done as follows.

If you're using the GUI, perform the following steps:

  1. Create a new directory on the other/external drive. In addition, create a subdirectory called lmdb. Thus, if you, for example, created a directory called MoneroBlockchain on the other/external drive, you should also have MoneroBlockchain/lmdb (Linux & Mac OS X) or MoneroBlockchain\lmdb (Windows)

  2. Go to the Settings page of the GUI and add the full path of the new directory as Blockchain location

  3. Click in another box (on the Settings page) to ensure your settings are properly saved.

  4. Exit the GUI and make sure to stop the daemon as well.

  5. Browse to default directory for the blockchain (C:\ProgramData\bitmonero\lmdb on Windows | ~/.bitmonero/lmdb on Linux and Mac OS X)

  6. Note that aforementioned directories are hidden. On Windows, you can use the explorer to manually browse to it. On Mac OS X, you can typically use CMD+SHIFT+DOT to unhide directories. Lastly, on Linux, you can typically use CTRL + H to unhide directories.

  7. Copy data.mdb (the blockchain) to the new lmdb subdirectory directory.

  8. Restart the GUI.

  9. Use Show status (on the Settings) to verify that your daemon is properly syncing (i.e. fetching new blocks) to the new directory.


If you're using the CLI or running monerod separately from the GUI, perform the following steps:

[1] Exit the current monerod gracefully by typing exit

[2] Create a new directory on the other/external drive. In addition, create a subdirectory called lmdb. Thus, if you created a directory called MoneroBlockchain on the other/external drive, you should also have MoneroBlockchain/lmdb (Linux & Mac OS X) or MoneroBlockchain\lmdb (Windows).

[3] Browse to default directory for the blockchain (C:\ProgramData\bitmonero\lmdb on Windows | ~/.bitmonero/lmdb on Linux and Mac OS X).

[4] Note that aforementioned directories are, by default, hidden. On Windows, you can use the explorer to manually browse to it. On Mac OS X, you can typically use CMD+SHIFT+DOT to unhide directories. Lastly, on Linux, you can typically use CTRL + H to unhide directories.

[5] Copy data.mdb (the blockchain) to the new lmdb subdirectory directory.

[6a] On Windows, open a new command prompt from the same directory as monerod.exe. This is done by first making sure your cursor isn't located on any of the files and subsequently doing SHIFT + right click. It will give you an option to "Open command window here". If you're using Windows 10, it'll, most likely, give you an option to open the Powershell.

[6b] On Linux and Mac OS X, open a new terminal from the same directory as monerod

[7a] On Windows, type the following command in the command prompt:

monerod.exe --data-dir path\to\new\directory

If that doesn't work in the Powershell, type:

.\monerod.exe --data-dir path\to\new\directory

If that doesn't work either in the Powershell, type:

./monerod.exe --data-dir path\to\new\directory

[7b] On Linux and Mac OS X, type the following command in the terminal:

./monerod --data-dir path/to/new/directory

[8] Note that, if you're running monerod separately, you have to apply the flags every time you start monerod. Thus, on Windows, probably most convenient to create a shortcut, go to properties, and add the flags after the Target. On Linux and Mac OS X, it's probably most convenient to create a little script.

[9] Once monerod starts it should state (in the terminal or command prompt) where it's loading the blockchain from. Check whether this is the correct directory.

8
  • 1
    For config files, see: monero.stackexchange.com/questions/2866/…. The blockchain import is done by a different binary, namely monero-blockchain-import. I think you can add a custom directory there too (using `--data-dir) so it places the imported blockchain (data.mdb) in the custom directory. However, if you already finished importing and it placed the blockchain in the default directory, it's probably best to just use this guide to move the blockchain.
    – dEBRUYNE
    Commented Jan 18, 2018 at 11:55
  • 1
    that does not work... What´s wrong here? Using my Mac with an external Drive... created a new Folder /Monero/lmdb copied my existing chain from my local hard drive over - but i'm unable to connect to the daemon. Tried different ways - without any success... --data-dir /Volumes/WD\ 1TB\ Media/Monero/lmdb/data.mdb --data-dir /Volumes/WD\ 1TB\ Media/Monero/lmdb --data-dir /Volumes/WD 1TB Media/Monero/lmdb/data.mdb --data-dir /Volumes/WD 1TB Media/Monero/lmdb Didn't work .... any idea? Thanks in advance...
    – Simon
    Commented Mar 8, 2018 at 16:57
  • 1
    A space in the path may cause issues. Perhaps try renaming the external drive to WD1TBMedia and then using --data-dir /Volumes/WD1TBMedia/Monero
    – dEBRUYNE
    Commented Mar 12, 2018 at 20:40
  • 1
    As of 2020, there is a Monero Daemon shortcut created on installation, so if you press Cmd and find Monero Daemon, then you right-click it -> Open File Location, then you right-click its shortcut -> Properties, you will see that under Target it has something which is "F:\Programs\Monero GUI Wallet\monerod.exe" --data-dir F:\ProgramData\bitmonero for me. You need to manually change the --data-dir to the new directory - since updating the GUI doesn't change this. Commented Oct 31, 2020 at 13:37
  • 1
    "Go to the Settings page of the GUI and add the full path of the new directory as Blockchain location" ; As of 2021 it seems like this does not exist in the macOS GUI Commented May 21, 2021 at 18:02
1

Use a symlink (ln -s ...)to map default directory to a new path (linux cli):

[1] move or copy the ~/.bitmonero to new location. I prefer rsync:

rsync -avh ~/.bitmonero/ path/to/new/directory/

[2] Optionally, backup your original ~/.bitmonero:

mv ~/.bitmonero ~/bitmonerobak

[3] Generate a .bitmonero symlink that points to the new directory:

ln -s ~/.bitmonero path/to/new/directory

monerod's default location (~/.bitmonero) points to your new path and you can run it as normal.

-1

short for linux cli users:

if all is right the monerod output will tell you

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