From: Chris Davies on
Aragorn <aragorn(a)chatfactory.invalid> wrote:
> I'm afraid that you cannot shrink a logical volume once it has been
> created. Logical volumes can be expanded, but not shrunk. In addition
> to that, the type of the filesystem used on any partition or logical
> volume also may have limitations to what is possible in terms of
> resizing.

It is quite possible to change the size of an LV. One has to be
careful, though, that the contents are in a state that can cope with the
resize. This is the sort of approach I would take if I were to need to
shrink a partition and its filesystem down to 100G:

FS=/dev/mapper/vg/filesystem # Helps reduce typos
umount "$FS" # Required when shrinking
fsck "$FS" # Always a good idea before resizing
resize2fs "$FS" 90G # Smaller than required (ext2/ext3)
lvresize -L 100G "$FS" # Resize the partition
resize2fs "$FS" # Let the filesystem fill the partition
mount "$FS" # Cross your fingers...

Chris
From: David Brown on
Pascal Hambourg wrote:
> Hello,
>
> unruh a �crit :
>> You cannot alter a partition that is mounted.
>
> Some filesystems such as ext3 or XFS allow online growing. Granted, I do
> not know any which allows online shrinking (but it does not mean that it
> does not exist).
>

There are a number that allow online growth, but the only ordinary file
system I know of that allows online shrinking is btrfs (there are
clustering file systems that can be re-sized online by adding and
removing drives).

>> Since your one partition
>> must be mounted to run the OS, you cannot change it.
>> Boot from a CD and change it from there.
>
> Or create an initramfs containing the resizing tools and a shell and
> shrink the filesystem and volume from there.
From: Keith Keller on
On 2010-06-11, Chris Davies <chris-usenet(a)roaima.co.uk> wrote:
> Aragorn <aragorn(a)chatfactory.invalid> wrote:
>> I'm afraid that you cannot shrink a logical volume once it has been
>> created. Logical volumes can be expanded, but not shrunk. In addition
>> to that, the type of the filesystem used on any partition or logical
>> volume also may have limitations to what is possible in terms of
>> resizing.
>
> It is quite possible to change the size of an LV. One has to be
> careful, though, that the contents are in a state that can cope with the
> resize.

You're both correct: XFS, for example, can not be shrunk even if you
umount the filesystem.

> mount "$FS" # Cross your fingers...

Is the crossing of fingers required at this step? I usually just rub my
four-leaf clover. ;-)

--keith

--
kkeller-usenet(a)wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information

From: The Natural Philosopher on
Mister B wrote:
> I'm using RHEL 4.5, which has been loaded as one large root Logical
> Volume.
> I'd like to shrink the logical volume, then create some new logical
> volumes.
> How can I do that?
>
> I'm guessing I need to do it in single-user? Or did I need to boot
> from CD etc?
>
> TIA
> Mark

copy it using a boot CD and/or a second drive to somewhere else, then
reformat. and reinstall.

But one has to ask why..on a single user system,..you want separate
partitions at all.

I've always found the prices of second guessing how much data will end
up where, to be one I got wrong.


From: The Natural Philosopher on
Aragorn wrote:
> On Friday 11 June 2010 13:39 in comp.os.linux.misc, somebody identifying
> as Mister B wrote...
>
>> I'm using RHEL 4.5, which has been loaded as one large root Logical
>> Volume. I'd like to shrink the logical volume, then create some new
>> logical volumes. How can I do that?
>
> I'm afraid that you cannot shrink a logical volume once it has been
> created. Logical volumes can be expanded, but not shrunk. In addition
> to that, the type of the filesystem used on any partition or logical
> volume also may have limitations to what is possible in terms of
> resizing.
>
>> I'm guessing I need to do it in single-user? Or did I need to boot
>> from CD etc?
>
> The best course of action, in my humble opinion, would be to back up any
> important data you may have under your "/home", and I would also
> include everything under "/etc" for good measure.

and /var../www and /var/lib/...mysql etc etc.

a LOT of user data lives in /var/.. /var/mail also, sometimes.