PV and LVM resize ext4

Ambrogio fn050202 at interfree.it
Sat Oct 17 12:37:03 UTC 2009


Il giorno ven, 16/10/2009 alle 15.37 -0400, Tait Clarridge ha scritto:
> Hello,
> 
> Boot into a LiveCD
> 
> e2fsck -f /dev/vg_taitsvolume/lv_root
> resize2fs -p /dev/vg_taitsvolume/lv_root 30G
> lvreduce --size 30G vg_taitsvolume/lv_root --test
> lvreduce --size 30G vg_taitsvolume/lv_root
i suggest to reduce the LV to a little more than 30G, or you have to
calculate at block level the right dimension. Maybe 31GB is a good
choise to eliminate the risks of lost the last blocks in the filesystem.

> pvresize --setphysicalvolumesize 40G /dev/sda2
> 
> (I chose 40GB to keep it away from the maximum of 60GB so there are no
> issues with block sizes/sectors)
> 
> use gparted to resize /dev/sda2 to 40G
the same as before

> dd to smaller drive
> 
> use gparted to resize /dev/sda2 to maximum allowed
> 
> pvresize /dev/sda2
> lvextend /dev/vg_hornet/lv_root /dev/sda2
> e2fsck -f /dev/vg_hornet/lv_root
> resize2fs /dev/vg_hornet/lv_root

But... you can use a more simple algoritm

make the LV on the new disks
resize the old fs to feet the size of the new lv (a little less)
dd the filesystem to the new LV
resize the new fs as to feet the entire LV

Bye
 Ambrogio




More information about the fedora-list mailing list