3

I am running Ubuntu server on a machine with multiple hard drives and partitions. Recently, I split the system partition into two, sda2 and sda3. sda2 contains the system files, sda3 is mapped using LUKS and mounted into /home.

Today I was a bit stunned when I ran glances / df and both reported a negative amount of used disk space to me. (not negative available, negative used!) This seems to be due to more space being available than the size of the disk.

~$ df -h
Filesystem                  Size  Used Avail Use% Mounted on
tmpfs                       3.2G  1.5M  3.2G   1% /run
/dev/sda2                   336G  -40G  356G    - /
tmpfs                        16G  168K   16G   1% /dev/shm
tmpfs                       5.0M     0  5.0M   0% /run/lock
/dev/sda1                   511M  5.3M  506M   2% /boot/efi
/dev/mapper/data-drive       17T  6.4G   16T   1% /media/data
/dev/mapper/home-partition  3.3T  1.6G  3.1T   1% /home
tmpfs                       3.2G   20K  3.2G   1% /run/user/1001
tmpfs                       3.2G  8.0K  3.2G   1% /run/user/1000

Does anybody have any idea how this could've happened and what I can do to investigate / fix it?

1 Answers1

1

Besides corruption there is also a logical reason explained in the manual for tunefs.

5% (default for Ubuntu; it used to be 10 iirc) of disk space is reserved. Only the root processes can allocate space once disk usage exceeds 95%. Once this happens, free space is reported as a negative number.

The split you did probably caused you to go into the reserved disk space.

Any of these should fix it:

  • remove files from /dev/sda2
  • add more space to /dev/sda2
  • reduce the size of the reserved area (for ext that would be something like sudo tune2fs -m 3 /dev/sda2 should set it to 3%).
  • do a filesystem check.
Rinzwind
  • 309,379