Root partition disc usage to high on laptop

I have a laptop i just occasionally use. It has opensuse tumbleweed installed and i recently updated everything. The problem I have is that my root (“/”) partition is nearly full.

The device has a 500GB nvme, 90GB are for the root btrfs partition (excluding /home).
The root partition is currently on 81GB, so i checked with

du -h -d 1 /

whats causing this and noticed non of the top level directories use more than a few hundred mb, but the one big space eater is: /.snapshots which has 185GB !!
I am sure that this amount is probably not correct because of btrfs but I am pretty sure that the snapshots are using most of the used disc space. But

snapper ls

does not show anything special, just about 5 snapshots (pre and post) most but one with a used space below 4mb, the one with a higher value uses 8gb though…

But for me that does not explain the high disc usage.

For a BTRFS system, you should use (not du or df):

btrfs filesystem usage -T /

And yes, you probably need to do a “clean-up” of past snapshots no longer required. I’ve had the same thing happen many many months ago, but cleaned out the snapshots and recovered quite a bit of space.

And if you want to provide us with the output of “…usage”, please use the Preformatted Text icon </> on the toolbar, and show the command you executed, plus the output, and the ending prompt.

2 Likes

@sabo007 If used infrequently the btrfs clean up services have not had a chance to run, you can’t use traditional tools with btrfs, as indicated by @aggie need to use the specific btrfs tools to get a true picture.

Over time btrfs will allocate space, but not necessarily use it. You can either as the system admin create a new time to run some minutes after booting, else just manually run the appropriate btrfs service… also check the like of journalctl --disk-usage and coredumpctl to clean up space before running btrfs maintenance.

2 Likes

Show full output of

snapper ls
btrfs subvolume list /
btrfs qgroup show /

Thank you, i will give you the output of the given commands:

goku:~ # btrfs filesystem usage -T /
Overall:
    Device size:          90.45GiB
    Device allocated:          90.45GiB
    Device unallocated:           1.00MiB
    Device missing:             0.00B
    Device slack:             0.00B
    Used:              85.85GiB
    Free (estimated):           2.79GiB    (min: 2.79GiB)
    Free (statfs, df):           2.79GiB
    Data ratio:                  1.00
    Metadata ratio:              1.00
    Global reserve:         124.75MiB    (used: 0.00B)
    Multiple profiles:                no

                  Data     Metadata System
Id Path           single   single   single   Unallocated Total    Slack
-- -------------- -------- -------- -------- ----------- -------- -----
 1 /dev/nvme0n1p2 87.42GiB  3.00GiB 32.00MiB     1.00MiB 90.45GiB     -
-- -------------- -------- -------- -------- ----------- -------- -----
   Total          87.42GiB  3.00GiB 32.00MiB     1.00MiB 90.45GiB 0.00B
   Used           84.63GiB  1.22GiB 16.00KiB 
goku:~ # snapper ls
    # | Type   | Pre # | Date                     | User | Used Space |
Cleanup | Description            | Userdata
------+--------+-------+--------------------------+------+------------+---------+------------------------+--------------
   0  | single |       |                          | root |            |
        | current                |
1101* | single |       | Wed Feb 16 16:21:48 2022 | root |  59.74 MiB |
       | writable copy of #1099 |
