Logical Volume Manager

From LinuxNewbie

Quoted from mythtv HOWTO:

LVM greatly increases the flexibility you have in managing your storage than traditional physical partitions. This section will provide some brief notes on how to use LVM to create storage space for your video files and how to add additional disk space in the future. There's lots more that can be done with LVM, so check the LVM HOWTO http://tldp.org/HOWTO/LVM-HOWTO/ document for details.

If you don't understand how to partition a drive, or how to change the partition type you should stop and look at documentation on how to perform these steps.

BIG FAT WARNING: Using an incorrect parameter can make your files inaccessible, prevent your computer from booting, etc. Be careful!

Make sure your kernel configuration includes LVM support or that it's available as a module. Today, most vendors include this by default. You'll also want to ensure that you have a copy of the LVM utilities; check your distribution, or get the latest versions from http://www.sistina.com/products_lvm.htm and build them manually.

Check that the vgscan program is being run at some point during your boot sequence - most distributions do this by default. Look for a message during boot up that looks like this: vgscan -- reading all physical volumes (this may take a while...)

LVM uses a few concepts you should be familiar with before starting.

   * PV (Physical Volume). The actual partition on the hard drive.
   * VG (Volume Group). The aggregation of all the PVs make a VG.
   * LV (Logical Volume). Subdivision of the pool of space available in the VG into individual chunks, like /usr, /var/video, etc.


The following example assumes that you want to create a LVM partition from a chunk of space in /dev/hda5, using a reiserfs filesystem and mounted on /var/video. You later decide to extend this filesystem by adding a new disk: /dev/hdb.

You need to create at least one LVM partition for a physical volume. Use fdisk or your favorite partition editor to set the type to LVM (0x8e). If you're using an entire disk, create one big partition rather than using the device itself. e.g. use /dev/hdb1 not /dev/hdb.

In the following example, you have a 15GB disk. The first 6GB are set as your boot partition. /dev/hda2 was added as an extended partition, and within that partition you created the /dev/hda5 linux (ext2) partition.

# fdisk /dev/hda

The number of cylinders for this disk is set to 1823.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/hda: 15.0 GB, 15000330240 bytes
255 heads, 63 sectors/track, 1823 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1       764   6136798+  83  Linux
/dev/hda2           765      1823   8506417+   5  Extended
/dev/hda5           765      1823   8506417   83  Linux

Command (m for help): t
Partition number (1-6): 5
Hex code (type L to list codes): 8e

Command (m for help): p

Disk /dev/hda: 15.0 GB, 15000330240 bytes
255 heads, 63 sectors/track, 1823 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1   *         1       764   6136798+  83  Linux
/dev/hda2           765      1823   8506417+   5  Extended
/dev/hda5           765      1823   8506417   8e  Linux LVM

Command (m for help): w

#


Create the LVM physical volume from the partitions (repeat if you have multiple partitions to use):

# pvcreate /dev/hda5


Create a LVM volume group out of this physical volume called "VGforMyth" that is allocated in chunks that are a multiple of 64MB

# vgcreate VGforMyth -s 64m /dev/hda5


Create a logical volume of 5GB called "video" and then create the reiserfs filesystem and mount it:

# lvcreate --name video --size 5G VGforMyth
# mkreiserfs /dev/VGforMyth/video
# mount /dev/VGforMyth/video /var/video


Now create a 3GB volume for mythmusic files if you like:

# lvcreate --name music --size 3G VGforMyth
# mkreiserfs /dev/VGforMyth/music
# mount /dev/VGforMyth/music /var/music


Display the volume group status: # vgdisplay -v

Now, lets suppose you want to add a 60GB hard disk to the system as hdb and allocate 50GB of it to video storage.

First, create a single partition /dev/hdb1 covering the whole disk and make it type 0x8e using your partition editor.

# fdisk /dev/hdb

.... create partition, set type, save and reboot if it says you have to

Create the new LVM physical volume:

# pvcreate /dev/hdb1


Add the new physical volume to the volume group:

# vgextend VGforMyth /dev/hdb1


NOTE: You may get errors at this point stating that there are no physical volumes available for adding to the LV, even though you know for a fact that there are. You may need to specify the physical volume in the /dev/ide/host/bus/target/lun/etc format. Once you've completed one of the following two procedures, use df to check that you've got more space. ReiserFS

Make the logical volume used for video bigger:

# lvextend --size +50G /dev/VGforMyth/video


Unmount, resize and remount the filesystem. Technically, you don't need to unmount and remount the ReiserFS.

# umount /var/video
# resize_reiserfs /dev/VGforMyth/video
# mount /dev/VGforMyth/video /var/video


ext2 or ext3

LVM comes with a program called e2fsadm.

Unmount, resize and remount the filesystem. The filesystem must be unmounted during this procedure.

# umount /var/video
# e2fsadm --size +50G /dev/VGforMyth/video
# mount /dev/VGforMyth/video /var/video

mature lesbians tickling feet milf hunter videos milf porn milf seekers milf sex milf rider footjobs milf seekers foot milf sex facesitting mature galleries milf hunters mature pussy footjobs mature ladies lesbian licking milf rider milf milfhunter foot fetish older mature lesbian stories mature ladies mature babes milf hunter movies sexy feet milf rider legs spread mature sluts spread legs milfs barefoot mature women long legs mature lesbians milf lessons milfs milfhunter milf hunting lesbian sisters milf cruiser lesbian stories mature women black milf milf hunting lesbian mature tits disney lesbian toons milf hunter legs spread milfs black milf black milf lesbian pussy milf riders lesbian teen movies milf hunters feet mature sluts lesbian movie milf older milf hunters milf cruiser trample milfhunter footjob milf sex sexy legs milf seeker lesbians fucking milf hunter movies lesbian mature pussy hardcore lesbian sex mature ladies footjob milf hunter lesbian kiss mature lesbians girls spreading legs gallery mature sex bare feet mature tits foot worship milf hunting mature post mature her first lesbian sex milfseeker nice legs milf older hardcore lesbian sex mature galleries black milf milf hunting naked lesbians milf seekers big foot milfhunter.com black milf black milf lesbian free mature porn foot fetish mature galleries older mature mature galleries smother milfhunter.com mature ladies milf hunting lesbo mature moms milfseeker older mature teen lesbians mature sex long legs

ramones rolling stones westlife westlife jennifer lopez jay-z tlc pantera abba macbeth christina aguilera extreme bush shakira craig david underoath shakira death frank sinatra seether disturbed radiohead tlc abs abba aaron carter eagles billy idol westlife aphrodite whitney houston pantera planets franz ferdinand tlc death rage against the machine christina aguilera nude planets john mayer tom petty underworld pantera dashboard confessional radiohead frank sinatra sean paul vanilla ice bohemian rhapsody death tom petty dare jennifer lopez naked nelly craig david extreme jennifer lopez nude vixen shakira ayumi hamasaki mobb deep kate bush mariah carey ayumi hamasaki missy elliott breaking benjamin underworld dare jay-z the strokes travis barker dixie chicks chevelle vixen amy grant jojo kate bush planets alicia keys tina turner chevelle alicia keys billy idol the mars volta mariah carey bloodhound gang aphrodite atreyu alicia keys breaking benjamin dj tiesto vixen grateful dead macbeth prince jennifer lopez sedu hair lynyrd skynyrd eagles the rasmus modest mouse macbeth maroon 5 benny benassi underworld dark angel barenaked ladies alicia keys aphrodite dj tiesto mobb deep good charlotte zodiac sara evans sirius chevelle joss stone vixen bloodhound gang jay-z black eyed peas my humps