When I am logged in as a user, I can see free disk space: 1.2 Gb, with Midnight Commander. Surprisingly when I run "sudo mc" then Midnight Commander shows a lot more free disk space: 1.9 Gb. How is it possible? Should I run fsck on next boot, or do I have a rootkit?
1 Answer
Some filesystems can reserve some disk space for administrators (so that admins have wiggle room in case filesystem gets “full”). By default for ext2/ext3/ext4 filesystems, 5% are reserved.
When running as root, Midnight Commander reports the disk space including the reserved disk space.
Decision to show one value or the other is made in this line of code: https://repo.or.cz/midnight-commander.git/blob/HEAD:/src/filemanager/mountlist.c#l1516
If you want to know more about this topic, info about the filesystem statistics is available in the statvfs(3)
man page.
The percentage of reserved disk space for administrators on ext2/ext3/ext4 can be adjusted using tune2fs
.
-
Thx, I also had to run fsck, because after running it I got immediately 1.7 GB free space as a regular user and 2.5 Gb free space as root. Commented Mar 6, 2019 at 5:45