Linux – How can a partition be full if du does not show it is

linuxopensuseopensuse-12.2partitioning

On one of my systems, the root partition is full:

snip:˜ # df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs           11G  9.3G     0 100% /
devtmpfs        744M   36K  744M   1% /dev
tmpfs           751M     0  751M   0% /dev/shm
tmpfs           751M  296K  751M   1% /run
/dev/sda7        11G  9.3G     0 100% /
tmpfs           751M     0  751M   0% /sys/fs/cgroup
tmpfs           751M  296K  751M   1% /var/lock
tmpfs           751M  296K  751M   1% /var/run
tmpfs           751M     0  751M   0% /media
/dev/sda5       151M   39M  104M  28% /boot
/dev/sda8       4.4G  207M  3.3G   6% /home

But du does not show near 9.3 gigabyte of usage:

snip:~ # du /* -s -h
5.2M    /bin
34M /boot
36K /dev
22M /etc
199M    /home
154M    /lib
20M /lib64
0   /media
0   /mnt
0   /opt
0   /proc
7.9M    /root
288K    /run
7.1M    /sbin
0   /selinux
756K    /srv
0   /sys
0   /tmp
1.6G    /usr
1.1G    /var

It only accounts for about 3 gigabytes.

  • How can that be?
  • Where should I look for the remaining 6+ gigabytes of used gigabytes?

I'm using openSUSE 12.2:

snip:~ # cat /etc/SuSE-release
openSUSE 12.2 (x86_64)
VERSION = 12.2
CODENAME = Mantis

Best Answer

First some background information

If you have btrfs on your root file system on http://www.opensuse.org/en/, then two things will happen:

  1. openSUSE will automagically start using snapper to take snapshots of your root file system.
  2. the snapshots will take up diskspace that du doesn't show

This means that you will run out of disk space sooner than you'd expect. So the recommendation (not in the docs) is to make partitions that use snapshots twice as large as you normally would.

I have not found a way to show the size per snapshot or the total size of all snapshots.

So you have to monitor your free disk space with df or this btrfs specific command for the root (/) file system:

btrfs filesystem df /

Cleaning up snapper snapshots

Thanks to NerdyRoom™ » The joys of btrfs and OpenSuSE – or “no space left on device”. I found out the easiest way to delete older snapshots that you might want to delete (and you have to when you run out of disk space).

First run snapper list to see the sequence number of snapshots that are there.

From that list, select a reasonable lower and upper bound of snapshots to delete.

Then run this with the lower (1) and upper (3656) bound:

for i in `seq 1 3656`; do snapper delete $i; done

Edit 20161212:

An anonymous user suggested an edit to make this shorter. I agree, as the above can be done shorter as per snapper man page:

snapper delete 1-3656
Related Question