Using a NAS to store blockchain data in Ubuntu 16.04
Running wallets natively is good for the network, good for your privacy and security, and something worth doing if you can.
From the Bitcoin wiki:
Running a full node is the only way you can use Bitcoin in a trustless way. You will know for sure that all the rules of Bitcoin are being followed...
Full nodes are currently the most private way to use Bitcoin, with nobody else learning which bitcoin addresses belong to you.
Full nodes are the most secure way to use Bitcoin, they do not suffer from many attacks that affect lightweight wallets.
Having the blockchain stored on your hard drive is the most private way to have a wallet. All other lightweight solutions leak information about which addresses are yours because they must query third-party servers.
The Electrum servers will know which addresses belong to you and can link them together.
The statements above apply to all coins, not just Bitcoin! Some even show gratitude for users supporting the network with a full node via colorized ASCII art!
While SPV is great for devices when you are on the go, or being able to do decentralised trading through BarterDEX , desktops & servers should hold the blockchain for any coin you're actively using. Alternatively, you can use a VPS.
After installing a few coins, you might find that your system is running out of disk space. To overcome this, you can use a NAS to store the blockchain.
First you'll need to install nfs-common (if it's not already installed)
sudo apt install nfs-common
To get the list of available paths, query the IP of your NAS
showmount -e <YOUR NAS IP>
Create a folder to mount the NAS drive to
sudo mkdir -p /mnt/nas/blockchains/
Open fstab and add a line like below, but with your NAS IP and path.
sudo nano /etc/fstab
192.168.0.111:/mountdir /mnt/nas/blockchains nfs auto,_netdev,noatime,nolock,bg,intr,tcp,actimeo=1800 0 0
Reboot, then change directory to confirm the partition has mounted, and create a subfolder for your blockchain (I'll use Komodo as an example)
cd /mnt/nas/blockchains/
sudo mkdir -p /mnt/nas/blockchains/.komodo
Check to confirm the blockchain's daemon for the coin you want to move to the NAS is not running with ps aux | grep komodo
If it is, stop it with ./komodo-cli stop
Copy your .komodo data directory to the mounted partition.
sudo cp -rp ~/.komodo/* /mnt/blockchains/.komodo
You can run the ls
command to confirm files were copied over with
ls /mnt/blockchains/.komodo/blocks
With bitcoin, that's a whole lot of blocks
Now it is safe to delete the local data, and create a symlink to the blockchain data on the NAS
sudo rm -rf ~/.komodo
ln -sf /mnt/blockchains/.komodo /home/<user>/.komodo
symbolic links like full paths, so replace <user>
with your username
Set ownershop for the symlink and mounted data
sudo chown -hR <user>:<group> ~/.komodo
sudo chown -hR <user>:<group> /mnt/blockchains/.komodo
You can also run ls -al
on the above folders to confirm ownership is correctly set and view hidden files/folders.
Now we are ready to awaken the daemon. Use sudo
if the NAS connection is handled by root.
sudo ~/wallets/komodo/src/komodod
With all that done, you can now send komodo-cli
commands like
~/komodo/src/komodo-cli getinfo
Check the values for "blocks and "longest chain". If they're the same, awesome! Fully syc'd.
If you're unlucky though, you might need to reindex the blocks.
sudo ~/wallets/komodo/src/komodod -reindex
You can repeat the above for as many blockchains as your NAS can fit! It's a good idea to keep some space spare though, in anticipation of additions to the blockchains and for backing up your system using Systemback
Good luck! If you have any questions or have trouble setting things up, let me know in the comments 👇
#smirk
Congratulations @smk762! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of upvotes
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP