Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] LVM2 and resizing partition



Gernot Hassenpflug wrote:
>   My first active (as opposed to looking at it and just reinstalling
> from scratch) contact with LVM2: a CentOS5 installation on a disk in a
> MacPro coexisting with the MacOSX and using rEFIt to boot from a small
> boot partition /dev/sda3 while the rest of the CentOS is on an
> LVM2-managed partition /dev/sda4.
>
>   I want to reduce the partition to make space for another one behind
> it (eventually). The partition size is 502GiB and I want to reduce it
> to about 200GiB. There are two logical volumes in one logical volume
> group: one is 6.3GiB, the other fills the rest of the space.
>
>   So I've used the following executed from a rescueCD to get the large
> logical volume down to 200GiB:
>
>   resize2fs -f /dev/VolGroup00/LogVol00 200G
>   lvm lvreduce -L200G /dev/VolGroup00/LogVol00
>
>   This seems to work, since lvscan tells me I now have about 299GiB of
> free space in the LVM partition. However, I cannot figure out how to
> get the partition itself resized.

I don't know of an easy way to fix your problem.

What you have done doesn't really help.  You have reduce the number of
physical extents allocated to the LogVol00 logical volume,  from the
500G VolGroup00 volume group, but you don't know where in the volume
group (i.e. the partition) they are allocated.

If you had used multiple partitions to make your volume group[1],  you
could have moved extents of each partition using pvmove and
repartitioned that way.

My advice would be to get another hard drive add it to the volume group,
move all extents to the new drive then create multiple smaller
partitions.  If you have enough free space on another partition  you
could also resize and use it instead of adding another drive but this
will be an very slow process.  Just found this[2] which also gives
basically the same advice.

Edward

1. which I would advise you to do in the future.
2. http://fedora64.org/Members/zcat/shrink-lvm-for-new-partition


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links