You are not logged in.

#1 2023-03-04 19:51:20

GeneArch
Member
Registered: 2013-07-28
Posts: 72

Dual Root - Aka Hot Spare Boot Disk

What is Dual Root?

   This is a machine with 2 "root" disks where the second one is a hot standby - in event of root disk failure the second disk can be booted very quickly. This makes recovering very fast and thereafter replacing the bad drive and rebuilding very straightforward.  And no new install needed! This can be added to any machine - the only requirement is an available disk with the adequate space and able to be partitioned with its own <esp> etc.

   I have now set this up on a few machines and its working well so far.   I wrote up some notes and am sharing them in case others may be interested in doing something similar might find them useful.

   My notes  are available here:
   https://github.com/gene-git/blog

One of the lovely things about linux, is there is often more than 1 way to do things - I'm sure that applies here too smile

Best

gene

Offline

#2 2023-03-07 19:08:46

GeneArch
Member
Registered: 2013-07-28
Posts: 72

Re: Dual Root - Aka Hot Spare Boot Disk

To let you know made quite a few changes.

Major updates - added an improved approach (thanks to comments on arch-general mailing list).

This approach still has 2 disks each with it's own <esp> and each has a root partition - the 2 root partitions are joined with btrfs raid1.
The esp's get mounted at /efi0, /efi1.

Whichever <esp> was used to boot the system automatically gets bind mounted to /boot.
An inotify based sync daemon keeps the alternate esp synchronized (e.g. update an initrd or install a kernel - these immediately get sync'ed onto the other esp(s).

All the docs and code are available:
-  AUR package   :  https://aur.archlinux.org/packages/dual-root
- source repo      :  https://github.com/gene-git/dual-root

I have this running and its working well for me - I would appreciate wider testing.  Even just running the tool in 'test' mode as non-root user would be helpful.

   With no arguments "dual-root-tool"  - prints out info about currently booted esp.
   With "-t -b" prints out what might do for bind mounting active esp onto /boot
   With "-t -s" prints out what would happen for a one time sync from active esp to alternate
   With "-t -sd" runs the inotify daemon - still in test mode. Will wait for a change event (e.g. touch /boot/XXX)

Again the idea being when root disks fails this helps provide a rapid recovery. Since with this, the machine will still run and boot - just replace the bad disk, partition as before, add root back into raid1 and bootctl install into the esp. Back to normal smile

Thanks to all for ideas and suggestions.

Offline

#3 2023-03-07 19:24:19

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,343
Website

Re: Dual Root - Aka Hot Spare Boot Disk

In what way is this different from a plain raid1?  What do these tools add beyond just following the wiki for a raid1 using established tools like mdadm?

Last edited by Trilby (2023-03-07 19:49:42)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2023-03-07 19:42:09

GeneArch
Member
Registered: 2013-07-28
Posts: 72

Re: Dual Root - Aka Hot Spare Boot Disk

This follows standard raid1 for the 2 root partitions - that's the trivial part.

The interesting part is having 2 <esp>s and being able to boot of either disk in event of one disk failing. ESPs are not part of the raid.
So this keeps the the 2nd esp in sync with the currently booted esp.

In this setup one esp is mounted at /efi0 and the other at /efi1 - regardless of which disk is booted.  whichever esp was booted, is then automatically bind mounted onto /boot.
And whatever changes occur in that efi are automatically synced with the alternate efi.

If there is only 1 esp, as in the standard setup - then if the disk that fails holds the esp - your out of luck. Though your root data is still fine - you just can't boot until you "fix" it. This avoids that problem.

Hope that helps.

Last edited by GeneArch (2023-03-07 19:43:44)

Offline

Board footer

Powered by FluxBB