btop icon indicating copy to clipboard operation
btop copied to clipboard

[BUG] Ubuntu on ZFS has strange fstab and mount points

Open RedBearAK opened this issue 3 years ago • 2 comments

This is more meant to be informational rather than a real bug report, but I think there will be progressively more systems running on top of ZFS as time goes on, due to the potential ease of instant snapshotting and recovery from system issues. So this is just something to think about.

My system is Ubuntu 21.10, upgraded from 21.04 and was installed with the ZFS-on-root option. So the disks box in BpyTOP or BTOP ends up being sort of useless regardless of whether "use fstab" is enabled or disabled. With fstab, it shows only EFI and GRUB entries, because that's all that appears in fstab. Without fstab it shows a long list of different things, many of which have the same "size" because they exist on the same ZFS filesystem. Most would be irrelevant to most users as independent listings, and the free/used is redundant with other entries.

I've tried looking at the mount points and the output of lsblk and the fstab, but... I don't know exactly how you might go about consolidating this type of system into a more sensible collection of "disks" in the disks box. But I'm pretty sure this will become more and more of an issue as time goes on.

This is what my Nautilus shows when I go into "Other Locations":

Screenshot from 2021-12-11 18-26-57

The "rpool" and "bpool" are not mountable (error: unknown filesystem type 'zfs_member'), so the fact that they are displayed at all in a file browser is probably fairly useless. But the thing labeled "Computer" is the root filesystem on th 4TB SATA drive that Ubuntu is installed on, and the one labeled "MacVM" is an NVMe drive.

Oh, and the whole main drive is encrypted, so that complicates the output.

Anyway, I don't know exactly how to solve this, but I figure there must be a relatively simple way to tease out just the main "volumes" and their overall sizes and used/free space, even on a system like this.

zfs list gives this mess:

NAME                                               USED  AVAIL     REFER  MOUNTPOINT
bpool                                              397M  1.36G       96K  /boot
bpool/BOOT                                         394M  1.36G       96K  none
bpool/BOOT/ubuntu_bcqdgs                           394M  1.36G      161M  /boot
rpool                                              553G  2.97T      192K  /
rpool/ROOT                                        22.2G  2.97T      192K  none
rpool/ROOT/ubuntu_bcqdgs                          22.2G  2.97T     5.92G  /
rpool/ROOT/ubuntu_bcqdgs/srv                       352K  2.97T      192K  /srv
rpool/ROOT/ubuntu_bcqdgs/usr                      7.52M  2.97T      192K  /usr
rpool/ROOT/ubuntu_bcqdgs/usr/local                7.34M  2.97T     3.66M  /usr/local
rpool/ROOT/ubuntu_bcqdgs/var                      12.2G  2.97T      192K  /var
rpool/ROOT/ubuntu_bcqdgs/var/games                 192K  2.97T      192K  /var/games
rpool/ROOT/ubuntu_bcqdgs/var/lib                  11.8G  2.97T     7.90G  /var/lib
rpool/ROOT/ubuntu_bcqdgs/var/lib/AccountsService  1.30M  2.97T      324K  /var/lib/AccountsService
rpool/ROOT/ubuntu_bcqdgs/var/lib/NetworkManager   4.74M  2.97T      624K  /var/lib/NetworkManager
rpool/ROOT/ubuntu_bcqdgs/var/lib/apt               108M  2.97T     81.8M  /var/lib/apt
rpool/ROOT/ubuntu_bcqdgs/var/lib/dpkg              493M  2.97T      104M  /var/lib/dpkg
rpool/ROOT/ubuntu_bcqdgs/var/log                   430M  2.97T      205M  /var/log
rpool/ROOT/ubuntu_bcqdgs/var/mail                  192K  2.97T      192K  /var/mail
rpool/ROOT/ubuntu_bcqdgs/var/snap                 9.04M  2.97T     2.90M  /var/snap
rpool/ROOT/ubuntu_bcqdgs/var/spool                3.04M  2.97T      428K  /var/spool
rpool/ROOT/ubuntu_bcqdgs/var/www                   192K  2.97T      192K  /var/www
rpool/USERDATA                                     530G  2.97T      192K  /
rpool/USERDATA/kris_w8vqdt                         530G  2.97T      484G  /home/kris
rpool/USERDATA/newuser_p5y9up                     77.3M  2.97T     76.7M  /home/newuser
rpool/USERDATA/root_w8vqdt                        6.18M  2.97T     2.24M  /root
rpool/keystore                                     518M  2.97T     48.1M  -

