ZFS on Linux has an excellent guide with step-by-step instructions for using ZFS as your root filesystem, for Ubuntu 18.04. This article deals with a specific problem that might arise during the procedure that prevents advancing to the next steps.
This will most likely occur if you are installing Ubuntu on a previously used disk (probably with another OS). When reaching step 5.6b in the guide (For UEFI booting, install GRUB) you might encounter an error that prevents GRUB installation. The error is related to /boot/efi
not being able to mount due to the following error:
$ mount /dev/disk/by-id/scsi-SATA_disk1-part3 /boot/efi
mount: /boot/efi: more filesystems detected on /dev/sda3; use -t <type> or wipefs(8).
/boot/efi
will also NOT show with df -h
and:
wipefs /dev/disk/by-id/scsi-SATA_disk1-part3
will output something similar to:
DEVICE OFFSET TYPE UUID LABEL
scsi-SATA_disk1-part3 0x52 vfat A4A6-8492 EFI
scsi-SATA_disk1-part3 0x0 vfat A4A6-8492 EFI
scsi-SATA_disk1-part3 0x1fe vfat A4A6-8492 EFI
scsi-SATA_disk1-part3 0x1ffbf000 zfs_member 17918387436641257880 rpool
scsi-SATA_disk1-part3 0x1ffbe000 zfs_member 17918387436641257880 rpool
...
Which indicates that there are zfs meta left on the partition conflicting with the new zfs data.
To resolve the situation, ZFS meta data has to be removed. In sort, since ZFS stores the header information in the first and last sector of the hard drive, all needed to be done is to wipe out the first and the last sector:
#replace /dev/sdXX with that actual ID of your hard drive
dd if=/dev/zero of=/dev/sdXX bs=512 count=10
dd if=/dev/zero of=/dev/sdXX bs=512 seek=$(( $(blockdev --getsz /dev/sdXX) - 4096 )) count=1M
Following this, you have to format the efi-partition. To do so, go back to step 4.8b (Install GRUB for UEFI booting) of the guide and use:
mkdosfs -F 32 -s 1 -n EFI /dev/disk/by-id/scsi-SATA_disk1-part2
You will also, probably be missing PARTUUID
number in your /etc/fstab
. To find out the PARTUUID
:
blkid -s PARTUUID -o value /dev/disk/by-id/scsi-SATA_disk1-part2
Having the PARTUUID
append the line with the missing serial in your /etc/fstab
PARTUUID=NEW_SERIAL /boot/efi vfat noatime,nofail,x-systemd.device-timeout=1 0 1
Finally mount /boot/efi
:
mount /boot/efi
You can check if it shows up with df -h
:
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 511M 444K 511M 1% /boot/efi
Hopefully, you can now continue where you left off, at step 5.6b (For UEFI booting, install GRUB) of the guide.
$ grub-install --target=x86_64-efi --efi-directory=/boot/efi \
--bootloader-id=ubuntu --recheck --no-floppy
and have the desired output:
Installing for x86_64-efi platform.
Installation finished. No error reported.
Enjoy coding!