My Mac "System" drive is almost full. As I actually have two drives, I want to move the blockchain from the default location to the second drive. How can I do it ?
-
How do you get updates to the blockchain to sync to the new location? Also, which folder should be copied - chaindata or lightchaindata?– ChaseApr 4, 2018 at 22:29
-
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review– Richard HorrocksApr 5, 2018 at 8:17
2 Answers
The default subdirectory where your Ethereum data files are stored on a Mac is ~/Library/Ethereum
.
Within this subdirectory, your blockchain data is stored in the subdirectory chaindata
, i.e., ~/Library/Ethereum/chaindata
.
Let's assume that your new drive is mounted on ~/Volumes/Drive2
for this example.
Here are 3 alternatives, the first being the safest.
Method 1 - Unix Soft Linking - chaindata
Subdirectory Only
Copy your ~/Library/Ethereum/chaindata
subdirectory into your new location /Volumes/Drive2/Ethereum/chaindata
using the following command:
mkdir /Volumes/Drive2/Ethereum
cp -rpv ~/Library/Ethereum/chaindata /Volumes/Drive2/Ethereum/
A copy of your Ethereum chaindata
subdirectory will now be located in /Volumes/Drive2/Ethereum/chaindata
.
Rename your default Ethereum chaindata
subdirectory for testing:
mv ~/Library/Ethereum/chaindata ~/Library/Ethereum/OldChaindata_to_delete_when_tested
Soft link your new chaindata
subdirectory back to the default location:
ln -s /Volumes/Drive2/Ethereum/chaindata ~/Library/Ethereum/chaindata
Test out your Mist browser and delete your old chaindata directory ONLY AFTER your testing is successful:
rm -rf ~/Library/Ethereum/OldChaindata_to_delete_when_tested
Method 2 - Unix Soft Linking - Whole Ethereum Data Directory
Copy your ~/Library/Ethereum
subdirectory into your new location /Volumes/Drive2/Ethereum
using the following command:
cp -rpv ~/Library/Ethereum /Volumes/Drive2/
A copy of your whole Ethereum directory will now be located in /Volumes/Drive2/Ethereum
.
Rename your default Ethereum directory for testing:
mv ~/Library/Ethereum ~/Library/OldEthereum_to_delete_when_tested
Soft link your new Ethereum directory back to the default location:
ln -s /Volumes/Drive2/Ethereum ~/Library/Ethereum
Test out your Mist browser and delete your old Ethereum directory ONLY AFTER your testing is successful:
rm -rf ~/Library/OldEthereum_to_delete_when_tested
Method 3 - Manually Start geth
Note that this method is not recommended as you will have sets of files and directories in two different locations, and you will have to remember to start geth
manually with the correct parameters before running the Mist browser. You could make this safer using script files.
In this method, you manually run geth
before running the Mist browser. The Mist browser will connect to geth
through the file ~/Library/Ethereum/geth.ipc
using the IPC protocol, and you can specify on the geth
command line the location of the Ethereum data directory.
geth
by default will create the IPC file within the Ethereum directory, but Mist will look for this file within the default Ethereum directory.
Referring to How to connect Mist to a remote private network?, a copy of the geth
program is packaged with your Mist browser. This can be found in:
{MISTINSTALLDIRECTORY}/resources/node/geth/geth
Copy your Ethereum directory to your new location:
cp -rpv ~/Library/Ethereum /Volumes/Drive2/Ethereum
Start geth
with the Ethereum directory pointing to your new location, while pointing the IPC file path back to the default Ethereum directory location.
{MISTINSTALLDIRECTORY}/resources/node/geth/geth \
--datadir "/Volumes/Drive2/Ethereum" \
--ipcpath "~/Library/Ethereum/geth.ipc"
After your successful testing, you should be able to remove the ~/Library/Ethereum/chaindata
subdirectory.
Notes
If you are holding real (virtual) Ethers in your Ethereum directory, make sure you always have an up-to-date backup of your
keystore
subdirectory. This is located in~/Library/Ethereum/keystore
or in/Volumes/Drive2/Ethereum/keystore
if you have movedgeth
's default data directory. See How to backup mist wallets? for further information.From Backup & Restore:
Mac: ~/Library/Ethereum Linux: ~/.ethereum Windows: %APPDATA%/Ethereum
Methods 1 and 2 will work only on the Mac and Linux platforms as we are using the Unix soft-link to achieve this - ln (Unix).
-
Great answer, thanks ! The first approach worked just fine. Apr 25, 2016 at 10:59
-
It seems that these solutions are fine if you want to download the blockchain locally and then move it but what about if you want it downloaded to an external location from the getgo? Need help!– DazzleApr 28, 2017 at 14:49
-
work in progress .... $ geth --datadir /Volumes/Seagate-Backup-Plus/Ethereum/chaindata seems to have worked but how can I get Mist to recognize and permanetly sync this location? Do I have to run some command every time I want to update the wallet?– DazzleApr 28, 2017 at 15:05
-
1Trying to use first approach but not sure about a few points I'd like to check: - You say chaindata is normally in ~/Library/Ethereum, but I found it under users/username/library/ethereum/geth? Do I have to change anything in the command or will this still work? Has the location changed with the newer versions of Mist? - If my drive is external (not a partition of the built-in drive) do I still use /volumes/drivename? How do I specify a completely different drive? Jun 19, 2017 at 7:23
-
I'm finding method 1 a lot slower over USB 3.0 to external HDD, anyone else come across this? I think 5 blocks an hour would be accurate. I also have to restart it a few times to make sure the network connects. Doesn't happen if I download direct :/ Dec 22, 2017 at 10:08
took me a while to figure this out so I thought I would post it:
I wanted to move the Ethereum directory to my external hard drive, but couldn't figure out the address to put in terminal.
I entered 'cd' in terminal and dragged my drive from the desktop to the terminal window. Then it filled in the exact address I needed:
so I replaced:
/Volumes/Drive2/
with
/Volumes/ 1\ TB\ WD/ (1 TB WD was the name of my hard drive)
-
Could you add some details on what file you replace this path in ? Jun 27, 2017 at 8:17