Home Linux Misc

start a screen session and change to root

detect the new drive lvmdiskscan take note of old drive vs new drive OLD: /dev/sda 25G NEW: /dev/sdc 50G * make sure you are not using a db raw drive. clean yum cache yum clean all look a current partitioning scheme parted /dev/sda print Model: VMware Virtual disk (scsi) Disk /dev/sda: 32.2GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1049kB 1075MB 1074MB primary xfs boot 2 1075MB 27.1GB 26.0GB primary lvm Create partitions on new drive. # verify that it has no partitions parted /dev/sdc print # set the label parted /dev/sdc mklabel msdos # Create the 1st partion for /boot at same start and end parted /dev/sdc mkpart primary xfs 1049kB 1075MB # set the boot flag on sdc1 parted /dev/sdc set 1 boot on # Create the 2nd partion for lvm , start at end of 1st partion end with -- -0 to get fullsize parted /dev/sdc mkpart primary 1075MB -- -0 # set the lvm flag on sdc2 parted /dev/sdc set 2 lvm on verify the 2 new partitions are there and proper parted /dev/sdc print Model: VMware Virtual disk (scsi) Disk /dev/sdc: 53.7GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1049kB 1075MB 1074MB primary boot 2 1075MB 53.7GB 52.6GB primary lvm show where each lvs are mapped , should all be /dev/sda2 lvs -o+devices rootvg verify the devices in /dev/mapper ls -al /dev/mapper/rootvg-* ls -al /dev/mapper/rootvg-* | wc # take note of that number for later Move Logical Volume to new disk pvcreate /dev/sdc2 vgextend rootvg /dev/sdc2 vgs rootvg # rootvg size should now be old disk + new disk in size. pvmove --atomic /dev/sda2 /dev/sdc2 verify that all lvs are on /dev/sdc2 only lvs -o+devices rootvg homelv rootvg -wi-ao---- 5.00g /dev/sdc2(1) optlv rootvg -wi-ao---- 1.00g /dev/sdc2(1282) rootlv rootvg -wi-ao---- 1.00g /dev/sdc2(1539) swaplv rootvg -wi-ao---- 4.00g /dev/sdc2(1796) tmplv rootvg -wi-ao---- 2.00g /dev/sdc2(2821) usrlv rootvg -wi-ao---- 5.00g /dev/sdc2(3334) varloglv rootvg -wi-ao---- 1.50g /dev/sdc2(4680) varlv rootvg -wi-ao---- 2.00g /dev/sdc2(5065) Remove old drive from vg vgreduce rootvg /dev/sda2 pvremove /dev/sda2 Clone /boot umount /boot dd if=/dev/sda1 of=/dev/sdc1 bs=512 conv=noerror,sync mount /boot verify that boot is now /dev/sdc1 df -h | grep boot Install grub on the new disk grub2-install /dev/sdc Sync to make sure everything is done sync

shutdown and re-order the drives in vmware so that the new drive is the first one