Confusion over LVM

AJ Mitchelson aj.mitchelson at btconnect.com
Mon Jan 15 22:39:59 UTC 2007


On Mon, 2007-01-15 at 19:09 +0100, Remi Collet wrote:
> Andrew Wood a écrit :
> > Dear all,
> > 
> > I'm using FC6. I  have a 8 gbyte disk on my pc, and I've justed added
> > another. Easy enough, ensuring the jumpers for master slave are set, etc.
> > 
> > I am a bit confused about the LVM. I used this, via the graphical front
> > end to add the new physical volume. 
> 
> You have extend the "Volume Group"
> 
> > 
> > I must have missed something, or do I have unfounded expectations of how
> > LVM works (i.e. seemlessly)?
> 
> I think you need to extent the "Logical Volume".
> Think it's not possible with graphical tools (require to umount the
> filesystem) with current version...
> 
> You should
> 1/ extent the Logical Volume (lvextent)
> 2/ extent the filesystem (resize2fs)
> 
> Remi
> 

LVM is a very cool and powerful piece of kit ... allowing the addition
(and removal) of storage with relative ease (Easy for me to say I've
been messing around with this stuff for over 10 years).

Anyway what you need to do is initialise the the new hard drive before
you can extend the volume group onto it (Im working on the assumption
here that you've not partioned the disk and what to use the whole drive
in the volume group)

# pvcreate /dev/hdX (where hdX is the new drive)

e.g pvcreate /dev/hdb

(Have a look at the man page for pvcreate as well)

Once the above command has completed you can bring that disk into your
existing volume group

# vgextend <Volume Group Name> /dev/hdX

e.g. vgextend VolGroup00 /dev/hdb

(Have a look at the man page for vgextend as well)

Where <Volume Group Name> is your existing volume group and /dev/hdX is
the same as you used in the pvcreate command

Once the above has completed successfully you can then extend the
logical volume that holds the file system you're filling up

# lvextend -L +NN[mg] /dev/VGName/LVName PhysicalVolume

e.g. lvextend -L +10g /dev/VolGroup00/LogVol00 /dev/hdb

(Have a look at the man page for vgextend as well)

Where +NN is the amount of space you want to ADD and [mg] is either
megabytes or gigabytes (it will do kilobytes and terabytes as well if
need be) and VGName is the volume group you used in the vgextend step
and LVName is the logical volume name and PhysicalVolume is the hard
drive you used in the pvcreate step.

Once the above is complete you can then resize your filesystem be using
the correct utility for the type of filesystem you're using.

All of the above (and potentially the file system resize) can be done
while your machine is up and running as well.

I'd read up about LVM and just double check the syntax (I am doing this
from memory and it is late here)

HTH

AJ





More information about the fedora-list mailing list