You can see here that the "used" is different on each line, but the "avail" is identical for each of the sub-pools that are part of the main pool.

This output can basically be trimmed down to this (with zfs list | grep -v "pool/"):

NAME                                               USED  AVAIL     REFER  MOUNTPOINT
bpool                                              397M  1.36G       96K  /boot
rpool                                              553G  2.97T      192K  /

And those are essentially the only relevant "volumes" with their used/free space.

Of course every system that uses ZFS-on-root will probably have different naming conventions for the basic pools. So there must be a more generic command that can trim it down to just the parent ZFS pools.

Oh, here, this makes more sense (zpool list):

NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
bpool  1.88G   398M  1.49G        -         -     1%    20%  1.00x    ONLINE  -
rpool  3.62T   553G  3.09T        -         -     5%    14%  1.00x    ONLINE  -

Output of cat /etc/fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# /boot/efi was on /dev/sda1 during installation
UUID=5742-EF92  /boot/efi       vfat    umask=0022,fmask=0022,dmask=0022      0       1
/boot/efi/grub	/boot/grub	none	defaults,bind	0	0
/dev/mapper/cryptoswap	none	swap	sw	0	0

Output from lsblk:

NAME             MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0              7:0    0 164.8M  1 loop  /snap/gnome-3-28-1804/161
loop1              7:1    0  61.3M  1 loop  /snap/authy/6
loop2              7:2    0  61.5M  1 loop  /snap/authy/7
loop3              7:3    0 144.6M  1 loop  /snap/chromium/1810
loop4              7:4    0 253.2M  1 loop  /snap/brave/138
loop5              7:5    0  55.5M  1 loop  /snap/core18/2246
loop6              7:6    0   219M  1 loop  /snap/gnome-3-34-1804/72
loop7              7:7    0    51M  1 loop  /snap/snap-store/547
loop8              7:8    0  15.5M  1 loop  /snap/whitesur-gtk-theme/147
loop9              7:9    0  15.6M  1 loop  /snap/whitesur-gtk-theme/155
loop10             7:10   0 213.8M  1 loop  /snap/code/83
loop11             7:11   0  99.4M  1 loop  /snap/core/11798
loop12             7:12   0  85.7M  1 loop  /snap/standard-notes/77
loop13             7:13   0  54.2M  1 loop  /snap/snap-store/558
loop14             7:14   0 147.8M  1 loop  /snap/chromium/1827
loop15             7:15   0 242.3M  1 loop  /snap/gnome-3-38-2004/76
loop16             7:16   0 247.9M  1 loop  /snap/gnome-3-38-2004/87
loop17             7:17   0  99.4M  1 loop  /snap/core/11993
loop18             7:18   0     4K  1 loop  /snap/bare/5
loop19             7:19   0   219M  1 loop  /snap/gnome-3-34-1804/77
loop20             7:20   0 253.8M  1 loop  /snap/brave/139
loop21             7:21   0  55.5M  1 loop  /snap/core18/2253
loop22             7:22   0  43.3M  1 loop  /snap/snapd/14295
loop23             7:23   0 222.2M  1 loop  /snap/code/82
loop24             7:24   0  85.7M  1 loop  /snap/standard-notes/76
loop25             7:25   0  42.2M  1 loop  /snap/snapd/14066
loop26             7:26   0  61.8M  1 loop  /snap/core20/1242
loop27             7:27   0  61.9M  1 loop  /snap/core20/1270
loop28             7:28   0  65.2M  1 loop  /snap/gtk-common-themes/1519
loop29             7:29   0  65.1M  1 loop  /snap/gtk-common-themes/1515
sda                8:0    0   3.6T  0 disk  
├─sda1             8:1    0   512M  0 part  /boot/efi
├─sda2             8:2    0     2G  0 part  
│ └─cryptoswap   253:1    0     2G  0 crypt [SWAP]
├─sda3             8:3    0     2G  0 part  
└─sda4             8:4    0   3.6T  0 part  
zd0              230:0    0   500M  0 disk  
└─keystore-rpool 253:0    0   484M  0 crypt /run/keystore/rpool
nvme0n1          259:0    0 476.9G  0 disk  
└─nvme0n1p1      259:1    0 476.9G  0 part  /media/kris/MacVM

