Score:3

Where is my disk space gone in ZFS?

za flag

I use an encrypted ZFS Volume on a 512GB SSD, with Ubuntu 21.04 My disk seems suddenly to be very short, so I looked up some things :

xavier@imladris:/$ zpool status -v
pool: bpool
state: ONLINE
scan: scrub repaired 0B in 00:00:01 with 0 errors on Sun Jun 13 00:24:02 2021
config:

NAME                                    STATE     READ WRITE CKSUM
bpool                                   ONLINE       0     0     0
36f34ee4-398d-e14a-8b61-a377a7a0b42e  ONLINE       0     0     0

errors: No known data errors

pool: rpool
state: ONLINE
scan: scrub repaired 0B in 00:09:11 with 0 errors on Sun Jun 13 00:33:12 2021
config:

NAME                                    STATE     READ WRITE CKSUM
rpool                                   ONLINE       0     0     0
e08f204a-6cda-fd43-8672-4905b9e97070  ONLINE       0     0     0

errors: No known data errors

xavier@imladris:/$ zpool get size
NAME   PROPERTY  VALUE  SOURCE
bpool  size      1.88G  -
rpool  size      472G   -

xavier@imladris:/$ zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
bpool  1.88G   966M   954M        -         -     2%    50%  1.00x    ONLINE  -
rpool   472G   399G  72.9G        -         -    39%    84%  1.00x    ONLINE  -

OK, I really have a 512GB pool... But, If I sum the sizes used in my disk :

system        15 GB
home         195 GB

It doen't make 512GB

For details, here is df output (remember this is ZFS, partitioning is not relevant):

xavier@imladris:/$ df -h
Filesystem                                        Size  Used Avail Use% Mounted on
tmpfs                                             1.6G  2.9M  1.6G   1% /run
/dev/mapper/keystore-rpool                        453M  748K  419M   1% /run/keystore/rpool
rpool/ROOT/ubuntu_u3oejj                           72G   16G   57G  22% /
tmpfs                                             7.6G   16K  7.6G   1% /dev/shm
tmpfs                                             5.0M  4.0K  5.0M   1% /run/lock
tmpfs                                             4.0M     0  4.0M   0% /sys/fs/cgroup
rpool/USERDATA/adminlocal_hw08h3                   57G   84M   57G   1% /home/adminlocal
rpool/USERDATA/xavier_4h374a                      238G  181G   57G  77% /home/xavier
rpool/USERDATA/root_hw08h3                         57G  234M   57G   1% /root
rpool/ROOT/ubuntu_u3oejj/srv                       57G  256K   57G   1% /srv
rpool/ROOT/ubuntu_u3oejj/usr/local                 57G  8.8M   57G   1% /usr/local
rpool/ROOT/ubuntu_u3oejj/var/games                 57G  256K   57G   1% /var/games
rpool/ROOT/ubuntu_u3oejj/var/lib                   60G  2.5G   57G   5% /var/lib
rpool/ROOT/ubuntu_u3oejj/var/log                   59G  1.6G   57G   3% /var/log
rpool/ROOT/ubuntu_u3oejj/var/mail                  57G  1.8M   57G   1% /var/mail
rpool/ROOT/ubuntu_u3oejj/var/snap                  57G  3.5M   57G   1% /var/snap
rpool/ROOT/ubuntu_u3oejj/var/spool                 57G  8.9M   57G   1% /var/spool
rpool/ROOT/ubuntu_u3oejj/var/www                   57G  1.7M   57G   1% /var/www
rpool/ROOT/ubuntu_u3oejj/var/lib/AccountsService   57G  384K   57G   1% /var/lib/AccountsService
rpool/ROOT/ubuntu_u3oejj/var/lib/NetworkManager    57G  640K   57G   1% /var/lib/NetworkManager
rpool/ROOT/ubuntu_u3oejj/var/lib/apt               57G  249M   57G   1% /var/lib/apt
rpool/var/lib/docker                               57G  1.2M   57G   1% /var/lib/docker
rpool/ROOT/ubuntu_u3oejj/var/lib/dpkg              57G  223M   57G   1% /var/lib/dpkg
bpool/BOOT/ubuntu_u3oejj                          1.1G  262M  827M  25% /boot
/dev/nvme0n1p1                                    511M   14M  498M   3% /boot/efi
tmpfs                                             1.6G  232K  1.6G   1% /run/user/1001
Nmath avatar
ng flag
If you have a desktop environment, the application `filelight` is very helpful for seeing what is taking up space. It will scan your files and show a graphical representation of the comparative size of files and directories in a pie chart
Score:1
in flag

The missing space is most likely being used by snapshots. ZFS will generally manage this on its own but, if you are in a pinch for space or simply want to regain access to the storage, you can list and/or delete them as well.

To list all ZFS snapshots, enter this into Terminal:

sudo zfs list -t snapshot

The list will likely be quite long if you’re letting the system manage it’s own snapshots.

To delete a snapshot you no longer need, you can do this:

sudo zfs destroy rpool/USERDATA/jason_xkcd2z@FRI21-07-09

If you have decent backups and wish to destroy all ZFS snapshots in one go, you can do this:

zfs list -H -o name -t snapshot | xargs -n1 zfs destroy

Warning: There is no undo.

Xavier Humbert avatar
za flag
Thanks, it worked ! I suspected something like that, but wasn't sure
Fakhamatia avatar
cn flag
How remove only large snapshots?
in flag
@Fakhamatia if you can define “large” and write it as its own question, an answer can be provided. As it stands, the modification may be out of scope for this question
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.