0

With a ZFS root install, which partitions need to be canmount=noauto and why?

I am looking at a fresh installation of Ubuntu 20.04 with ZFS on root. I am using these instructions on the openzfs site, but there is one thing that I don't get which is bugging me.

from the guide:

3.2 Create filesystem datasets for the root and boot filesystems:

zfs create -o canmount=noauto -o mountpoint=/ rpool/ROOT/ubuntu
zfs mount rpool/ROOT/ubuntu

zfs create -o canmount=noauto -o mountpoint=/boot bpool/BOOT/ubuntu
zfs mount bpool/BOOT/ubuntu

With ZFS, it is not normally necessary to use a mount command (either mount or zfs mount). This situation is an exception because of canmount=noauto.

I understand that the noauto means that fstab or a mount command is needed to mount the volumes. but I don't get why it is necessary/recommended for some datasets but not others. Can someone help me understand that?

Stonecraft
  • 243
  • 2
  • 4
  • 15

1 Answers1

1

The tutorial itself explains why this was done for /boot:

Until there is support for mounting /boot in the initramfs, we also need to mount that, because it was marked canmount=noauto. Also, with UEFI, we need to ensure it is mounted before its child filesystem /boot/efi.

Thus it instructs you to configure an /etc/fstab entry.


In general you as an admin would set canmount=noauto when you want a dataset to be mountable but not mounted automatically when the zpool is imported. For example, a zpool containing a backup is a good use case for this.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
  • Thanks, I missed that part. So the `canmount=noauto` isn't really necessary for root? – Stonecraft Jun 12 '20 at 21:42
  • 1
    @Stonecraft That gets set as well by the tutorial, and since the initramfs is doing its special sauce to make that dataset the root filesystem it's not really necessary to be automounted. – Michael Hampton Jun 12 '20 at 21:43