PV and LVM resize ext4

Tait Clarridge tait at clarridge.ca
Fri Oct 16 19:37:38 UTC 2009


Hello,

I am about to buy a 60GB SSD to replace my netbook's current 160GB drive
and wanted to get some feedback whether the process I am thinking of
taking to resize the drives will work properly.

So here goes:
My volume group in this example is called: vg_taitsvolume
The logical volume (root) being resized is: lv_root
The physical volume is: /dev/sda2

Current Partition Sizes:

/boot - 200M - formatted ext3
swap - 4GB - swap
/ - 145GB - formatted ext4

There is only ~8GB in use on the / fs

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

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

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


So, will this work? Are there any steps I can take out? I haven't really
played with LVM before (at all) so I thought I would come up with my own
steps through the man pages and put it to the list to see if anyone has
either completed what I need to do, or has any tips.

I will be backing up the important files so if something goes wrong it
is not a problem, but kind of an annoyance.

Thanks,
Tait
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20091016/cb3cbd19/attachment-0001.bin 


More information about the users mailing list