1.4 Configuration¶
Update the system¶
Install the tools this guide uses:
The data directory¶
All service data lives under /data, separate from the operating system. That keeps backups, migrations and disk upgrades simple.
Check drive performance¶
Monero is very sensitive to storage speed. Find your drive's name, then measure it:
lsblk -o NAME,SIZE,ROTA,MODEL # ROTA 0 = SSD, 1 = spinning disk
sudo hdparm -t --direct /dev/nvme0n1 # or /dev/sda for a SATA drive
Expected output, for example:
NAME SIZE ROTA MODEL
nvme0n1 1.8T 0 Samsung SSD 980 PRO 2TB
├─nvme0n1p1 1G 0
└─nvme0n1p2 1.8T 0
/dev/nvme0n1:
Timing O_DIRECT disk reads: 5120 MB in 3.00 seconds = 1706.31 MB/sec
A SATA SSD shows about 400–550 MB/sec, NVMe a lot more. If ROTA is 1, or you see under 100 MB/sec, expect a very slow initial sync.
Running MoneroBox in a virtual machine
A virtual disk usually shows ROTA 1 and the model QEMU HARDDISK, even when it's stored on a fast SSD. There, only the hdparm speed tells you something. In Proxmox, tick SSD emulation and Discard in the VM's disk options (the VM must be powered off and on again for them to apply), so Ubuntu treats the disk as an SSD and can free unused space on the host.
Swap¶
The Ubuntu Server installer creates a swap file at /swap.img. Check its size:
With 4 GB of RAM, make it 8 GB so the initial sync doesn't run out of memory:
sudo swapoff /swap.img
sudo fallocate -l 8G /swap.img
sudo chmod 600 /swap.img
sudo mkswap /swap.img
sudo swapon /swap.img
The /swap.img line in /etc/fstab already turns it on at boot, so nothing else is needed.
Reboot¶
Wait a minute, then log back in with ssh nodeadmin@NODE_IP.
Validation¶
drwxr-xr-x 2 nodeadmin nodeadmin 4096 Oct 16 10:12 /data
total used free shared buff/cache available
Mem: 7.6Gi 410Mi 6.9Gi 1.0Mi 520Mi 7.2Gi
Swap: 8.0Gi 0B 8.0Gi
/data belongs to nodeadmin, and Swap shows the size you chose.
Extras (optional)¶
Check your SSD's health
SSDs wear out with writes, and a node writes a lot. smartctl shows how much life the drive has left:
sudo apt install -y smartmontools
sudo smartctl -a /dev/nvme0n1 | grep -iE 'percentage used|available spare|critical warning'
Percentage Used close to 100% means the drive is near the end of its rated life. Check it a few times a year.
Remove packages you no longer need
After upgrades, old kernels and unused dependencies pile up:
Troubleshooting¶
E: Could not get lock /var/lib/dpkg/lock-frontend
Right after the first boot, Ubuntu installs security updates in the background, and apt can only run once at a time. Wait a few minutes and try again. You can watch the background job with:
Don't delete the lock files: that can break the package database.hdparm: No such file or directory
Your drive has a different name. Use the NAME from lsblk for the whole disk (for example sda or nvme0n1), not a partition like nvme0n1p2.
swapoff: /swap.img: swapoff failed: Cannot allocate memory
The system is using more memory than it can free right now. Reboot, then run the swap commands again right after logging in, before starting anything else.