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 moved geth
'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).
Best Answer
Summary
Q: How can I specify an external harddrive as the download target for the Mist blockchain?
A: The answer for the Mac version is in Method 1 in In Mist browser how can I move the data (blockchain) to another drive on Mac OSX?. The Linux version is below.
Q: Even if the blockchain data gets corrupted somehow, it won't affect my wallets, right? I can keep them in a folder on my computer instead of the external harddrive, yes or no?
A: Yes. Just make sure that you backup
~/.ethereum/keystore
.Q: I. e. I would prefer having the blockchain data on an external drive and the wallet files on my laptop harddrive. Possible or not?
A: Yes.
The Details
The default subdirectory where your Ethereum data files are stored on Linux is
~/.ethereum
.Within this subdirectory, your blockchain data is stored in the subdirectory
chaindata
, i.e.,~/.ethereum/chaindata
.Let's assume that your new drive is mounted on
/mnt/extdrive1
for this example.Copy your
~/.ethereum/chaindata
subdirectory into your new location/mnt/extdrive1/Ethereum/chaindata
using the following command:A copy of your Ethereum
chaindata
subdirectory will now be located in/mnt/extdrive1/Ethereum/chaindata
.Rename your default Ethereum
chaindata
subdirectory for testing:Soft link your new
chaindata
subdirectory back to the default location:Test out your Mist browser and delete your old chaindata directory ONLY AFTER your testing is successful:
References