By default ext4 reserves 5% of your disk for the root user. That made sense in 1999, but that’s insane now. You can run this command (as root) to reduce reserved blocks to around 4GB. On a 16TB ext4 file-system that will free up 795GB (since the default of 5% reserved = 800GB reserved for root!).
tune2fs -r 1000000 /dev/<disk-device>
This instantly frees up the space. You don’t need to unmount or remount or restart or anything.
But first use “lsblk” and “df” commands to identify the ext4 file-systems to tune.
And be careful! Running any command directly against any /dev/<disk-device> file as root is always dangerous. Practice on a computer/drive that’s not important first.
I knew this now you mention it but completely forgot about it. Thank you both; you’ve just bought me a few hours more plotting before my next batch of Western Digital Elements drives turn up from the nice Amazon man.
Very good point! Now that I think about it, reserved blocks really only make sense for the “/” partition (and I guess /var if it’s a separate mount). For everything else it’s just silly!
while we’re talking about linux filesystem things…
Don’t just assume that just because it’s 2021 linux will handle TRIM for you at mount.
You need to actually either setup a very frequent trimfs cron job, or mount with discard. You need to use a filesystem that actually supports it (not exfat).
I wasted a lot of time trying to figure out why my plots were running so slowly. Turns out my ssd was deeply disoriented, because trim wasn’t running at all.
If you aren’t using the partition for your Linux root/home directory you can bump this reserved space down to 0 and shouldn’t run into issues, adding 5% capacity for storing more plots.
To check if you have reserved blocks on a plot drive, these were the commands I found useful:
Get the list of partitions: df -h
For each partition that’s ext4 run this to check if there are reserved blocks: tune2fs -l /dev/partition | grep 'Reserved'
Finally, use tune2fs to set the reserve blocks to 0: tune2fs -r 0 /dev/partition
As far as I can tell this is safe to run and will not reformat the drive (I did it without problems AFAIK).
If you’re starting from an empty drive, you can use the -m parameter to set the % of blocks reserved to 0.
hi why doesn’t it work for me?
hdd formatted on ext4
sudo mkfs.ext4 -m 0 -T largefile4 -L HDD5 /dev/sda
mke2fs 1.45.5 (07-Jan-2020)
/dev/sda contains a ext4 file system labelled ‘HDD5’
last mounted on Wed Aug 4 08:35:11 2021
Proceed anyway? (y,N) y
/dev/sda is mounted; will not make a filesystem here!
Does anyone have any idea how we can make the “sudo tune2fs -r 0 /dev/$disk” command permanent? I guess I can create a script and cron job to run said script to do this. I was just wondering if there was a command to make this persistent?
How many plots if everyone getting on a 18tb. I am getting 164 plots when I use ext4 and 165 plots when I use NTFS. Better to use NTFS, even though it is slow to copy plots.