SYNOPSYS

RAID stands for Redundant Array of Inexpensive Disks.
I’m going to use 2 disks of similar capacity to setup a RAID1 (mirroring) for my /home partition.

PROCEDURE

prepare the disks

1
2
sgdisk -Z /dev/sdX # wipe out GPT and MBR data
sgdisk -n 0:64 -c 0:"raid1.x" -t 0:0xFD00 /dev/sdX # create the partition

create and assemble the RAID1 device /dev/md0

1
2
3
4
mdadm --create --verbose --level=1 --metadata=1.2 --chunk=64 --raid-devices=2 /dev/md0 /dev/sdb1 /dev/sdc1
mdadm --detail --scan
mdadm --assemble /dev/md0 --uuid <uuid> / --name <name> # name or uuid as shown in the above output
cat /proc/mdstat

format and mount (/etc/fstab)

1
2
3
mkfs.ext4 -v -L homearray -m 0.5 -b 4096 -E stride=16,stripe-width=16 /dev/md0

/dev/md0	/home         	ext4      	rw,relatime,data=ordered	0 1

other filesystem related cli to know about

1
2
wipefs # wipe a signature from a device
blkid # locate/print block device attributes