sudoedit.com!

ZFS - Notes

Check ZFS compression

Use all to get all properties. zfs get compressratio <path>

luke@luke-IdeaPad5:~$ zfs get compressratio /var/log
NAME                              PROPERTY       VALUE  SOURCE
rpool/ROOT/ubuntu_xhbyc5/var/log  compressratio  4.97x  -

compression ratio

4.97x in the above means that I am storing 4.97 times as much data as disk space.

zfs get used,compressratio,compression,logicalused mypool/compressed_dataset
NAME        PROPERTY          VALUE     SOURCE
mypool/compressed_dataset  used              449G      -
mypool/compressed_dataset  compressratio     1.11x     -
mypool/compressed_dataset  compression       lz4       local
mypool/compressed_dataset  logicalused       496G      -

The dataset is currently using 449 GB of space (the used property). Without compression, it would have taken 496 GB of space (the logicalused property). This results in the 1.11:1 compression ratio. from: https://docs.freebsd.org/en/books/handbook/zfs/

ZFS Create Snapshot

zfs snap pool@snapname

zfs get info

zfs get all <path>

List snapshots by creation date

zfs list -t snapshot -o name,creation -s creation
NAME                                                              CREATION
rpool/USERDATA/luke_74j3lx@autozsys_g6z0oq                        Tue Aug 17 19:31 2021
bpool/BOOT/ubuntu_xhbyc5@autozsys_um49y5                          Tue Aug 17 19:35 2021
bpool/BOOT/ubuntu_xhbyc5@autozsys_a0dakj                          Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5@autozsys_um49y5                          Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5@autozsys_a0dakj                          Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/srv@autozsys_um49y5                      Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/srv@autozsys_a0dakj                      Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/usr@autozsys_um49y5                      Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/usr@autozsys_a0dakj                      Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/usr/local@autozsys_um49y5                Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/usr/local@autozsys_a0dakj                Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/var@autozsys_um49y5                      Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/var@autozsys_a0dakj                      Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/var/games@autozsys_um49y5                Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/var/games@autozsys_a0dakj                Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib@autozsys_um49y5                  Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib@autozsys_a0dakj                  Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib/AccountsService@autozsys_um49y5  Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib/AccountsService@autozsys_a0dakj  Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib/NetworkManager@autozsys_um49y5   Tue Aug 17 19:35 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib/NetworkManager@autozsys_a0dakj   Tue Aug 17 19:35 2021

List filesystems showing creation date

luke@luke-IdeaPad5:~$ zfs list -t filesystem -o name,used,mountpoint,creation
NAME                                               USED  MOUNTPOINT                CREATION
bpool                                              558M  /boot                     Tue Aug 17 19:24 2021
bpool/BOOT                                         556M  none                      Tue Aug 17 19:24 2021
bpool/BOOT/ubuntu_xhbyc5                           556M  /boot                     Tue Aug 17 19:24 2021
rpool                                             23.7G  /                         Tue Aug 17 19:24 2021
rpool/ROOT                                        12.3G  none                      Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5                          12.3G  /                         Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/srv                       192K  /srv                      Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/usr                       900K  /usr                      Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/usr/local                 708K  /usr/local                Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var                      3.30G  /var                      Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/games                 192K  /var/games                Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib                  3.15G  /var/lib                  Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib/AccountsService  1.35M  /var/lib/AccountsService  Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib/NetworkManager   5.86M  /var/lib/NetworkManager   Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib/apt               104M  /var/lib/apt              Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib/dpkg              194M  /var/lib/dpkg             Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/log                   151M  /var/log                  Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/mail                  192K  /var/mail                 Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/snap                 4.82M  /var/snap                 Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/spool                2.21M  /var/spool                Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/www                   192K  /var/www                  Tue Aug 17 19:24 2021
rpool/USERDATA                                    10.8G  /                         Tue Aug 17 19:24 2021
rpool/USERDATA/luke_74j3lx                        10.8G  /home/luke                Tue Aug 17 19:26 2021
rpool/USERDATA/root_74j3lx                        1.86M  /root                     Tue Aug 17 19:26 2021

Sort by used space

zfs list -t filesystem -o name,used,mountpoint,creation -s used

luke@luke-IdeaPad5:~$ zfs list -t filesystem -o name,used,mountpoint,creation -s used
NAME                                               USED  MOUNTPOINT                CREATION
rpool/ROOT/ubuntu_xhbyc5/srv                       192K  /srv                      Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/games                 192K  /var/games                Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/mail                  192K  /var/mail                 Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/www                   192K  /var/www                  Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/usr/local                 708K  /usr/local                Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/usr                       900K  /usr                      Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib/AccountsService  1.35M  /var/lib/AccountsService  Tue Aug 17 19:24 2021
rpool/USERDATA/root_74j3lx                        1.86M  /root                     Tue Aug 17 19:26 2021
rpool/ROOT/ubuntu_xhbyc5/var/spool                2.21M  /var/spool                Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/snap                 4.82M  /var/snap                 Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib/NetworkManager   5.86M  /var/lib/NetworkManager   Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib/apt               104M  /var/lib/apt              Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/log                   151M  /var/log                  Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib/dpkg              194M  /var/lib/dpkg             Tue Aug 17 19:24 2021
bpool/BOOT/ubuntu_xhbyc5                           556M  /boot                     Tue Aug 17 19:24 2021
bpool/BOOT                                         556M  none                      Tue Aug 17 19:24 2021
bpool                                              558M  /boot                     Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var/lib                  3.15G  /var/lib                  Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5/var                      3.30G  /var                      Tue Aug 17 19:24 2021
rpool/USERDATA/luke_74j3lx                        10.8G  /home/luke                Tue Aug 17 19:26 2021
rpool/USERDATA                                    10.8G  /                         Tue Aug 17 19:24 2021
rpool/ROOT/ubuntu_xhbyc5                          12.3G  /                         Tue Aug 17 19:24 2021
rpool/ROOT                                        12.3G  none                      Tue Aug 17 19:24 2021
rpool                                             23.7G  /                         Tue Aug 17 19:24 2021

You can sort by properties that are not shown


If you found this useful please consider supporting the blog.

Fastmail

I use Fastmail to host my email for the blog. If you follow the link from this page you'll get a 10% discount and I'll get a little bit of break on my costs as well. It's a win win.


Backblaze

Backblaze is a cloud backup solution for Mac and Windows desktops. I use it on my home computers, and if you sign up using the link on this page you get a free month of service through backblaze, and so do I. If you're looking for a good backup solution give them a try!

Thanks!

Luke

#notes #zfs