Reducing the size of an LV
Reducing the size of an LV is a bit complicated task, there are few things which you need to keep in mind before reducing the size of an LV.
LV size cannot be reduced online, it requires a down time i.e. unmounting the file system.
Organized the data before reducing the size of LV.
Update the file system about the size. I.e. what its size will be after reduction.
Finally reduce the size
If any of the above things are missed then it will be a mess, you may corrupt the file system and LV.
Check the size of the lv using df -h command
Unmount the LV using umount command
Organize the data in LV by using e2fsck command
#e2fsck -f /dev/myvg/mylv.
Update the file system by using resize2fs command
#resize2fs /dev/myvg/mylv 300M (where 300M is the approximate total size of LV after reduction)
Now reduce the size by using # lvreduce -L -200M /dev/myvg/mylv command
Mount the LV and run the command df-h, to verify the change in the size of LV
Moving or Migrating the LV (data) from one pv to another.
There might be a situation where the PV might be failing and it is required to be replaced, in such case, we need to migrate or move the data from such PV to the other and isolate thePV.
The Steps to migrate the PV are
Access the mount point of failing PV and check the data in it,
Verify the size of the PV by pvs command or pvdisplay command.
Unmount the file system on that PV.
Add new PV, which should be of the same size or higher than that of the replacing PV to the volume group.
Migrate the PVs contents to the new PV using following command
#pvmove Old PV New PV
Mount back the LV, access the mount point and verify the data in it.
Remove the faulty PV from Volume Group.
Remove the faulty PV from Volume Group.
s the data is moved safely, now let’s remove the faulty PV from the volume group.
logic The syntax to remove a PV from a VG is
#vgreduce vg name PV name
#vgreduce myvg /dev/sdb1
Watch video how to decrease the size of Logical Volume & how to migrate Logical volume from one PV to other PV? online, duration hours minute second in high quality that is uploaded to the channel Red hat Linux Training for beginners 07 July 2020. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 301 times and liked it 7 visitors.