Output from mount:

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=11205548k,nr_inodes=2801387,mode=755,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=2249004k,mode=755,inode64)
/dev/mapper/keystore-rpool on /run/keystore/rpool type ext4 (rw,relatime,stripe=2)
rpool/ROOT/ubuntu_bcqdgs on / type zfs (rw,relatime,xattr,posixacl)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k,inode64)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=26740)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
rpool/USERDATA/newuser_p5y9up on /home/newuser type zfs (rw,relatime,xattr,posixacl)
rpool/USERDATA/kris_w8vqdt on /home/kris type zfs (rw,relatime,xattr,posixacl)
rpool/ROOT/ubuntu_bcqdgs/usr/local on /usr/local type zfs (rw,relatime,xattr,posixacl)
rpool/USERDATA/root_w8vqdt on /root type zfs (rw,relatime,xattr,posixacl)
rpool/ROOT/ubuntu_bcqdgs/srv on /srv type zfs (rw,relatime,xattr,posixacl)
rpool/ROOT/ubuntu_bcqdgs/var/games on /var/games type zfs (rw,relatime,xattr,posixacl)
rpool/ROOT/ubuntu_bcqdgs/var/lib on /var/lib type zfs (rw,relatime,xattr,posixacl)
rpool/ROOT/ubuntu_bcqdgs/var/log on /var/log type zfs (rw,relatime,xattr,posixacl)
rpool/ROOT/ubuntu_bcqdgs/var/spool on /var/spool type zfs (rw,relatime,xattr,posixacl)
rpool/ROOT/ubuntu_bcqdgs/var/snap on /var/snap type zfs (rw,relatime,xattr,posixacl)
rpool/ROOT/ubuntu_bcqdgs/var/mail on /var/mail type zfs (rw,relatime,xattr,posixacl)
rpool/ROOT/ubuntu_bcqdgs/var/www on /var/www type zfs (rw,relatime,xattr,posixacl)
rpool/ROOT/ubuntu_bcqdgs/var/lib/NetworkManager on /var/lib/NetworkManager type zfs (rw,relatime,xattr,posixacl)
/var/lib/snapd/snaps/gnome-3-28-1804_161.snap on /snap/gnome-3-28-1804/161 type squashfs (ro,nodev,relatime,x-gdu.hide)
rpool/ROOT/ubuntu_bcqdgs/var/lib/AccountsService on /var/lib/AccountsService type zfs (rw,relatime,xattr,posixacl)
rpool/ROOT/ubuntu_bcqdgs/var/lib/apt on /var/lib/apt type zfs (rw,relatime,xattr,posixacl)
rpool/ROOT/ubuntu_bcqdgs/var/lib/dpkg on /var/lib/dpkg type zfs (rw,relatime,xattr,posixacl)
/var/lib/snapd/snaps/authy_6.snap on /snap/authy/6 type squashfs (ro,nodev,relatime,x-gdu.hide)
tmpfs on /run/qemu type tmpfs (rw,nosuid,nodev,relatime,mode=755,inode64)
bpool/BOOT/ubuntu_bcqdgs on /boot type zfs (rw,nodev,relatime,xattr,posixacl)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sda1 on /boot/grub type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/var/lib/snapd/snaps/authy_7.snap on /snap/authy/7 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/chromium_1810.snap on /snap/chromium/1810 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/brave_138.snap on /snap/brave/138 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core18_2246.snap on /snap/core18/2246 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gnome-3-34-1804_72.snap on /snap/gnome-3-34-1804/72 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snap-store_547.snap on /snap/snap-store/547 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/whitesur-gtk-theme_147.snap on /snap/whitesur-gtk-theme/147 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/whitesur-gtk-theme_155.snap on /snap/whitesur-gtk-theme/155 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/code_83.snap on /snap/code/83 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core_11798.snap on /snap/core/11798 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/standard-notes_77.snap on /snap/standard-notes/77 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snap-store_558.snap on /snap/snap-store/558 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/chromium_1827.snap on /snap/chromium/1827 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gnome-3-38-2004_76.snap on /snap/gnome-3-38-2004/76 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gnome-3-38-2004_87.snap on /snap/gnome-3-38-2004/87 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core_11993.snap on /snap/core/11993 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/bare_5.snap on /snap/bare/5 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gnome-3-34-1804_77.snap on /snap/gnome-3-34-1804/77 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/brave_139.snap on /snap/brave/139 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core18_2253.snap on /snap/core18/2253 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snapd_14295.snap on /snap/snapd/14295 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/code_82.snap on /snap/code/82 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/standard-notes_76.snap on /snap/standard-notes/76 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snapd_14066.snap on /snap/snapd/14066 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core20_1242.snap on /snap/core20/1242 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core20_1270.snap on /snap/core20/1270 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gtk-common-themes_1519.snap on /snap/gtk-common-themes/1519 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gtk-common-themes_1515.snap on /snap/gtk-common-themes/1515 type squashfs (ro,nodev,relatime,x-gdu.hide)
none on /sys/fs/cgroup/net_cls type cgroup (rw,relatime,net_cls)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=2249000k,nr_inodes=562250,mode=700,uid=1000,gid=1000,inode64)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
portal on /run/user/1000/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
tmpfs on /run/snapd/ns type tmpfs (rw,nosuid,nodev,noexec,relatime,size=2249004k,mode=755,inode64)
nsfs on /run/snapd/ns/snap-store.mnt type nsfs (rw)
pcloud_81a7ec981a9f6aba47a163c15ee59c47 on /tmp/.mount_pcloudifcTgg type fuse.pcloud_81a7ec981a9f6aba47a163c15ee59c47 (ro,nosuid,nodev,relatime,user_id=1000,group_id=1000)
pCloud.fs on /home/kris/pCloudDrive type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/nvme0n1p1 on /media/kris/MacVM type ext4 (rw,nosuid,nodev,relatime,errors=remount-ro,uhelper=udisks2)

So, long story short you could probably show something more useful in "disks" on any system where you detect ZFS-on-root by switching to using the output of zpool list with the associated mount points as names. My system would just show "/boot" and "/" (root) as relevant volumes in the disks box if you took this approach.

Thoughts?

RedBearAK avatar Dec 12 '21 08:12 RedBearAK

Something like this might be easier to detect with ZFS. Just show the pools, not the datasets within the pools.

$  zpool list -o name,size,alloc
NAME    SIZE  ALLOC
bpool     2G  1.69G
rpool    56G  19.6G

Gives you the name of the pool, the size and how much is used.

To get the data in a less human readable (better for scripting, etc):

$ zpool list -o name,size,alloc -H -p
bpool   2147483648      1812520960
rpool   60129542144     21005828096

BTW - /etc/fstab does not even need to reference ZFS stuff, so btop does not see anything related to ZFS for me. This is my /etc/fstab:

$ cat /etc/fstab 
/dev/disk/by-uuid/517E-F751 /boot/efi vfat defaults 0 0

The only disk BTOP detects is the EFI partition.

reefland avatar Jun 06 '22 01:06 reefland

I think this issue can be closed as btop can detect ZFS without any problems now.

simplepad avatar Oct 09 '22 02:10 simplepad