Created
November 13, 2025 23:34
-
-
Save sumirati/37c11c4b8d6e7cb168cc65b9c7fd428d to your computer and use it in GitHub Desktop.
ZFS mirror with Ubuntu 24.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Instructions taken from https://gist.github.com/yorickdowne/a2a330873b16ebf288d74e87d35bff3e | |
| # | |
| # Modified to Ubuntu 24.04 - Covering the deltas | |
| # | |
| # Overview of parition layout for Ubuntu 24.04 installation: | |
| # part1 = EFI | |
| # part2 = bpool | |
| # part3 = swap | |
| # part4 = rpool | |
| # | |
| # Due to previous install on the "other disk", both partitions tables were already the same when I started | |
| # Therefore no need to do the gpart magic described - else it is still necessary | |
| # | |
| # Get overview on disks - machine is an old MacMini with Intel chips | |
| root@minido # ls -l /dev/disk/by-id | |
| total 0 | |
| lrwxrwxrwx 1 root root 9 Nov 13 20:28 ata-APPLE_HDD_HTS541010A9E662_J8900119HAV31C -> ../../sda | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 ata-APPLE_HDD_HTS541010A9E662_J8900119HAV31C-part1 -> ../../sda1 | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 ata-APPLE_HDD_HTS541010A9E662_J8900119HAV31C-part2 -> ../../sda2 | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 ata-APPLE_HDD_HTS541010A9E662_J8900119HAV31C-part3 -> ../../sda3 | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 ata-APPLE_HDD_HTS541010A9E662_J8900119HAV31C-part4 -> ../../sda4 | |
| lrwxrwxrwx 1 root root 9 Nov 13 20:28 ata-APPLE_HDD_HTS541010A9E662_J890011VH34S4C -> ../../sdb | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 ata-APPLE_HDD_HTS541010A9E662_J890011VH34S4C-part1 -> ../../sdb1 | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 ata-APPLE_HDD_HTS541010A9E662_J890011VH34S4C-part2 -> ../../sdb2 | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 ata-APPLE_HDD_HTS541010A9E662_J890011VH34S4C-part3 -> ../../sdb3 | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 ata-APPLE_HDD_HTS541010A9E662_J890011VH34S4C-part4 -> ../../sdb4 | |
| lrwxrwxrwx 1 root root 9 Nov 13 20:28 wwn-0x5000cca6a0d3052f -> ../../sda | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 wwn-0x5000cca6a0d3052f-part1 -> ../../sda1 | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 wwn-0x5000cca6a0d3052f-part2 -> ../../sda2 | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 wwn-0x5000cca6a0d3052f-part3 -> ../../sda3 | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 wwn-0x5000cca6a0d3052f-part4 -> ../../sda4 | |
| lrwxrwxrwx 1 root root 9 Nov 13 20:28 wwn-0x5000cca6c6cf866f -> ../../sdb | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 wwn-0x5000cca6c6cf866f-part1 -> ../../sdb1 | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 wwn-0x5000cca6c6cf866f-part2 -> ../../sdb2 | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 wwn-0x5000cca6c6cf866f-part3 -> ../../sdb3 | |
| lrwxrwxrwx 1 root root 10 Nov 13 20:28 wwn-0x5000cca6c6cf866f-part4 -> ../../sdb4 | |
| root@minido # zpool list -v | |
| NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT | |
| bpool 1.88G 104M 1.77G - - 6% 5% 1.00x ONLINE - | |
| wwn-0x5000cca6c6cf866f-part2 2G 104M 1.77G - - 6% 5.40% - ONLINE | |
| rpool 920G 3.91G 916G - - 0% 0% 1.00x ONLINE - | |
| wwn-0x5000cca6c6cf866f-part4 924G 3.91G 916G - - 0% 0.42% - ONLINE | |
| # Mirror the respective partitions to the other disk | |
| # As I installed Ubuntu previously on the other disk, I had to actually use -f to get the zdev accepted | |
| # | |
| root@minido # zpool attach rpool wwn-0x5000cca6a0d3052f-part4 /dev/disk/by-id/wwn-0x5000cca6a0d3052f-part4 | |
| root@minido # zpool attach bpool wwn-0x5000cca6c6cf866f-part2 /dev/disk/by-id/wwn-0x5000cca6a0d3052f-part2 | |
| # For swap, I had to install mdadm as predicted | |
| # Partition was -part3 - so I followed the instructions with that delta | |
| # fstab command should be instead of "UUID=" rather "/dev/disk/by-uuid/": | |
| root@minido # sudo sh -c "echo /dev/disk/by-uuid/$(sudo blkid -s UUID -o value /dev/md0) none swap discard 0 0 >> /etc/fstab" | |
| # Move GRUB boot menu to ZFS | |
| # | |
| # On Ubuntu 24.04, /boot/grub doesn't exist and reports from grub-probe as "zfs" already | |
| # the ZFS performance regression seems to have gone - not replicated | |
| # therefore skipped to update systemctl as well | |
| # | |
| # So overwrite the existing filesystem | |
| root@minido # mkdosfs -F 32 -s 1 -n EFI /dev/sda1 | |
| # Disable the grub fallback service as advised | |
| root@minido # systemctl mask grub-initrd-fallback.service | |
| # No reboot, directly into the reconfiguration for both packages, the signed one prompts - but shows both partitions | |
| root@minido # dpkg-reconfigure grub-efi-amd64 | |
| root@minido # dpkg-reconfigure grub-efi-amd64-signed | |
| # | |
| # Now a reboot can help - and yes, the Mac boots from either disk! | |
| # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment