Goal: Bootable RAID 1 setup on 2 nvme SSDs during Debian 12 installation.
WARNING: This walkthrough assumes you will be using 2 empty SSDs.
If you need to retain data, please back it up appropriately as this process WILL be destructive!
Start by getting yourself a live installation ISO and create a bootable USB stick, plug it in and power on your host.
During boot, select "try Debian", not "install".
The installer is able to recognize a raid array, but you will not be able to create one during the installation.
Thus, we boot into the live installation and create the Raid1 array there, before booting up with the installer.
In the following sections we will:
- use UEFI as the boot mode and GPT (GUID Partition Table) for partitioning.
- create our RAID 1 array using `mdadm` and ext4 filesystem(s).
(BTRFS could also be used with its builtin software RAID support, but that is a different procedure.) - create an EFI partition (/boot/efi) as VFAT32, a separate boot partition (/boot) as ext4 and partitions for root (`/`), home (`/home`) etc as "partitions used as RAID members".
On my setup, the 2 nvme SSDs to be used for RAID1 are `/dev/nvme0n1` and `/dev/nvme1n1`.
That will be the devices referenced in all examples. Ensure you replace these device names as needed for your setup.
# Verify your disks
lsblkEnsure the SSDs appear clean
First, use `wipefs` to erase any filesystem, RAID or partition table signatures from both SSDs:
wipefs -a /dev/nvme0n1
wipefs -a /dev/nvme1n1Partition the Disks
With both drives "clean", we can partition them with identical partitions.
Here we create a GUID Partition Table (GPT) and 3 partitions on each disk:
An EFI System Partition (ESP) (will be mounted at /boot/efi)
A primary partition to hold our /boot filesystem
A primary partition to hold / (root) filesystem
# Partition nvme0n1
parted --script /dev/nvme0n1 \
mklabel gpt \
mkpart ESP fat32 1MiB 513MiB \
set 1 esp on \
mkpart primary ext4 513MiB 1.5GiB \
mkpart primary ext4 1.5GiB 100%
# Partition nvme1n1
parted --script /dev/nvme1n1 \
mklabel gpt \
mkpart ESP fat32 1MiB 513MiB \
set 1 esp on \
mkpart primary ext4 513MiB 1.5GiB \
mkpart primary ext4 1.5GiB 100%Create RAID1 arrays
We create a RAID1 array using the partitions that will hold our /boot filesystem:
# Create RAID1 array for /boot
mdadm --create --verbose /dev/mdboot \
--metadata=1.0 --level=1 --raid-devices=2 \
/dev/nvme0n1p2 /dev/nvme1n1p2Then we create a RAID1 array using the partitions that will hold our / (root) filesystem:
# Create RAID1 array for /
mdadm --create --verbose /dev/md0 \
--level=1 --raid-devices=2 \
/dev/nvme0n1p3 /dev/nvme1n1p3The arrays will begin syncing immediately. You can continue, but performance may be reduced until synchronization completes. You can monitor progress with:
cat /proc/mdstatCreate filesystems
First, we create a FAT32 filesystem on the EFI partitions:
# Create a FAT32 filesystem on EFI partitions
mkfs.fat -F32 /dev/nvme0n1p1
mkfs.fat -F32 /dev/nvme1n1p1Then, we create an ext4 filesystem on the RAID1 device we created for /boot above:
# Format /boot
mkfs.ext4 /dev/mdbootAnd finally, we create an ext4 filesystem on the RAID1 device we created for /:
# Format /
mkfs.ext4 /dev/md0Mount the target system and prepare for installation
At this point, the filesystems are created and ready to be mounted so the Debian installer can use them.
We begin by mounting the root filesystem:
mount /dev/md0 /mntNext, create and mount the /boot partition:
mkdir /mnt/boot
mount /dev/mdboot /mnt/bootThen mount the EFI partition. Since we created an EFI partition on both disks, we only mount one of them during installation:
mkdir -p /mnt/boot/efi
mount /dev/nvme0n1p1 /mnt/boot/efi(We will sync the second EFI partition after installation)
Now, the system is ready for installation.
Reboot the machine and start the Debian installer, this time selecting Install instead of Try Debian.
During the installation:
- Choose Manual partitioning
- Do NOT create or modify partitions
- Assign mount points as follows:
/dev/md0→//dev/mdboot→/boot/dev/nvme0n1p1→/boot/efi
- Ensure formatting is disabled, since we already created the filesystems
Proceed with the installation as normal.
Post-installation steps
Once the installation is complete, do not reboot immediately. Instead, switch to a shell to re-enter the system via chroot from the live environment.
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt /bin/bashFirst, ensure the RAID configuration is persisted:
# Ensure mdadm is installed
apt install mdadm
mdadm --detail --scan >> /etc/mdadm/mdadm.confUpdate initramfs so the RAID arrays are available at boot:
update-initramfs -uInstall and configure GRUB for both disks to ensure redundancy:
grub-install /dev/nvme0n1
grub-install /dev/nvme1n1
update-grubSynchronize EFI partitions
We created two EFI partitions, but only mounted one. To ensure redundancy, we should mirror the EFI contents to the second d
Create a mount point and mount the second EFI partition:
mkdir /boot/efi2
mount /dev/nvme1n1p1 /boot/efi2Then copy the contents:
rsync -aHAX /boot/efi/ /boot/efi2/To keep them in sync over time, you may:
- Periodically re-run
rsync, or - Use a tool like
efibootmgrin combination with manual updates, or - Set up a simple hook/script triggered on kernel updates
Some firmware will only use a single EFI boot entry. Installing GRUB on both disks improves resilience, but failover behavior depends on the system firmware.
Verify RAID status:
cat /proc/mdstat
mdadm --detail /dev/md0
mdadm --detail /dev/mdbootYou should see both arrays in a clean state with [UU], indicating both disks are active.
Final notes
- The system is now running with RAID1 redundancy for both
/and/boot - Either disk can fail without immediate downtime
- The EFI partition is not RAIDed, so manual sync is required
- Test failover by disconnecting one disk (if feasible) and confirming the system still boots
We now have a robust, bootable RAID1 setup on Debian 12 using mdadm, suitable for both bare metal and cloud environments.