Raidz in truenas scale vs proxmox vs mdadm of debian

Hey folks!

this is just a sorta general question regarding the 3 systems, with MASSIVE KUDOS to the folks at ixsystems for doing raidz1 nice and easy for truenas scale…

it comes about because i attempted to setup my first raid1 boot drive between 2 ssds when installing debian 12. I followed the process and learned that it’s not a true raid1. pull out the wrong drive and it doesn’t boot. eventually gave up and thought of trying it with proxmox ve… even with zfs raidz1 across the same boot drives, same thing… depending upon which drive you pull out, it won’t boot…

i tried it with my little backup nas last night… it has tnscale on it and 2x256GB SSDs for the boot/OS drives… no problem whatsoever… worked exactly as i always thought raid1 should…

Can someone explain to me why this is the case with truenas scale and not the others? especially proxmox… i would’ve thought that would be obvious.

Thanks!!

You may have been lucky with your final test and the second, mirrored boot device was the next in the boot order list.

i don’t know what you mean by that.

installing debian 12 with ext4 filesystem and mdadm does not create both drives precisely the same. the os install is the same on both, but the boot partitions are not. Truenas scale works… generic install of debian 12 and proxmox (yes, i went through the installation choosing raidz1 for the boot/os installation) does not produce the same result, and i observed this with gparted)…

EDIT:

sorry, i meant to say the boot drives were raidz Mirrored…

We have a x32/x64 legacy issue with boot order, as well as Linux distros not making proper OS Mirrors / RAID-1.

The first involves the old BIOS boot order, which can be changed before actually booting. Some BIOSes allow temporarily selecting an alternate boot device, like an OS ISO for recovery. But, this is still a mess and depends entirely on the BIOS and system board vendor

Sun Microsystem’s SPARC servers use OpenBoot, which allows making both a boot device list AND specifying the default boot order. If a boot device completely disappears, (died), then OpenBoot will automatically attempt the next device in the boot order. This is as close to ideal as you can get. Their can still be problems if the first boot device listed has bad blocks…

Now, for the Linux OS booting of a Mirror device, it has to be made as a 100% copy of the other Mirror device. Don’t know how some businesses handle it, but if you virtualize a Linux server and use SAN storage, that SAN storage does the Mirroring, (or RAID-x). For desktops, don’t know how various installers handle this. You seem to indicate Debian did it poorly.

For example, my 3 home Linux computers, (miniature desktop, laptop and miniature media server, all with 2 storage devices), have something like this below. This should allow booting either storage device, (SATA HDD, SATA SSD, or NVMe).

Filesystem                          Size  Used Avail Use% Mounted on
rpool/root/20241216                  25G  8.6G   16G  36% /
/dev/md3                            480M  169M  296M  37% /boot
/dev/md2                            100M  160K  100M   1% /boot/efi

I was conservative and made both “/boot” and “/boot/efi” separate from my ZFS root pool. But, both are MD Mirrored, (aka RAID-1) and are scrubbed twice a month, (just like my ZFS pools).

Now I have not tested removing the first boot device to see if the second will be bootable. Perhaps I need to add that when I replace my desktop soon. Or perhaps try booting both next time I perform a reboot.

I never meant to say debian did something wrong, if it were taken that way I apologize. from all i read (and i admit i don’t understand it completely, so there’s that), it’s more of a shortcoming with grub… either way, while the os is up and functioning, all is fine but between the two mirrors, if the one that fails has the boot partition, then the admins in a pickle because they’ve gotta jump through a LOT of hoops to get the server back up and running…

i was wondering (and maybe you’d know if this is possible), what about installing on one drive, cloning it to the other drive, and then setting the raid bit flag or whatever is done, after… or setting up an rsync between the two…

again, this is all way over my head at the moment…

also, i’m interested as to why this works on truenas scale but not proxmox running on a full compliment of zfs.

A debian 12 install using MD RAID1 is possible via the installer, but far from straightforward. See here: Install Debian Bookworm on a Software RAID and EFI | Andreas 'ads' Scherbaum

Proxmox doesn’t use MD RAID at all. A RAID1 install uses ZFS. In the case of “EFI”, Proxmox uses systemd-boot not GRUB. But it’s possible to do this kind of thing: 7 Steps to Install Proxmox VE on a UEFI MD RAID Array | dlford.io

A TrueNAS SCALE install on a two device mirror, of course uses ZFS. (I’ve lost track of what it does with swap now - does it still use MD RAID for this?) Not only do you get a proper mirror where you can boot from either device, but “boot environments” too.

I’m not sure if you’re aware of this, since you seem to be treating RAIDZ1 as the same as RAID1–they’re completely different animals. RAIDZ1 is parity RAID, somewhat like RAID 5 in traditional RAID levels. Proxmox incorrectly calls ZFS mirrors RAID1, even though they’re different (though similar) things. The proper term for ZFS’ equivalent to RAID1 is simply mirrors.

3 Likes

@jcizzo - Okay, I understand more clearly.

Their are 2 parts to Grub for booting. (And a 3rd for setting up or changing booting whence the OS is booted.)

First, it’s from the BIOS where the BIOS selects the boot device and launches the boot code. This is the part BEFORE you get the Grub menu, which allows launching the Grub menu. I install boot block code on both my boot devices, either because it’s MD-RAID Mirrored or manually.

grub-install --target=i386-pc /dev/sda
grub-install --target=i386-pc /dev/sdb
    or
grub-install --efi-directory=/boot/efi --target=x86_64-efi --no-nvram

Whence you get the Grub menu, if the target is Mirrored, (or even ZFS RAID-Zx), as long as Grub understands the file system, it can then continue with booting the OS. Technically, it's the Linux initial RAM disk that has the file system handling code that allows booting to RAIDed devices, (Mirror or other RAID).

Their are lots of gotchas. Here are the ones I can think of right now, in order:

  1. Bad block in the boot code on the first boot device. BIOSes, and probably EFI, may not be able to recover and select next boot device. But, user can manually select next boot device IF there is one. The problem is that BIOSes and probably EFI don’t understand Mirrors or RAID.
  2. Bad block in Grub / EFI code on first Mirror of “/boot” or “/boot/efi”. Again, user can select 2nd Mirror manually. Again, problem is that the boot block code does not understand Mirrors or RAID.
  3. Bad block in “/boot” for Linux kernel, initial RAM disk or other critical support file. Again, user can select 2nd Mirror manually. Again, problem is that Grub likely does not understand Mirrors or RAID.

Now one way some people get around this, is to use hardware RAID-1, (aka Mirroring), for “/boot”, (and “/boot/efi”). This theoretically prevents a failed Mirror from preventing booting. But, their is a problem. Most cheaper hardware RAID controllers don’t support both scrubbing AND automatically fixing bad blocks like ZFS does.

So, some people think using 3 devices for booting solves that problem. Use 2 way hardware RAID-1 Mirroring, and use ZFS Mirroring with that and a 3rd device. Thus, ZFS can both detect corruption in either the hardware RAID-1 Mirror or it’s other device. ZFS only sees it as a 2 way Mirror.


In a perfect world, we would have BIOSes that have:
  1. A clear, precise boot order that does not change when adding new devices
  2. Understand Mirrors, perhaps even have a clear setup in the boot order saying:
            Mirror of “sda” “sdb”
            Recovery “sdc”

Then have the boot code loaded above understand Mirroring too, so that reading a Mirrored “/boot” and or “/boot/efi” works regardless of bad blocks on either device, (as long as it’s not the same block on both devices that is needed).

Complicated but fixable.