Resizing LVM-formatted partitions
Chris Adams
cmadams at hiwaay.net
Thu Jun 24 19:44:19 UTC 2010
Once upon a time, Patrick O'Callaghan <pocallaghan at gmail.com> said:
> My main disk has two partitions:
>
> Device Boot Start End Blocks Id System
> /dev/sda1 * 1 25 200781 83 Linux
> /dev/sda2 26 20023 160633935 8e Linux LVM
>
> /dev/sda1 is /boot. /dev/sda2 contains an LVM Volume Group with 3
> logical volumes (/, /home and swap).
>
> I want to increase the size of /boot from 190MB to 500MB. If I use
> gparted, I'm afraid of screwing up the LVM partition since gparted
> doesn't understand LVM.
>
> Do I need to mess with Physical Volumes to achieve this? I find the LVM
> documentation unclear, and Palimpsest doesn't seem to address this sort
> of thing.
You have to do several things (and I don't know if any of the above
tools can handle these things):
- if all space in the volume group is allocated, you have to:
- resize one or more filesystems or swap to free up space
- shrink the appropriate logical volume to the new size of the FS/swap
- rearrange the physical extents so the now-unused PEs are at the end
of the VG (easiest thing to do is shrink whichever LV is last)
- shrink the VG
- shrink the VG partition (sda2) to the same size as the VG
- use some type of "smart" partition tool to move the sda2 partition
further out on the disk (I know the old Partition Magic could do this,
but I don't know if any free tools can)
- increase the size of sda1 (repartition and then resize the FS)
The reason you have to do all of this is that /boot is not under LVM (it
can't be today because the boot loader can't load from LVM), so you have
to make space in the partition table.
Hmm, there may be one alternative; if you can free up 500M at the end of
the volume group (going through the steps above except changing sda1),
you could create an sda3 at the end of your disk. You'd have to make
the filesystem, copy your existing /boot, change /etc/fstab, and then
re-install GRUB so it looks at sda3.
GRUB2 supports (or at least is supposed to support; I haven't used it)
booting directly from LVM, so hopefully the need for a separate /boot
will eventually go away. There is a Fedora feature page for GRUB2 at
https://fedoraproject.org/wiki/Features/Grub2, but it doesn't appear to
have been updated in almost a year.
--
Chris Adams <cmadams at hiwaay.net>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.
More information about the users
mailing list