Useful Linux Commands For Managing Chia Nodes

I'm running two chia farms for about two months now. Chia has not made me rich yet - at least not financially. At the same time, it has motivated me to brush up my Linux and bash skills. I see that as a gain as well.

My favorite remote shell: MobaXterm

The below list is for myself, but maybe you also find some value on those. I started to use them quite frequently while managing my farms. Also see the following articles, where describe my setup and review some of the hardware used
Lets get into it!

Session Management

Detach session and keep processes running

If you start new processes in your shell, they will be terminated as soon as you exit. In cases where the processes already run in background, you can detach your session instead of terminate, by using the following commands: Ctrl + A, followed by Ctrl + D.

To avoid that situation entirely, prefix your commands with nohup, which stands for "no hang up". Processes started with nohup, will not end, even if you terminate the session.

Storage Management

List USB Devices

To check if all the devices are plugged in and work with the correct speed, use lsusb. Using the -t option, makes it even more trivial to understand how the different USB devices are connect to the system.

List Block Devices

Similar to lsusb, the command lsblk will show all devices that can be used for storage purposes. While the plain command does give you some initial information, I typically use at least the additional option -fs to include various information about the filesystem and the mountpoints. Full command would therefore be lsblk -fs.

Free space across all devices

This is probably the tool I use most to see if there is any issue with space or the mountpoints. Its as simple as df (for drive free). I use it with the -h option, which renders byte amounts in human readable format. Example: df -h

extFat Formatting

The extFat filesystem can handle large files and is supported in all major operating systems. I use this simple filesystem to store my data as it is also relatively fast to other file systems.
Formatting a device with extFat is done by mkfs.exfat -n WD-USB02 /dev/sdd1, where the -n argument is the label of the partition and the last argument is the device that should be formatted.
Checking the filesystem after creation happens with fsck.exfat /dev/sdd1

File Handling

Copy files with limited bandwidth

One challenge of your build could be bandwidth limitations on the drives where you store your plots. This could cause the chia-process to take too long to find proofs while you're copying new plots to the hard disk. A solution to that problem is to limit the copy process to certain speed. This can be done with rsync.

rsync --remove-source-files --bwlimit=50m --progress /chia/farm/new/* /chia/farm/usb-wd02

The above command will limit the move process to max 50Mbit/s, which should give the chia process plenty of room to find proofs on the hard disk while you're still copying. For more options see rsync(1) man page (samba.org)

Comments

Popular posts from this blog

Home Assistant in Docker with Nginx and Let's Encrypt on Raspberry Pi

Use Bodmer TFT_eSPI Library with PlatformIO

Migrating from Arduino IDE to Visual Studio Code to PlatformIO