Re: Transferring an existing system from non-RAID disks to RAID1 disks in the same computer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15/01/2023 at 04:12, H wrote:
I need to transfer an existing CentOS 7 non-RAID setup using one single SSD to a mdadm RAID1 using two much larger SSDs. All three disks exist in the same computer at the same time. Both the existing SSD and the new ones use LVM and LUKS and the objective is to preserve the OS, all other installed software and data etc. Thus no new installation should be needed.
(...)
What I cannot do, however, is to make any modifications to the existing old SSD since I cannot afford not being able to go back to the old SSD if necessary.

Too bad. Without that constraint, I would use pvmove to transparently move LVM data from the old drive to the new ones.

Create EFI partitions on both new drives. Using RAID1 with metadata 1.0 (superblock at the end) with EFI partitions is a hack (corruption may happen if the UEFI firmware or anything outside Linux RAID writes to any of them).
Create the RAID arrays for LVM and /boot.
Create and open the new LUKS device in the RAID array with cryptsetup.
Add the related line it in /etc/crypttab.
Add the new encrypted device to the existing LVM volume group.
Move away data from the old encrypted device to the new one with pvmove.
Remove the old encrypted volume from the volume group with vgreduce.
Delete the related line from /etc/crypttab.
Copy data from the old /boot partition to the new /boot RAID array with rsync, cp or so. Mount the new /boot RAID array and the EFI partitions on /boot, /boot/efi and /boot/efi2 instead of the old partitions. Update /etc/fstab accordingly. Add the "nofail" option to the /boot/efi* lines. Update the initramfs if it includes information from crypttab or fstab. Make sure it includes RAID support.
Run update-grub or grub-mkconfig to update grub.cfg.
Reinstall GRUB on each EFI partition with grub-install.
If CentOS system configuration manager or GRUB package supports multiple EFI partitions, you can use that instead of reinstalling GRUB by hand.



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux