Hello everyone,
I’m trying to set up RAID 1 on my NUC in my homelab running openSUSE Leap Micro 6.0. I initially attempted to configure this using an Ignition file, but it seems that this is not currently possible with the SUSE implementation. I reported a bug on this issue and was advised [1] to use a Combustion script to configure Btrfs RAID 1 (I previously tried with mdadm
).
I don’t have much experience with RAID 1 implementation in Btrfs, but I’m currently testing it on a virtual machine. Here is the script I refined:
#!/bin/bash
# Redirect output to the console
exec > >(exec tee -a /dev/tty0) 2>&1
sfdisk -d /dev/vda | sfdisk /dev/vdb
btrfs device add /dev/vdb3 /
btrfs balance start -dconvert=raid1 -mconvert=raid1 /
echo 'root:$6$2HQOUnb4Gz//Lop0$cJC7fugfx71rcVx7EtmGtWohwrK6oEybrUm5BVPphxjhNZywosMDNybI3u5r3H3YqkRGog2BJcFZM0kGTwTQc/' | chpasswd -e
echo 'PermitRootLogin yes' > /etc/ssh/sshd_config.d/root.conf
# Leave A Marker
echo "Configured with combustion" > /etc/issue.d/combustion
# Close outputs and wait for tee to finish.
exec 1>&- 2>&-; wait;
After installation, my configuration looks as follows:
pc-3639:~ # lsblk -f
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
sr0 iso9660 Joliet Extension INSTALL 2024-06-11-15-51-21-00
vda
├─vda1
├─vda2 vfat FAT16 EFI C09C-3E18 12.2M 39% /boot/efi
│ /boot/efi
└─vda3 btrfs ROOT b717c727-07a5-4852-be81-b34a0a42e52c 37.4G 5% /boot/writable
/boot/grub2/x86_64-efi
/boot/grub2/i386-pc
/boot
/usr/local
/usr
/usr/local
/srv
/opt
/home
/boot/writable
/boot/grub2/x86_64-efi
/boot/grub2/i386-pc
/.snapshots
/var
/root
/
vdb
├─vdb1
├─vdb2
└─vdb3 btrfs ROOT b717c727-07a5-4852-be81-b34a0a42e52c
pc-3639:~ # btrfs filesystem df /
Data, RAID1: total=10.00GiB, used=2.09GiB
System, RAID1: total=32.00MiB, used=16.00KiB
Metadata, RAID1: total=512.00MiB, used=44.41MiB
GlobalReserve, single: total=5.50MiB, used=0.00B
pc-3639:~ # btrfs filesystem show /
Label: 'ROOT' uuid: b717c727-07a5-4852-be81-b34a0a42e52c
Total devices 2 FS bytes used 2.14GiB
devid 1 size 39.98GiB used 10.53GiB path /dev/vda3
devid 2 size 39.98GiB used 10.53GiB path /dev/vdb3
pc-3639:~ # btrfs filesystem usage /
Overall:
Device size: 79.95GiB
Device allocated: 21.06GiB
Device unallocated: 58.89GiB
Device missing: 0.00B
Device slack: 7.00KiB
Used: 4.27GiB
Free (estimated): 37.35GiB (min: 37.35GiB)
Free (statfs, df): 37.35GiB
Data ratio: 2.00
Metadata ratio: 2.00
Global reserve: 5.50MiB (used: 0.00B)
Multiple profiles: no
Data,RAID1: Size:10.00GiB, Used:2.09GiB (20.93%)
/dev/vda3 10.00GiB
/dev/vdb3 10.00GiB
Metadata,RAID1: Size:512.00MiB, Used:44.41MiB (8.67%)
/dev/vda3 512.00MiB
/dev/vdb3 512.00MiB
System,RAID1: Size:32.00MiB, Used:16.00KiB (0.05%)
/dev/vda3 32.00MiB
/dev/vdb3 32.00MiB
Unallocated:
/dev/vda3 29.45GiB
/dev/vdb3 29.45GiB
My main concerns are:
- The lack of complete partition structure on
/dev/vdb
compared to/dev/vda
. - Redundancy of the EFI partition.
- Data synchronization and recovery in case
/dev/vda
fails, since/dev/vdb
lacks an EFI partition and a complete filesystem structure.
Any advice or guidance on achieving a fully redundant setup, including the EFI partition, would be greatly appreciated.