-1

I have 3 TB internal harddisks which are (apparently) almost full. Df says 0 1k-blocks free but I can still copy a file of more than 200 Mb to the drive. What is wrong here?

Trevor
  • 1,111
  • 2
  • 18
  • 30
Niels
  • 537
  • 5
  • 22

1 Answers1

1

Ext4 keeps 5% of the disk as reserved space by default to prevent fragmentation. This space is not available to normal users but can be used by root. This is also why the equality
Total = Used + Available
doesn't hold when you look at the df output for an ext4 filesystem.

Try the following experiment.

$ fallocate -l 100M image.raw
$ mkfs.ext4 image.raw
$ sudo losetup -f image.raw
$ sudo mount /dev/loop0 /mnt
$ dd if=/dev/zero of=/mnt/file bs=512
dd: error writing ‘file’: No space left on device

The filesystem should have 95k total blocks, 0 available and about 88k used. If you then try doing the same as root

$ sudo dd if=/dev/zero of=/mnt/file2 bs=512

then you should be able to fill it up some more, up to about 93k blocks used.

jepio
  • 2,276
  • 1
  • 11
  • 16