PV and LVM resize ext4

Richard Shaw hobbes1069 at gmail.com
Fri Oct 16 21:25:06 UTC 2009


On Fri, Oct 16, 2009 at 2:37 PM, Tait Clarridge <tait at clarridge.ca> wrote:
> 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

Everything looks good to this point as far as I can tell (from memory)

>
> (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

These steps should not be necessary as part of the advantage if LVM[1]
is moving the LV's around.
>
> 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

Richard

[1] http://tldp.org/HOWTO/LVM-HOWTO/recipemovevgtonewsys.html




More information about the fedora-list mailing list