I followed this page, it looked promising but ultimately also went nowhere, in fact made the system unbootable just like the warning said.
Access Red Hat’s knowledge, guidance, and support through your subscription.
access.redhat.com
Posting the entire thing as there is a stupid Redhat login wall.
This worked well: (except my device file names are /dev/nvme0n1 and /dev/nvme1n1)
sfdisk -d /dev/vda | sfdisk --force /dev/vdb
The second command chocked, even with the -f flag (It tries to put the LVM disk header into onto the SSD).
pvcreate /dev/vdb2
I had to clean out the disk with the wipefs -a /dev/nvme1n1 command and then pvcreate worked.
then dd. I did not umount /boot, why would I have to do that? The dd ran for about 40 mins and appeared with no errors.
# umount /boot/
# dd if=/dev/vda1 of=/dev/vdb1 bs=512 conv=noerror,sync
# mount /boot
Then upon the reboot, I got stuck at the dracut prompt. To make things worse, the source SSD also got stuck at the dracut prompt. Neither the target nor the source were bootable anymore. I had to take out the source SSD, stick in a Win10 SSD, go into diskpart and wipe out all the partitions on the target SSD. Then installed the source Redhat SSD and it booted fine.
No idea why that is but not the first time. Don't get how something on the target SSD can prevent the source SSD from booting.
Anyway, back to square one.
the data appears to get copied just fine but I get the grub error, such as this one (third image attached).
Following the directions below, when running
grub2-install /dev/nvme1n1
grub2-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please specify --target or --directory.
I already have the grub2-efi-modules so not sure what else that it needs
but because the RHEL 8.9 system is not registered, it disabled all dnf/yum updates and I would have to install a package manually, offline with the repotrack command. And I am contemplating if I should go down that rabbit hole (with the feeling it won't work anyway) or just forget the whole thing and reinstall the OS on the correct SSD.
Cloning a SSD should not be
that difficult, geez, I have been trying for weeks, on and off. I was under the impression that dd did the entire disk, bit by bit and that was it.
____________________________________________________________
Migrate standard RHEL installation from one hard disk to another
Latest response
March 8 2022 at 9:56 AM
* DON'T DO ANY OF THIS, AS YOU WILL ALMOST CERTAINLY WRECK YOUR SYSTEM IF YOU DO! *
You have one standard installation of RHEL, you need migrate the installation from one hard disk to another, this is required due to technology improvement.
The server is productive and has running critical services, so is important minimize the migration window, this procedure requires only one reboot, if you want to apply all changes immediately but you can program the restart after.
For x86_64
Scenario:
Raw
vda -> Old Disk
vdb -> New Disk
centos -> root volume group
Partitioning:
Raw
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 18G 983M 17G 6% /
devtmpfs 487M 0 487M 0% /dev
tmpfs 497M 0 497M 0% /dev/shm
tmpfs 497M 6.7M 490M 2% /run
tmpfs 497M 0 497M 0% /sys/fs/cgroup
/dev/vda1 497M 164M 333M 33% /boot
tmpfs 100M 0 100M 0% /run/user/0
tmpfs 100M 0 100M 0% /run/user/1000
Raw
# fdisk -l
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 1026047 512000 83 Linux
/dev/vda2 1026048 41943039 20458496 8e Linux LVM
Steps:
Clean yum cache:
Raw
# yum clean all
Clone partitioning scheme:
Raw
# sfdisk -d /dev/vda | sfdisk --force /dev/vdb
Move Logical Volume to new disk:
Raw
# pvcreate /dev/vdb2
# vgextend centos /dev/vdb2
# pvmove /dev/vda2
# vgreduce centos /dev/vda2
# pvremove /dev/vda2
Clone /boot:
Raw
# umount /boot/
# dd if=/dev/vda1 of=/dev/vdb1 bs=512 conv=noerror,sync
# mount /boot
Copy boot sector:
Raw
# dd if=/dev/vda of=/dev/vdb bs=1 count=512
Install GRUB in new disk:
Raw
# grub2-install /dev/vdb
Sync changes:
Raw
# sync
Reboot your physical or virtual machine, please make sure that your new disk is the default boot device or remove old disk but don't delete data, can be useful in a rollback situation.
For POWER
Scenario:
Raw
sda -> Old Disk
sdb -> New Disk
ca -> root volume group
Partitioning:
Raw
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ca-root 28G 1.1G 27G 4% /
devtmpfs 449M 0 449M 0% /dev
tmpfs 495M 0 495M 0% /dev/shm
tmpfs 495M 12M 484M 3% /run
tmpfs 495M 0 495M 0% /sys/fs/cgroup
/dev/sda2 497M 143M 354M 29% /boot
tmpfs 99M 0 99M 0% /run/user/0
Raw
# fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 10239 4096 41 PPC PReP Boot
/dev/sda2 10240 1034239 512000 83 Linux
/dev/sda3 1034240 62914559 30940160 8e Linux LVM
Steps:
Clean yum cache:
Raw
# yum clean all
Clone partitioning scheme:
Raw
# sfdisk -d /dev/sda | sfdisk --force /dev/sdb
Move Logical Volume to new disk:
Raw
# pvcreate /dev/sdb3
# vgextend centos /dev/sdb3
# pvmove /dev/sda3
# vgreduce centos /dev/sda3
# pvremove /dev/sda3
Clone PPC PReP Boot partition:
Raw
dd if=/dev/sda1 of=/dev/sdb1 bs=512 conv=noerror,sync
Clone /boot:
Raw
# umount /boot/
# dd if=/dev/sda2 of=/dev/sdb2 bs=512 conv=noerror,sync
# mount /boot
Copy boot sector:
Raw
# dd if=/dev/sda of=/dev/sdb bs=1 count=512
Install GRUB in new disk:
Raw
# grub2-install /dev/sdb
If you receive this message:
grub2-install: error: the chosen partition is not a PReP partition. maybe you can try with:
Raw
# grub2-install /dev/sdb1
Sync changes:
Raw
# sync