RAID 1 Installation Problem

Issues related to applications and software problems
Post Reply
tuski
Posts: 5
Joined: 2020/12/22 04:43:54

RAID 1 Installation Problem

Post by tuski » 2020/12/24 23:46:12

I am trying to setup RAID 1 on my server PC using mdadm. I have 2 500GB HDD. CentOS is installed on one of them. Here is lsblk output

Code: Select all

lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sr0              11:0    1  1024M  0 rom
nvme0n1         259:0    0   477G  0 disk
├─nvme0n1p1     259:2    0   200M  0 part /boot/efi
├─nvme0n1p2     259:3    0     1G  0 part /boot
└─nvme0n1p3     259:4    0 475.8G  0 part
  ├─centos-root 253:0    0    50G  0 lvm  /
  ├─centos-swap 253:1    0   7.6G  0 lvm  [SWAP]
  └─centos-home 253:2    0 418.1G  0 lvm  /home
nvme1n1         259:1    0   477G  0 disk
I am trying to include nvme0n1 and nvme1n1 disk into the RAID. My CentOS is running on nvme0n1 disk.
I tried this command

Code: Select all

 mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/nvme0n1 /dev/nvme1n1
but it shows me this error

Code: Select all

mdadm: cannot open /dev/nvme0n1: Device or resource busy
I also tried to include nvme0n1p3 and nvme1n1 disk into the RAID. But same error. What should I do? Thanks in advance.

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: RAID 1 Installation Problem

Post by jlehtone » 2020/12/25 11:49:04

"/dev/nvme0n1: Device or resource busy"

Of course. Be happy. If you could wipe /dev/nvme0n1 clean, you would lose everything you have there.


You have system installed. You want to migrate to RAID 1. You have LVM.
I would -- perhaps -- do:
1. Create same partitioning (three partitions) into nvme1n1 that is already in nvme0n1.
2. Create degraded RAID 1 array that contains /dev/nvme1n1p3 and missing. A "one-legged mirror".
3. Create PV into that array
4. Add the PV to VG 'centos'
5. pvmove LV's to use only extents that are on the array (probably move root and home, but remove swap and recreate it later)
6. Remove /dev/nvme0n1p3 from VG
7. Remove PV metadata from /dev/nvme0n1p3
8. Add /dev/nvme0n1p3 as the second leg of the array

nvme0n1p1 and nvme0n1p2 are not LVM's, so cannot be moved online, but their content can be copied. That is two more degraded arrays to create, copy to, and complete. /etc/fstab, initramfs image, and UEFI might need adjustments as partition/filesystem identities will change for /boot and /boot/efi.

Whoever
Posts: 1361
Joined: 2013/09/06 03:12:10

Re: RAID 1 Installation Problem

Post by Whoever » 2020/12/30 02:59:58

OP may also need to make sure Grub is installed and configured for both drives.

Post Reply