Running a Taraxa node efficiently can significantly reduce your memory costs by optimizing the use of both SSD and HDD storage in same server. Here’s a step-by-step guide on how to run a script that leverages SSD/NVMe and HDD to save up to 70% of memory costs:
Why Use SSD and HDD Together?
- SSD (Solid State Drive): Faster access speeds, ideal for storing frequently accessed data.
- HDD (Hard Disk Drive): Larger capacity, suitable for storing less frequently accessed data.
By splitting data between SSD and HDD (By moving roughly half of the oldest SST database files onto a mounted HDD), you minimize the expensive use of SSD space while maintaining high performance.
Step 1: Prepare Your Storage Devices
- Ensure your SSD and HDD are properly mounted on your system.
- Identify the mount points (we used /mnt/taraxa_db/ for HDD).
Step 2: Download our Script
Get the script designed to configure the Taraxa node to use SSD for active data and HDD for archival data.
The code:
#!/bin/bash
set -euo pipefail
SRC="/var/lib/docker/volumes/mainnet_data/_data/db/db"
DST="/mnt/taraxa_db/db"
RSYNC_OPTS=(--archive --verbose --progress --checksum --partial --remove-source-files)
# Must run as root for chown/chmod/mount
if [[ $EUID -ne 0 ]]; then
echo "ERROR: This script must be run as root."
exit 1
fi
mkdir -p "$DST"
for i in $(seq 100000 199999); do
FILE="${i}.sst"
SRC_FILE="${SRC}/${FILE}"
DST_FILE="${DST}/${FILE}"
# skip if source doesn't exist
if [[ ! -f "$SRC_FILE" ]]; then
#echo "Skipping missing: $SRC_FILE"
continue
fi
echo "==> Moving $SRC_FILE → $DST_FILE"
rsync "${RSYNC_OPTS[@]}" "$SRC_FILE" "$DST/"
# confirm destination exists
if [[ ! -f "$DST_FILE" ]]; then
echo "ERROR: destination file not found after rsync: $DST_FILE"
continue
fi
# if already mounted (target present in /proc/mounts) skip
if grep -Fq " ${SRC_FILE} " /proc/mounts; then
echo "Notice: $SRC_FILE is already a mount target. Skipping placeholder/mount."
continue
fi
# create placeholder at original path
echo "Creating empty placeholder at $SRC_FILE"
# remove leftover file (should be absent because rsync --remove-source-files removed it),
# but touch will recreate or overwrite a leftover directory check will prevent clobbering dir
if [[ -d "$SRC_FILE" ]]; then
echo "ERROR: $SRC_FILE exists and is a directory — skipping."
continue
fi
touch "$SRC_FILE"
# match ownership and permissions to the moved file
echo "Matching ownership and permissions from $DST_FILE to placeholder"
chown --reference="$DST_FILE" "$SRC_FILE"
chmod --reference="$DST_FILE" "$SRC_FILE"
# bind-mount moved file back to original path
echo "Bind-mounting $DST_FILE → $SRC_FILE"
if mount --bind "$DST_FILE" "$SRC_FILE"; then
echo "Mounted: $DST_FILE -> $SRC_FILE"
else
echo "ERROR: mount --bind failed for $DST_FILE -> $SRC_FILE"
# optionally remove placeholder on failure:
# rm -f "$SRC_FILE"
fi
done
echo "All done."
Step 3: Run the Script
• For safety, stop the Taraxa Docker container before running (so the DB isn’t changing)
Save the code in file move_sst_batch.sh
Execute the script with proper permissions:
sudo nano move_sst_batch.sh
chmod +x move_sst_batch.sh
./move_sst_batch.sh
you need to stop the snapshots option in the mainnet.json file
"db_config" :
{
"db_max_snapshots" : 0,
"db_snapshot_each_n_pbft_block" : 0
},
Step 4: Script Functionality
- The script defines
o SRC (/var/lib/docker/volumes/mainnet_data/_data/db/db)
o DST ( /mnt/taraxa_db/db on the HDD)
o sets rsync options, and checks it’s running as root. It creates the destination directory if needed. - It loops through files named 100000.sst up to 199999.sst. For each file found in SRC, it runs rsync -av with –remove-source-files to copy it to DST (deleting the original upon success).
- After copying, it confirms the file exists in DST. If it isn’t already mounted
- The script creates an empty placeholder at the original path, matches its ownership/permissions, and does mount –bind so the HDD copy appears at the original location.
- Missing or already-mounted files are skipped with a notice.
- This makes the move transparent: the Taraxa process still sees each file in its expected path, even though the data now lives on the HDD. 🙂
Step 5: Verify the Setup
- Run the Taraxa Docker container and Check the Taraxa node logs to ensure it’s running correctly.
- Monitor disk usage on both SSD and HDD to confirm data distribution.
Benefits
- Up to 70% reduction in storage costs, SSD/NVMe storage can cost roughly 3× more per GB than HDD .
Acknowledgments
Special thanks to Swiss-Taraxa and the community team @SwissTaraxa for sharing the original idea and script, and for their continuous support of the Taraxa ecosystem.
Disclaimer
This script and guide are provided as-is, without any warranties or guarantees of any kind.
- Use this script at your own risk
- Always test in a non-production environment first
- Always back up your data before making changes
- The authors, Swiss-Taraxa, and the website publishing this article are not responsible for any data loss, downtime, or damages resulting from the use or misuse of this script
- System configurations, hardware, and node setups may differ; results may vary
By using this script, you acknowledge that you understand the risks involved and take full responsibility for its execution and consequences.

Leave a Reply