The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,842 other followers

How can a partition be full if du does not show it is? (via: linux – Super User) #OpenSuSE #btrfs #snapshots

Posted by jpluimers on 2014/04/09

A long time ago I asked this OpenSuSE/Linux question: How can a partition be full if du does not show it is? – Linux on Super User.

With help of the OpenSuSE forums, I did figure out the source of the problem and solution, but I totally forgot to blog about it.

So below it is, just in case SuperUser ever shuts down, or the StackOverflow moderators are taking over SuperUser as well.

But first the comments in the questions about where I found the source and solution:

I found it through the openSUSE forums: it uses btrfs and snapshots. So the snapshots take up a lot of space. And I need to find out a way to delete old snapshots. forums.opensuse.org/english/get-technical-help-here/…

and

I think I found it: nrtm.org/index.php/2012/03/13/…

I wasn’t alone, so here are some more useful links and links from people asking for help:

–jeroen

PS: here is my SE question on it: linux – How can a partition be full if du does not show it is? – Super User.

Question: How can a partition be full if du does not show it is?

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

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

Original text on How can a partition be full if du does not show it is? – Linux on Super User.

One Response to “How can a partition be full if du does not show it is? (via: linux – Super User) #OpenSuSE #btrfs #snapshots”

  1. […] bumped into a disk full issue again because of the btrfs/snapper combination in openSuSE and df basically lying about the disk […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: