shrink physical volume

General support questions
Post Reply
zio_mangrovia
Posts: 40
Joined: 2015/06/11 08:34:13

shrink physical volume

Post by zio_mangrovia » 2017/03/21 17:08:58

In VMware ESXi 5.5 I have Centos 6.8 64 bit with hard disk of 60 GB which is partitioned into two partitions:
/dev/sda1 partition, 512 MB, type: Linux 83 (boot partition)
/dev/sda2 partition, 60 GB, type: LVM 8e

/dev/mapper/vg_centos is the volume group which has /dev/sda2 physical volume
I have has 2 logical volume: lv_swap and lv_root.

How can I shrink physical hard disk (e.g. from 60 GB to 45 GB) without to lost data, particularly LVM partition /dev/sda2?
I tried by Gparted, before disactivating volume, but nothing!
I can power off server if it's necessary of course.

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: shrink physical volume

Post by aks » 2017/03/21 17:36:44

The order to do it in is:
1) Shrink the filesystem (depends on the FS used).
2) Reduce the volume (lvreduce)
3) Reduce the VolumeGroup (vgreduce)
4) Resize the physical (pvresize)
Oh and at 0) Backup everything.

Post Reply