https://access.redhat.com/discussions/2158911
https://access.redhat.com/solutions/68503
http://hpux-howto.blogspot.com/2018/07/how-to-migrate-boot-partition-to-other.html
[root@rhlabh1 ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: CentOS_Base CentOS_RSCT CentOS_Update Cleaning up list of fastest mirrors
[root@rhlabh1 ~]# fdisk -l /dev/mapper/mpatha Disk /dev/mapper/mpatha: 32.2 GB, 32212254720 bytes, 62914560 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x0000edc1 Device Boot Start End Blocks Id System /dev/mapper/mpatha1 * 2048 10239 4096 41 PPC PReP Boot /dev/mapper/mpatha2 10240 2107391 1048576 83 Linux /dev/mapper/mpatha3 2107392 62914559 30403584 8e Linux LVM
[root@rhlabh1 ~]# multipath -ll | grep mpath mpathc (360050111111100729800000000000128) dm-7 IBM ,2145 mpathb (3600501111111006e180000000000014f) dm-6 IBM ,2145 mpatha (360050111111183390800000000000174) dm-0 AIX ,VDASD
Copy the partition table from /dev/mapper/mpatha and put it on /dev/mapper/mpathb
[root@rhlabh1 ~]# sfdisk -d /dev/mapper/mpatha | sfdisk --force /dev/mapper/mpathb Checking that no-one is using this disk right now ... BLKRRPART: Invalid argument OK Disk /dev/mapper/mpathb: 30720 cylinders, 64 heads, 32 sectors/track sfdisk: /dev/mapper/mpathb: unrecognized partition table type Old situation: sfdisk: No partitions found New situation: Units: sectors of 512 bytes, counting from 0 Device Boot Start End #sectors Id System /dev/mapper/mpathb1 * 2048 10239 8192 41 PPC PReP Boot /dev/mapper/mpathb2 10240 2107391 2097152 83 Linux /dev/mapper/mpathb3 2107392 62914559 60807168 8e Linux LVM /dev/mapper/mpathb4 0 - 0 0 Empty Successfully wrote the new partition table Re-reading the partition table ... BLKRRPART: Invalid argument If you created or changed a DOS partition, /dev/foo7, say, then use dd(1) to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1 (See fdisk(8).)
List partitions on /dev/mapper/mpathb
[root@rhlabh1 ~]# fdisk -l /dev/mapper/mpathb Disk /dev/mapper/mpathb: 32.2 GB, 32212254720 bytes, 62914560 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 32768 bytes / 32768 bytes Disk label type: dos Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/mapper/mpathb1 * 2048 10239 4096 41 PPC PReP Boot /dev/mapper/mpathb2 10240 2107391 1048576 83 Linux /dev/mapper/mpathb3 2107392 62914559 30403584 8e Linux LVM
Rescan partitions
[root@rhlabh1 ~]# partprobe -s /dev/sda: msdos partitions 1 2 3 /dev/sdb: msdos partitions 1 2 3 /dev/sdc: msdos partitions 1 2 3 /dev/sdd: msdos partitions 1 2 3 /dev/sde: msdos partitions 1 2 3 /dev/sdf: msdos partitions 1 2 3 /dev/mapper/mpathb: msdos partitions 1 2 3 /dev/mapper/mpatha: msdos partitions 1 2 3 /dev/sdg: msdos partitions 1 2 3 /dev/sdh: msdos partitions 1 2 3 /dev/sdi: msdos partitions 1 2 3 /dev/sdj: msdos partitions 1 2 3
List now the partitions, you will find mpathb3
[root@rhlabh1 ~]# dmsetup ls mpathc (253:7) mpathb (253:6) centos_rhlabh1-swap (253:5) mpatha (253:0) centos_rhlabh1-root (253:4) mpatha3 (253:3) mpatha2 (253:2) mpatha1 (253:1) mpathb3 (253:10) mpathb2 (253:9) mpathb1 (253:8)
Create the physical volume on the partition /dev/mapper/mpathb3
[root@rhlabh1 ~]# pvs PV VG Fmt Attr PSize PFree /dev/mapper/mpatha3 centos_rhlabh1 lvm2 a-- 28.99g 0 [root@rhlabh1 ~]# pvcreate /dev/mapper/mpathb3 Physical volume "/dev/mapper/mpathb3" successfully created. [root@rhlabh1 ~]# pvs PV VG Fmt Attr PSize PFree /dev/mapper/mpatha3 centos_rhlabh1 lvm2 a-- 28.99g 0 /dev/mapper/mpathb3 lvm2 --- <29.00g <29.00g
Extend the VG
[root@rhlabh1 ~]# vgextend centos_rhlabh1 /dev/mapper/mpathb3 Volume group "centos_rhlabh1" successfully extended
Move the pv in background to new partition /dev/mapper/mpathb3, and check the progress, background allows to close your terminal
[root@rhlabh1 ~]# pvmove -b /dev/mapper/mpatha3 /dev/mapper/mpathb3 [root@rhlabh1 ~]# lvs -a -o+devices LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices [pvmove0] centos_rhlabh1 p-C-aom--- 28.99g /dev/mapper/mpatha3 4.89 /dev/mapper/mpatha3(0),/dev/mapper/mpathb3(0) [pvmove0] centos_rhlabh1 p-C-aom--- 28.99g /dev/mapper/mpatha3 4.89 /dev/mapper/mpatha3(768),/dev/mapper/mpathb3(768) root centos_rhlabh1 -wI-ao---- 25.99g pvmove0(0) swap centos_rhlabh1 -wI-ao---- 3.00g pvmove0(0)
Datas are moved to the new pv
[root@rhlabh1 ~]# lvs -a -o+devices LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Devices root centos_rhlabh1 -wi-ao---- 25.99g /dev/mapper/mpathb3(768) swap centos_rhlabh1 -wi-ao---- 3.00g /dev/mapper/mpathb3(0)
Remove old pv from vg and remove pv
[root@rhlabh1 ~]# vgreduce centos_rhlabh1 /dev/mapper/mpatha3 Removed "/dev/mapper/mpatha3" from volume group "centos_rhlabh1" [root@rhlabh1 ~]# pvremove /dev/mapper/mpatha3 Labels on physical volume "/dev/mapper/mpatha3" successfully wiped.
Copy /boot to the new partition
[root@rhlabh1 ~]# umount /boot [root@rhlabh1 ~]# fdisk -l /dev/mapper/mpathb Disk /dev/mapper/mpathb: 32.2 GB, 32212254720 bytes, 62914560 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 32768 bytes / 32768 bytes Disk label type: dos Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/mapper/mpathb1 * 2048 10239 4096 41 PPC PReP Boot /dev/mapper/mpathb2 10240 2107391 1048576 83 Linux /dev/mapper/mpathb3 2107392 62914559 30403584 8e Linux LVM [root@rhlabh1 ~]# dd if=/dev/mapper/mpatha2 of=/dev/mapper/mpathb2 bs=512 conv=noerror,sync 2097152+0 records in 2097152+0 records out 1073741824 bytes (1.1 GB) copied, 10.6589 s, 101 MB/s [root@rhlabh1 ~]# mount /boot
[root@rhlabh1 ~]# dd if=/dev/mapper/mpatha of=/dev/mapper/mpathb bs=1 count=512 512+0 records in 512+0 records out 512 bytes (512 B) copied, 0.00098152 s, 522 kB/s
Change the file /boot/grub2/device.map to use mpathb (else error), and recreate boot sectors
[root@rhlabh1 grub2]# cat /boot/grub2/device.map # this device map was generated by anaconda (hd0) /dev/mapper/mpathb [root@rhlabh1 ~]# grub2-install /dev/mapper/mpathb Installing for powerpc-ieee1275 platform. grub2-install: error: the chosen partition is not a PReP partition.
On Power, If you receive this message: grub2-install: error: the chosen partition is not a PReP partition. maybe you can try with:
[root@rhlabh1 ~]# grub2-install /dev/mapper/mpathb1 Installing for powerpc-ieee1275 platform. Installation finished. No error reported.
Check partition UUID (mpatha2 and mpathb2) should be the same, and it's used into /etc/fstab
[root@rhlabh1 grub2]# lsblk -f NAME FSTYPE LABEL UUID MOUNTPOINT sda mpath_member ├─sda1 none ├─sda2 none e955b6f1-6a76-41eb-8a0b-96322f473051 ├─sda3 none 1gIFAg-5Iid-5NR4-rAEj-Itby-V4dt-e5yw85 └─mpatha ├─mpatha1 ├─mpatha2 xfs e955b6f1-6a76-41eb-8a0b-96322f473051 └─mpatha3 ... sdc mpath_member ├─sdc1 none ├─sdc2 none ├─sdc3 none └─mpathb ├─mpathb1 ├─mpathb2 xfs e955b6f1-6a76-41eb-8a0b-96322f473051 /boot └─mpathb3 LVM2_member oq1ETt-Pgdq-kgLI-7ZK8-d1jm-3TeR-LwkhYC ├─centos_rhlabh1-root xfs 345579df-2481-47be-891e-3920919b8229 / └─centos_rhlabh1-swap swap 6d59a5a2-2737-4624-b916-0c5c7509f39b [SWAP]
Check /etc/fstab
[root@rhlabh1 grub2]# cat /etc/fstab ... /dev/mapper/centos_rhlabh1-root / xfs defaults 0 0 UUID=e955b6f1-6a76-41eb-8a0b-96322f473051 /boot xfs defaults 0 0 /dev/mapper/centos_rhlabh1-swap swap swap defaults 0 0
[root@rhlabh1 grub2]# grub2-install --recheck /dev/mapper/mpathb1 Installing for powerpc-ieee1275 platform. Installation finished. No error reported.
Check multipath devices (or add it manualy)
[root@rhlabh1 grub2]# cat /etc/multipath/wwids # Multipath wwids, Version : 1.0 # NOTE: This file is automatically maintained by multipath and multipathd. # You should not need to edit this file in normal circumstances. # # Valid WWIDs: /3600507680cxxxxxxxx000000000003c8/ /3600507680cxxxxxxxx000000000003c8/ /3600507680cxxxxxxxx000000000003c8/ [root@rhlabh1 grub2]# cat /etc/multipath/bindings # Multipath bindings, Version : 1.0 # NOTE: this file is automatically maintained by the multipath program. # You should not need to edit this file in normal circumstances. # # Format: # alias wwid # mpatha 3600507680cxxxxxxxx000000000003c8 mpathb 3600507680cxxxxxxxx000000000003c8 mpathc 3600507680cxxxxxxxx000000000003c8 [root@rhlabh1 grub2]# cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.$(date +%m-%d-%H%M%S).bak [root@rhlabh1 grub2]# dracut -v --add multipath --include /etc/multipath -f /boot/initramfs-$(uname -r).img $(uname -r)
[root@rhlabh1 grub2]# sync
[root@rhlabh1 grub2]# multipath -ll ... mpathb (3600501111111006e180000000000014f) dm-6 IBM ,2145 size=30G features='1 queue_if_no_path' hwhandler='0' wp=rw |-+- policy='service-time 0' prio=50 status=active | |- 2:0:0:0 sdc 8:32 active ready running | |- 3:0:0:0 sde 8:64 active ready running | |- 4:0:0:0 sdg 8:96 active ready running | `- 5:0:0:0 sdi 8:128 active ready running `-+- policy='service-time 0' prio=10 status=enabled |- 2:0:1:0 sdd 8:48 active ready running |- 3:0:1:0 sdf 8:80 active ready running |- 4:0:1:0 sdh 8:112 active ready running `- 5:0:1:0 sdj 8:144 active ready running mpatha (36005011111113390800000000000174) dm-0 AIX ,VDASD ...
Check the bootlist
[root@rhlabh1 grub2]# bootlist -m normal sdc sdd sdg sdh
Reboot
[root@rhlabh1 grub2]# init 6
Copy the efi boot manager, the label must be different to previous one
# efibootmgr -c --disk /dev/sdc --part 1 -L "Red Hat Enterprise Linux 7.3"