Score:0

Mirror GRUB to second ZFS disk in mirrored pool

cn flag

Question

I have system which was installed a few years ago. Initially, it was Ubuntu 18.04 with the boot drive set with ZFS installed using this guide. After upgrades it is now 22.04.

The pool is configured as a mirror with two same Samsung SSD drives.

I have recently realized that I can boot only using one of them (setting it as a boot drive in UEFI).

I would like to fix that and be able to boot with any of them in case of failure of the bootable one.

Solution?

In the mentioned guide there is a step called MIRROR GRUB describing the following command, which I probably didn't execute during the initial setup, but now I'm on Ubuntu 22.04 and probably a lot has changed since Ubuntu 18 so I'm not sure if these commands are the best approach?

umount /boot/efi

dd if=/dev/disk/by-id/scsi-SATA_disk1-part2 \
   of=/dev/disk/by-id/scsi-SATA_disk2-part2

efibootmgr -c -g -d /dev/disk/by-id/scsi-SATA_disk2 \
    -p 2 -L "ubuntu-2" -l '\EFI\ubuntu\shimx64.efi'

mount /boot/efi

Current state

My pool looks as following:

$ sudo zpool list
NAME      SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
rpool     232G   125G   107G        -         -    50%    53%  1.00x    ONLINE  -

$ sudo zfs list
NAME                                                                                      USED  AVAIL     REFER  MOUNTPOINT
rpool                                                                                     126G  98.8G       96K  /
rpool/ROOT                                                                               89.7G  98.8G       96K  none
rpool/ROOT/ubuntu                                                                        89.7G  98.8G     4.38G  /
rpool/ROOT/ubuntu/0058cf6ec00f84c29d63ef43d847ecbca59793453b622b36b35d9a8fd525ec3d       90.5M  98.8G      186M  legacy
rpool/ROOT/ubuntu/04582170cd4d7786ba31a845910ba3a948801baac4985d737ce9c63ee673629c       18.6M  98.8G      204M  legacy
[... lot of othere pools with strange guids ...]
rpool/home                                                                                593M  98.8G      112K  /home
rpool/home/root                                                                          12.0M  98.8G      556K  /root
rpool/swap                                                                               8.50G  99.8G     7.52G  -
rpool/var                                                                                2.60G  98.8G       96K  /var
rpool/var/cache                                                                          65.6M  98.8G     65.6M  /var/cache
rpool/var/log                                                                            2.54G  98.8G     2.54G  legacy
rpool/var/nfs                                                                              96K  98.8G       96K  /var/lib/nfs
rpool/var/spool                                                                           268K  98.8G      268K  /var/spool
rpool/var/tmp                                                                             160K  98.8G      160K  legacy

$ zpool status
  pool: rpool
 state: ONLINE
  scan: scrub repaired 0B in 00:06:06 with 0 errors on Thu Mar  2 03:06:08 2023
config:

        NAME                                                     STATE     READ WRITE CKSUM
        rpool                                                    ONLINE       0     0     0
          mirror-0                                               ONLINE       0     0     0
            ata-Samsung_SSD_860_EVO_250GB_S3YJNB0K100741M-part1  ONLINE       0     0     0
            ata-Samsung_SSD_860_EVO_250GB_S3YJNB0K551125K-part1  ONLINE       0     0     0

errors: No known data errors

$ ls -1 /dev/disk/by-id | grep Samsung
ata-Samsung_SSD_860_EVO_250GB_S3YJNB0K100741M
ata-Samsung_SSD_860_EVO_250GB_S3YJNB0K100741M-part1
ata-Samsung_SSD_860_EVO_250GB_S3YJNB0K100741M-part3
ata-Samsung_SSD_860_EVO_250GB_S3YJNB0K551125K
ata-Samsung_SSD_860_EVO_250GB_S3YJNB0K551125K-part1
ata-Samsung_SSD_860_EVO_250GB_S3YJNB0K551125K-part3

If I select my second drive as bootable in my UEFI then GRUB starts in recovery mode instead of booting the system.

Is the above script still gonna work in my setup?

I sit in a Tesla and translated this thread with Ai:

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.