WARNING: It’s really dangerous, so backup your data before attempting this. Please don’t blame me, if you destory your system. You are responsible for your own actions!
Check the size of lv_root before starting this process:
df -h
Boot from CentOS 6 DVD (or any other Linux distro that you are using) and select “rescue” option: Select the Skip, so that it will not mount the filesystem: Run these commands:
pvscan
vgscan
vgchange -a y
lvscan
Display the lv_root:
lvdisplay /dev/vg_centos6/lv_root
fsck on the large root filesystem (lv_root):
fsck.ext4 /dev/vg_centos6/lv_root
Run e2fsck with -f (force) option:
e2fsck -f /dev/vg_centos6/lv_root
Issue the resize2fs command to reduce the filesystem (Important: The size here is the actual/total size of the lv_root after reduce, not the size that we want to decrease):
resize2fs -p /dev/vg_centos6/lv_root 65G
Now, issue the lvreduce command to reduce the logical volume size:
lvreduce -L 65G /dev/vg_centos6/lv_root
Run lvdisplay command to confirm the change:
lvdisplay /dev/vg_centos6/lv_root
Reboot the system and login. Remove the disk (in my case it is, /dev/sdb1) from volume group and then from physical volume:
sudo vgreduce vg_centos6 /dev/sdb1
sudo pvremove /dev/sdb1
Check the size of lv_root after all these changes:
df -h
Success!
Hope this will help you!
No comments:
Post a Comment