Need to limit the amount of reserved space on disk I guess for trash

I have Ubuntu MATE installed, 22.04 and I notice that there is a very large amount of disk space already used even with nothing on the disk other than the folders "lost+found" and ".Trash-1000"

The amount of space seem way too large that gets reported as used space. For instance on a 6 TB drive, there is 300GB that's designated as used space. On a 14 TB drive there is about 700GB that's designated as used. I'm losing 2/3 a TB of a 14TB drive to "used space", for which I'm guessing is space set aside for trash, but I'm not positive.

To be this almost seems absurd that such a large amount of disk (partition) space can be allocated for some reason other than open space for a user. I could understand a reasonable amount of space set aside on a system disk, but such a large amount of space for a data disk is unrealistic to me.

Is there any way to configure Ubuntu to set aside a different amount of space it reserves, or is there a per drive method for changing this? I'm looked at disk settings under a GUI disk tool "Disks" but I don't see anything.

The default reserved space is 5% of the disk. If you want to change it, see tune2fs.

example: set reserved space to 1% ... tune2fs -m 1 /dev/sda1

3 Likes

Thank you I'll give that a try. I already searched mount options and saw nothing.

This brings up another question though, since I would always want this done, is there a startup file where this command could be run from? Once again I was looking at the Disks tool and I don't see a place to add a command line to run after the file systems is mounted. I know about cron but understand that to be for adding events to run at particular times.

Also, if you have a Swap partition that is using up a designated portion of the HDD/SSD. You could change to a Swap file instead. Also, you could change the Swappiness from 60% to 10% but that's only good if you have 8GBs of RAM or more. Way over simplification of all the variables.

When you are using a file browser such as CAJA, you get 3 numbers dealing with capacity when you look at "Properties" when selecting a volume. You get Total Capacity, Free, Used. When you select a partition to get information, it doesn't matter if you have 100 partitions on the disk because you are only looking at a single partition.

This seems to be confusing for some reason. I was never talking about total DISK capacity, I was talking about a partition in the first place. I know I didn't make that clear until the 3rd para. when I typed "disk (partition)", but if people read the comment they should understand I'm talking about a partition, because THAT is what you select to get properties on and you can see the folders "lost+found" and ".Trash-1000"

So no, I have no confusion about the difference between a disk and a partition, but when you are browsing, a partition is treated like a disk of its own. Maybe I should have said "volume" but coming from the world of Windows one tends to think of a partition of a disk as a disk since it's assigned a drive letter. There, I hope I'm clear for anyone else who might come by and refer to something I'm not talking about.

I mean you realize that when you install drives in a system, you have to configure them, and that includes creating a swap partition so you'd think I would understand that point don't you think?

What I can tell you is if the system doesn't reserve data as the first comment talks about and what I was talking about, that if you don't have any files on that volume, then Total Capacity = Free Space, just like under Windows as long as the Recycle Bin is empty.

This brings up another question though, since I would always want this done, is there a startup file where this command could be run from? Once again I was looking at the Disks tool and I don't see a place to add a command line to run after the file systems is mounted. I know about cron but understand that to be for adding events to run at particular times.

If you want to run a command just after mounting a drive you could put that command in a file in the root of that mounted media named "autorun".
This way it gets executed after each mount.

2 Likes

THANKS! And I understand that after creating the file I must make it executable.

Hi, @david_barker :slight_smile:

To supplement the other good answers in this topic: the man page for the tune2fs command explains the purpose of the reserved blocks in an ext2/ext3/ext4 filesystem, in the section about the -m switch that @pavlos_kairis has rightly mentioned in his reply:

$ man tune2fs | grep '\ -m ' -A 4
-m reserved-blocks-percentage
Set the percentage of the file system which may only be allocated by privileged processes. Reserving some number of file system blocks for use by privileged processes is done to avoid file system fragmentation, and to allow system daemons, such as syslogd(8), to continue to function correctly after non-privileged processes are prevented from writing to the file system. Normally, the default percentage of reserved blocks is 5%.

I've found a similar discussion that took place here in the "Ubuntu MATE Community" in 2020 that seems relevant and may also be interesting to you:

2 Likes

Yeah this is why I asked about being able to set a value and was really hoping I'd be able to for each drive and it looks like I can do that with creating a file under the root of the drive.

For large volumes such as 14TB, 5% takes away too much space and I would set that for 1% which should be plenty no matter what the OS is trying to do, but for smaller volumes, especially the system volumes I think I'd rather leave it at the default. Thanks for the link, I looked over the different areas of the forums but didn't see anything so thanks. I also saw a discussion on the Ubuntu forum that relates to this.

2 Likes

You're welcome, David :slight_smile: I've seen that you also asked in this topic about running the "tune2fs -m ..." command in every mount. I have never used tune2fs to change the reserved block percentage of a filesystem, but my understanding is that you only need to execute it once for a given partition or logical volume (containing an ext2/ext3/ext4 filesystem). That is, you don't have to run it again on that same partition or logical volume, unless you want to change again the reserved block percentage of that partition or logical volume to yet another different percentage.

2 Likes

OK, so you're saying the change is permanent, or until I would run the command again to change it, which means it doesn't have to be in an autorun file?

OK, I'll check that out before I go through that work then. I haven't shut down my system and probably won't for a couple more days before I find out. Once again THANKS for the info. This is simply differences in how people use language because as I read through a couple of threads I never got the impression the change is permanent.

Hey have a good day and thanks once again.

2 Likes

Right :slight_smile: Based on my understanding, that's exactly what I'm saying, for a given partition or logical volume.

Let's say that you have the following partition layout:

  • /dev/sda1 mounted on /boot
  • /dev/sda2 mounted on /
  • /dev/sda3 mounted on /mymedia
    Let's assume that those 3 filesystems are "ext4" filesystems. When those filesystems were created, they most likely got the default percentage of 5% of reserved blocks for ext2/ext3/ext4 file systems.

So, if you run sudo tune2fs -m 1 /dev/sda3 (associated with the /mymedia mountpoint in this example) you're changing permanently the percentage of reserved blocks of that specific /mymedia filesystem to 1%. In this same example, /dev/sda1 (mounted on /boot) and /dev/sda2 (mounted on /) will remain with the default 5% of reserved blocks, unless you run tune2fs -m ... commands on those other file systems.

I hope I've been clear. You're welcome and I wish that you too have a good day :slight_smile:

3 Likes

Yes I had already set the volumes I wanted to 1% so the only thing I have to do if verify it stayed that way the next time I reboot. I have a mix of NTFS and EXT4 volumes because it's a dual boot system, and I only mount one of the NTFS volumes to be able to share those files between Windows and Linux.

I'm old fashioned, I still use Windows for gaming :slight_smile:

Thanks again.

2 Likes