1249  | pre    |       | Wed Mar 20 22:57:13 2024 | root |   8.37 GiB |
number  | zypp(zypper)           | important=yes
1250  | post   |  1249 | Wed Mar 20 23:17:50 2024 | root |   3.25 MiB |
number  |                        | important=yes
1251  | pre    |       | Wed Mar 20 23:18:24 2024 | root |   1.19 MiB |
number  | zypp(zypper)           | important=yes
1252  | post   |  1251 | Wed Mar 20 23:19:09 2024 | root |   2.22 MiB |
number  |                        | important=yes
goku:~ # btrfs subvolume list /
ID 257 gen 386220 top level 5 path var
ID 258 gen 384503 top level 5 path usr/local
ID 259 gen 386220 top level 5 path tmp
ID 260 gen 384503 top level 5 path srv
ID 261 gen 384503 top level 5 path opt
ID 262 gen 386166 top level 5 path boot/grub2/x86_64-efi
ID 263 gen 384503 top level 5 path boot/grub2/i386-pc
ID 264 gen 386193 top level 5 path .snapshots
ID 1799 gen 386215 top level 264 path .snapshots/1101/snapshot
ID 2061 gen 384539 top level 264 path .snapshots/1249/snapshot
ID 2062 gen 386152 top level 264 path .snapshots/1250/snapshot
ID 2063 gen 386157 top level 264 path .snapshots/1251/snapshot
ID 2064 gen 386163 top level 264 path .snapshots/1252/snapshot 
goku:~ # btrfs qgroup show /
Qgroupid    Referenced    Exclusive   Path
--------    ----------    ---------   ----
0/5           16.00KiB     16.00KiB   <toplevel>
0/257         48.04GiB     48.04GiB   var
0/258         16.00KiB     16.00KiB   usr/local
0/259        152.00KiB    152.00KiB   tmp
0/260         16.00KiB     16.00KiB   srv
0/261          8.01GiB      8.01GiB   opt
0/262          4.23MiB      4.23MiB   boot/grub2/x86_64-efi
0/263         16.00KiB     16.00KiB   boot/grub2/i386-pc
0/264        716.00KiB    716.00KiB   .snapshots
0/1799        23.17GiB     59.74MiB   .snapshots/1101/snapshot
0/2013           0.00B        0.00B   <stale>
0/2016           0.00B        0.00B   <stale>
0/2017           0.00B        0.00B   <stale>
0/2018           0.00B        0.00B   <stale>
0/2019           0.00B        0.00B   <stale>
0/2020           0.00B        0.00B   <stale>
0/2037           0.00B        0.00B   <stale>
0/2047           0.00B        0.00B   <stale>
0/2048           0.00B        0.00B   <stale>
0/2049           0.00B        0.00B   <stale>
0/2057           0.00B        0.00B   <stale>
0/2058           0.00B        0.00B   <stale>
0/2059           0.00B        0.00B   <stale>
0/2060           0.00B        0.00B   <stale>
0/2061        22.42GiB      8.37GiB   .snapshots/1249/snapshot
0/2062        23.36GiB      3.25MiB   .snapshots/1250/snapshot
0/2063        23.36GiB      1.19MiB   .snapshots/1251/snapshot
0/2064        23.17GiB      2.22MiB   .snapshots/1252/snapshot
1/0           31.87GiB      8.76GiB   <0 member qgroups> 

You probably want to check, what consumes 40GB on your /var system.

it seems to be mostly flatpack tmp files:

goku:~ # du -h -d 1 /var
1.0G    /var/log
39G    /var/lib
5.6G    /var/cache
1.5G    /var/tmp
729M    /var/adm
0    /var/crash
0    /var/opt
192M    /var/spool
4.0K    /var/yp
0    /var/mpi-selector
0    /var/games
48G    /var 
goku:~ # du -h -d 1 /var/lib/flatpak/repo
38G    /var/lib/flatpak/repo/tmp
0    /var/lib/flatpak/repo/extensions
0    /var/lib/flatpak/repo/state
68K    /var/lib/flatpak/repo/refs
1.5G    /var/lib/flatpak/repo/objects
39G    /var/lib/flatpak/repo 

Well, at least you now know what eats your space. Also, /opt has 8GB which is not common either - usually /opt is empty.

yes i deleted all the flatpak cache files stored in the mentioned tmp directory. Also i deleted unity which took 8GB in /opt

Is there anything to do about the snapshots?

In the past I had an issue with flatpak taking more and more disk space, at some point I’ve run flatpak repair and ~20GB were freed and since then no issue, it is worth a try in your case.

Using graphical tools like Filelight can also help investigating what is taking a lot of disk space.

@sabo007 and @Aboutduck unless there is a particular use case, like MicroOS, setup the repo and install flatpaks as your user rather than systemwide.

Thanks for the suggestion but I’m not sure why you’re recommending installing everything user wide, from my understanding the only thing that change is the install directory ~ instead of /var so I think there’s good reasons I miss here…

In my case I had plenty of free space so it was not a big issue for me, still a bug that needed to be fixed…

I mostly keep all of my flatpak apps installed system wide because that’s how I’ve started using flatpak two years ago, not thinking much about it since I have only one user …

@Aboutduck then as in @sabo007 case, the system will be running fine with the disk space it has, then it would only be an issue for space being consumed at a user level. Plus there is no requirement to be root user to install…

1 Like

I see, so if /home and /var are separate partition it is worth installing everything user wide then … not really my case plus I have plenty of free disk space but it is a good point.

I was aware of that point, not really an issue for me but still a good point, thanks for the explanation.

1 Like