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
For geth, delete
$home/Libary/Ethereum/chaindata
. That should wipe out the blockchain itself and let you sync from scratch. Also you probably want to do a fast sync afterwards to get back fast-ish on the chain--fast
.