How to setup raid for home?

I want to have a swapfile setup so I use the installer for this but I also have separate disks for /home files. So I have to install and migrate copying with rsync -aXs and change /etc/fstab followed with systemctl daemon-reload and mount -a. Also, I let the old /home as /home_bkp. It would be so good to have separate disk for home from the installer but in the meantime I am doing it this way.

The main issue is knowing how to setup the RAID with mdadm, I have done it twice and posts just point to the extensive non step by step setup of the Arch Wiki. I have read it and finally I have done some additional step from plainly creating the Array. Added the hook mdadm_udev on mkinitcpio.conf and did the rebuild with mkinitcpio -P and mdadm --detail --scan >> /etc/mdadm.conf. Am I missing something?
I have failed twice so far but didn’t do this last steps before, hope it works on next boot.

cat /etc/mdadm.conf
ARRAY /dev/md/0 metadata=1.2 UUID=5e8d2a6b:fb9e8a93:a16ff141:db2c45c1
ARRAY /dev/md127 metadata=1.2 UUID=f68ce2e3:57c7f7e4:f481a00a:607adb27

cat /proc/mdstat                                                                                                                                                                                   ✔ 
Personalities : [raid1] [raid0] 
md127 : active raid0 sdb[1] sdd[0]
      976508928 blocks super 1.2 512k chunks
md0 : active raid1 sdc[1] sda[0]
      2930134464 blocks super 1.2 [2/2] [UU]
      bitmap: 0/22 pages [0KB], 65536KB chunk

unused devices: <none>

sda           8:0    0   2.7T  0 disk  
└─md0         9:0    0   2.7T  0 raid1 
  └─md0p1   259:3    0   2.7T  0 part  
sdb           8:16   0 465.8G  0 disk  
└─md127       9:127  0 931.3G  0 raid0 /home
sdc           8:32   0   2.7T  0 disk  
└─md0         9:0    0   2.7T  0 raid1 
  └─md0p1   259:3    0   2.7T  0 part  
sdd           8:48   0 465.8G  0 disk  
└─md127       9:127  0 931.3G  0 raid0 /home
nvme0n1     259:0    0 232.9G  0 disk  
├─nvme0n1p1 259:1    0   300M  0 part  /boot/efi
└─nvme0n1p2 259:2    0 232.6G  0 part  /

/dev/nvme0n1p1: UUID="7E66-AC49" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="9690014d-4ed6-4238-81a3-bd08a37dc420"
/dev/nvme0n1p2: UUID="67dee1ad-e9b0-4462-9d0c-867ad061ef09" BLOCK_SIZE="4096" TYPE="f2fs" PARTLABEL="root" PARTUUID="d174680e-3ac3-498c-aa5d-419996e912ba"
/dev/md0p1: LABEL="backup" UUID="60357da7-61c2-4f9d-8471-e16c56ef8104" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="94bde4f9-9d75-42f5-a4b2-b3ff320a753f"
/dev/sdc: UUID="5e8d2a6b-fb9e-8a93-a16f-f141db2c45c1" UUID_SUB="cae14b16-a52b-9a51-1e73-c06e9dbed60c" LABEL="******:0" TYPE="linux_raid_member"
/dev/sda: UUID="5e8d2a6b-fb9e-8a93-a16f-f141db2c45c1" UUID_SUB="fad5f128-683a-6a1b-f72a-9d58987b276e" LABEL="********:0" TYPE="linux_raid_member"
/dev/sdd: UUID="f68ce2e3-57c7-f7e4-f481-a00a607adb27" UUID_SUB="fa66b6d2-f358-279e-1678-13853ce54887" LABEL="********:127" TYPE="linux_raid_member"
/dev/md127: UUID="3ef0da82-49f2-4279-8772-21440816f70c" BLOCK_SIZE="4096" TYPE="f2fs"
/dev/sdb: UUID="f68ce2e3-57c7-f7e4-f481-a00a607adb27" UUID_SUB="07968aa5-b799-34e5-4c43-7b958a5de9bf" LABEL="*******" TYPE="linux_raid_member"

There is an easy to use RAID-feature in btrfs


1 Like