Root partition full... or not?

Hi all,
I don’t really know if this is the right forum section to post this question. I haven’t found a more suited section, so here we go.

My root partition is full. It is 41 GiBs big and it has 36 MiBs free.

I followed installation defaults, so my root partition is BTRFS while my home partition is XFS.

I do not understand very well BTRFS snapshots. I mean, I know what a snapshot is, but I don’t know why and when they are created when using BTRFS on OpenSUSE.

I tried to estimate how much space is used by the snapshots by doing a “du -h” on the /.snapshots tree, but I got 223 GiBs which is clearly not possible on a 41 GiBs partition.
I am almost sure BTRFS is using hard links so the mismatch in size is easily explained, but that still does not answer my question: am I at one step from disaster?

If so, what should I do to prevent it? May I remove some snapshots, or should I extend somehow the partition?

Thank you in advance.

Cris

A snapshot is created automatically every hour, and whenever you install/remove packages (one before and one after, so that it’s possible to exactly see/revert the changes by the action)

They are also automatically cleaned up once per day according to the settings.

I tried to estimate how much space is used by the snapshots by doing a “du -h” on the /.snapshots tree, but I got 223 GiBs which is clearly not possible on a 41 GiBs partition.
I am almost sure BTRFS is using hard links so the mismatch in size is easily explained, but that still does not answer my question: am I at one step from disaster?

It’s not exactly using hardlinks, but it is somehow similar, yes.
As long as a file is not changed, its snapshot doesn’t take any space. If a file is modified or deleted, the “copy” (or call it hardlink if you want to) is detached by the filesystem and is a file on its own (taking space on the hard disk) from then on.
So, it’s not really possible to estimate with du how full the disk really is.

If so, what should I do to prevent it? May I remove some snapshots, or should I extend somehow the partition?

Of course you can remove some snapshots. Either with “snapper delete xxx” or YaST->Snapper.
You could also tweak the snapshot settings in /etc/snapper/configs/root.
http://www.nrtm.org/index.php/2012/03/13/the-joys-of-btrfs-and-opensuse-or-no-space-left-on-device/comment-page-1/

You can also disable snapshots completely, the easiest way is probably to uninstall snapper, or see here:
http://activedoc.opensuse.org/book/opensuse-reference/chapter-4-snapshotsrollback-with-snapper#sec.snapper.disable (see the rest of the page for more information about snapper)

Thank you Wolfi,
your reply is - as always - enlightening and very thorough.

The articles you cited helped me understand a great deal of what’s happening under the cover.
I perused the man page for snapper, and also skimmed the snapper project home page (http://snapper.io).

However, there are still a couple of things that I do not understand:

  • I have not found any way to find the size of a snapshot. Snapper apparently does not have support for querying the size of a snapshot.
  • I have several snapshots with an “important=yes” tag. I am not sure if I can delete those. What’s the meaning of the “important=yes” tag in the “User data” column?

T.I.A.
Cris

Well, it’s not really possible to determine the size a snapshot takes on disk.
This is hidden by the btrfs filesystem, you cannot know which file is an actual file or just a “hard link”.
At least that’s what I think.

If you want to determine the free space on the partition, “btrfs filesystem df” might give better results.

  • I have several snapshots with an “important=yes” tag. I am not sure if I can delete those. What’s the meaning of the “important=yes” tag in the “User data” column?

Those are probably marked as important by the zypper plugin.
That one marks a snapshot as important, when certain packages are installed/updated.
The exact list is: kernel, dracut, glibc, systemd, and udev, see /etc/snapper/zypp-plugin.conf.

In principle you can delete them too.
But of course you won’t be able to revert that update then anymore, or boot to that snapshot. If you don’t experience any problems with your system, that shouldn’t matter though.

On Thu 27 Aug 2015 09:46:02 AM CDT, wolfi323 wrote:
<snip>

If you want to determine the free space on the partition, “btrfs
filesystem df” might give better results.

<snip>

Hi
For detailed info use;


btrfs filesystem usage /


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 GNOME 3.10.1 Kernel
3.12.44-52.10-default If you find this post helpful and are logged into
the web interface, please show your appreciation and click on the star
below… Thanks!

Thank you Malcolm,
that’s very interesting, although I’m not sure I understand everything in the output.
Well, another opportunity to learn something new!!

Cris

On Thu 27 Aug 2015 02:56:01 PM CDT, Cris70 wrote:

Thank you Malcolm,
that’s very interesting, although I’m not sure I understand everything
in the output.
Well, another opportunity to learn something new!!

Cris

Hi
I do note on SLE 12 there is a softlink to the btrfs maintenance tools
in /etc/cron.weekly btrfs-balance.sh (I use an ssd so btrfs-trim.sh as
well).

On both Leap 42.1 M1 and Tumbleweed they are not, so I manually add,
but try that out manually first and see if things clean up.

So check btrfsmaintenance package is installed and as root user run;


btrfs filesystem usage /
/usr/share/btrfsmaintenance/btrfs-balance.sh
btrfs filesystem usage /


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 GNOME 3.10.1 Kernel
3.12.44-52.10-default If you find this post helpful and are logged into
the web interface, please show your appreciation and click on the star
below… Thanks!