Where is the space used?

I used docker to setup immich for an external library. It used up great amount of disk space up to almost 370GB. I noticed that the /var/lib/docker/overlay2 directory was storing the data so I deleted it with rm -r. Then I deleted the btrfs snapshots but the used space is still 370GB.

I also did a complete btrfs balance with not results.

Any ideas?

> sudo btrfs subvolume list /
[sudo] password for chris: 
ID 256 gen 57666 top level 5 path @
ID 257 gen 57667 top level 5 path @home
ID 258 gen 57667 top level 5 path @log
ID 259 gen 57661 top level 5 path @pkg
ID 260 gen 57613 top level 256 path var/lib/portables
ID 261 gen 57613 top level 256 path var/lib/machines
> sudo btrfs filesystem show /
Label: none  uuid: 2e7117ac-9e70-45df-8c39-5638a5bef669
        Total devices 1 FS bytes used 366.85GiB
        devid    1 size 1.82TiB used 375.06GiB path /dev/nvme0n1p2
> sudo btrfs filesystem du -s /home
     Total   Exclusive  Set shared  Filename
  50.50GiB    50.35GiB    66.98MiB  /home
> df -h
Filesystem                                      Size  Used Avail Use% Mounted on
dev                                              16G     0   16G   0% /dev
run                                              16G  2.1M   16G   1% /run
efivarfs                                        128K   26K   98K  21% /sys/firmware/efi/efivars
/dev/nvme0n1p2                                  1.9T  370G  1.5T  20% /
tmpfs                                            16G  1.7M   16G   1% /dev/shm
tmpfs                                            16G  9.7M   16G   1% /tmp
/dev/nvme0n1p2                                  1.9T  370G  1.5T  20% /home
/dev/nvme0n1p2                                  1.9T  370G  1.5T  20% /var/cache/pacman/pkg
/dev/nvme0n1p2                                  1.9T  370G  1.5T  20% /var/log
/dev/nvme0n1p1                                 1022M  274M  749M  27% /boot
tmpfs                                           3.1G  140K  3.1G   1% /run/user/1000
tmpfs                                           1.0M     0  1.0M   0% /run/credentials/systemd-journald.service

Please do not post images of text. A nice gui program to graphically show the space is baobab. Or for kde - filelight. On the command line, check also what du has to say. If you have sparse files like qcow2 virtual disks it may differ from df.

So the data are used by data/ in root. There is a directory /data/compose. I guess it is safe to delete it ?

A balance doesn’t help free up space.

On the contrary, a balance keeps Btrfs busy copying the data back and forth that Btrfs still considers valid (i.e., your entire 370 GB, depending on what filters you selected when balancing :wink:

Once you’ve replaced your screenshot with text, I’ll give you some more tips :wink:
:footprints:

You find good Information about Btrfs in the wiki,

and in Out of space

and btrfs layout info


You need to realize that the tools you used with ext4 are of little use with btrfs. Only by adapting your methodology can you find the problem.

The problem is one of the following:

  • There is at least one snapshot in which the data is still valid. (This is why btrfs can’t free the space. You should let btrfs list the snapshots itself.)
  • You’re using the wrong programs to get an idea of ​​the space usage (There are special programs that check each snapshot for its exclusive size. You should do this.)
  • You didn’t wait long enough after deleting before verifying your success (Deleting snapshots is a time-consuming process, whereas creating snapshots is instant.)

try using sudo btrfs filesystem usage /

1 Like

For btrfs, df can give misleading results. You can use btrfs filesystem usage -h / to see what is un-allocated, and you can use commands like btrfs balance start -dusage=50 / to allow btrfs more efficiently manage the space.

See here for more details: Btrfs Maintenance - Manjaro

And here for some notes: Btrfs full harddisk but still free disk space

2 Likes

There are no official packages to my knowledge that use a directory called /data.

What’s in it? Most likely you, or something you installed put it there.

1 Like

I set up an immich container using portainer.

sudo btrfs filesystem usage /
Overall:
    Device size:                   1.82TiB
    Device allocated:             60.06GiB
    Device unallocated:            1.76TiB
    Device missing:                  0.00B
    Device slack:                    0.00B
    Used:                         55.97GiB
    Free (estimated):              1.76TiB      (min: 903.16GiB)
    Free (statfs, df):             1.76TiB
    Data ratio:                       1.00
    Metadata ratio:                   2.00
    Global reserve:              175.42MiB      (used: 0.00B)
    Multiple profiles:                  no

Data,single: Size:56.00GiB, Used:53.81GiB (96.10%)
   /dev/nvme0n1p2         56.00GiB

Metadata,DUP: Size:2.00GiB, Used:1.08GiB (53.82%)
   /dev/nvme0n1p2          4.00GiB

System,DUP: Size:32.00MiB, Used:16.00KiB (0.05%)
   /dev/nvme0n1p2         64.00MiB

Unallocated:
   /dev/nvme0n1p2          1.76TiB

After deleting the /data

That looks normal and healthy to me.

2 Likes

So you have only 60GiB allocated. (in usage by btrfs)

And thereof 56Gib are real data

Your system is clean :heart:

:footprints:

(May be you did not wait long enough for btrfs to mark the free space. This is a time-consuming process, and is done in the background.)

You do not need any balancing (by now)

3 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.