NCRLinuxU2 Software RAID (UEFI)
The following procedure incorporates software RAID into an NCR supported terminal running NCRLinuxU2 distribution. The software RAID configuration is set to RAID1 mode.
The succeeding screenshots are from a CX8 terminal with two 120GB SATA solid state drives:
- sda—disk 1
- sdb—disk 2
The four partitions are as follows:
- 1—boot/efi
- 2—boot
- 3— swap
- 4—root
The procedure may need to be modified for use in other OS, when using NVMe drives, or using a different terminal. It is also assumed that two drives of the same type are used. At all times, it is assumed that the commands are run as a root user.
- Determine the terminal’s current OS partitions. In this case, the current OS is on /dev/sda and its partitions are:
- /dev/sda1
- /dev/sda2
- /dev/sda3
- /dev/sda4
- Create the same partitions for the second disk (/dev/sdb).
- Change the partition types on the second disk (/dev/sdb) to Linux RAID.
- Create the RAID arrays.
- Format the RAID arrays with the same file systems as the current OS partitions. Run the following commands:Copy
mkswap -L "SWAP" /dev/md3
Copymkfs.ext4 -L "ROOT" /dev/md4
- Edit the /etc/grub.d/40_custom file and add a RAID boot entry.Copy
menuentry 'RAID - NCRLinuxU2' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod mdraid1x
insmod ext2
set root='(hd0,gpt2)'
echo 'Loading Linux 5.15.0-73-generic raid ...'
linux /vmlinuz-5.15.0-73-generic root=/dev/md4 noresume splash=silent mitigations=auto quiet
net.ifnames=0 8250.nr_uarts=2 i915.invert_brightness=-1 tpm_tis.interrupts=0
echo 'Loading initial ramdisk raid...'
initrd /initrd.img-5.15.0-73-generic
}Note'(hd0,gpt2)' should be the partition where your /boot is located
ExampleBefore
After
- Create the RAID configuration file. Run the following command:Copy
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
- Update boot configurations. Run the following commands:Copy
update-initramfs -u
Copyupdate-grub
Copygrub-install /dev/sda
- Mount the RAID arrays (except the Swap array) to a temporary mount point. In this case, run the following commands:Copy
mkdir /mnt/md4
Copymount /dev/md4 /mnt/md4
- Copy the current EFI and OS partition data to the mounted RAID arrays. In this case, run the following command:Copy
cp -dpRx / /mnt/md4
- Edit the /etc/fstab file in the RAID array and replace necessary partitions to its equivalent RAID arrays. At this point, the file is located at /mnt/md4/etc/fstab.Example
Before
After
- Chroot to the mounted RAID array that contains the OS data and update the boot configurations. Run the following commands:Copy
cd /mnt/md4
Copymount /dev/sda2 boot
Copymount /dev/sda1 boot/efi
Copymount --bind /dev dev
Copymount --bind /sys sys
Copymount --bind /proc proc
Copychroot .
Copyupdate-initramfs -u
Copyupdate-grub
Copygrub-install --modules=mdraid1x.mod /dev/sda
Copyexit
Copyumount boot/efi boot dev sys proc
- Reboot the terminal and choose the RAID - NCRLinuxU2 boot entry.Note
Remove any bootable usb/flash drive at this point.
EFI boot manager will reset the default boot options. Wait for this operation to finish.
A start job for dev-md*.device is expected. Wait for this operation to finish.
At this point, the terminal should be able to boot the RAID configuration. To verify this, run the following command:
Copydf -h
- Change the partition types of the current OS that are on /dev/sda to Linux RAID.
- Add the partitions from the preceding step (current OS) to the RAID arrays accordingly. Run the following commands:Copy
mdadm --manage /dev/md3 --add /dev/sda3
Copymdadm --manage /dev/md4 --add /dev/sda4
- Wait for RAID to sync the disks. Run the following commands:
- Edit the /etc/grub.d/40_custom file and remove the RAID boot entry.
- Edit the /etc/default/grub file and do the following:
- Replace:Copy
rootp=$(blkid -L ROOT)
- In the line GRUB_CMDLINE_LINUX_DEFAULT, remove the string root=LABEL=root.
- Replace the string following resume= with /dev/md3.
ExampleBefore
After
- Replace:
- Update the boot configurations of the two disks. In this case, /dev/sda and /dev/sdb. Run the following commands:Copy
update-initramfs -u
Copyupdate-grub
Copygrub-install --modules=mdraid1x.mod /dev/sda
Copygrub-install --modules=mdraid1x.mod /dev/sdb
- Copy the boot and EFI partitions from /dev/sda to /dev/sdb. Run the following commands:Copy
dd if=/dev/sda1 of=/dev/sdb1
Copydd if=/dev/sda2 of=/dev/sdb2
- Reboot the terminal and expect that there is no RAID boot entry. The terminal should now boot on RAID1 configuration.Note
It is possible to test if RAID1 is working by shutting down and removing one of the drives, the system should still boot as normal. When that happens, one of the drives may be disconnected from the RAID1 array. Add the drive back to the array using the following commands:
Copymdadm /dev/md3 -a /dev/sdb3
Copymdadm /dev/md4 -a /dev/sdb4