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 January 15, 2023 12:25:11 PM EST, H <agents@xxxxxxxxxxxxxx> wrote:
>On 01/14/2023 10:12 PM, 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.
>>
>> Since all disks, partitions, LUKS etc have their unique UUIDs I have
>not figured out how to do this and could use help and advice.
>>
>> In preparation for the above, I have:
>>
>> - Used rsync with the flags -aAXHv to copy all files on the existing
>SSD to an external harddisk for backup.
>>
>> - Partitioned the new SSDs as desired, including LVM and LUKS. My
>configuration uses one RAID1 for /boot, another RAID1 partition for
>/boot/efi, and a third one for the rest which also uses LVM and LUKS. I
>actually used a DVD image of Centos 7 (minimal installation) to
>accomplish this which also completed the minimal installation of the OS
>on the new disks. It boots as expected and the RAID partitions seem to
>work as expected.
>>
>> Since I want to actually move my existing installation from the
>existing SSDs, I am not sure whether I should just use rsync to copy
>everything from the old SSD to the new larger ones. However, I expect
>that to also transfer all OS files using the old, now incorrect UUIDs,
>to the new disks after which nothing will work, thus I have not yet
>done that. I could erase the minimal installation of the OS on the new
>disks before rsyncing but have not yet done so.
>>
>> I fully expect to have to do some manual editing of files but am not
>quite sure of all the files I would need to edit after such a copy. I
>have some knowledge of linux but could use some help and advice. For
>instance, I expect that /etc/fstab and /etc/crypttab would need to be
>edited reflecting the UUIDs of the new disks, partitions and LUKS, but
>which other files? Grub2 would also need to be edited I would think.
>>
>> The only good thing is that since both the old disk and the new disks
>are in the same computer, no other hardware will change.
>>
>> Is there another, better (read: simpler) way of accomplishing this
>transfer?
>>
>> Finally, since I do have a backup of the old SSD and there is nothing
>of value on the new mdadm RAID1 disks, except the partition
>information, I do have, if necessary, the luxury of multiple tries.
>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.
>>
>> Thanks.
>>
>>
>Upon further thinking, I am wondering if the process below would work?
>As stated above, I have two working disk setups in the same computer
>and depending on the order of disks in the BIOS I can boot any of the
>two setups.
>
>My existing setup uses one disk and no RAID (obviously), LUKS and LVM
>for everything but /boot and /boot/efi, total of three partitions. The
>OS is Centos 7 and I have made a complete backup to an external
>harddisk using rsync ("BACKUP1").
>
>The new one uses two disks, RAID1, LUKS and LVM for everything but
>/boot and /boot/efi, total of four partitions (swap has its own
>partition - not sure why I made it that way). A minimal installation of
>Centos 7 was made to this setup and is working. In other words, UUIDs
>of disks, partitions and LUKS are already configured and working.
>
>So, I am now thinking the following might work:
>
>- Make a rsync backup of the new disks to the external harddisk
>("BACKUP2").
>
>- Delete all files from the new disks except from /boot and /boot/efi.
>
>- Copy all files from all partitions except /boot and /boot/efi from
>BACKUP1 to the new disks. In other words, everything except /boot and
>/boot/efi will now be overwritten.
>
>- I would expect this system not to boot since both /etc/fstab and
>/etc/crypttab on the new disks contain the UUIDs from the old system.
>
>- Copy just /etc/fstab and /etc/crypttab from BACKUP2 to the new disks.
>This should update the new disks with the previously created UUIDs from
>when doing the minimal installation of CentOS 7.
>
>What do you think?

I am happy to share that my plan as outlined below worked. I now have /boot, /boot/efi and / on separate RAID partitions with the latter managed by LVM and encrypted.  All data from the old disk is now on the new setup and everything seems to be working.

However, going back to the issue of /boot/efi possibly not being duplicated by CentOS, would not mdadm take care of that automatically? How can I check?



[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