LVM

From Noah.org
Revision as of 18:30, 6 March 2008 by Root (talk | contribs)
Jump to navigationJump to search

See also LVM Howto

You can resize ext2/ext3 filesystems while mounted.

Remember:

   a Volume Group is the equivalent of a physical device. 

It can be made up of a collection of drives. You can add or remove drives from a VolGroup. Note that this isn't strictly correct. Parts of a drive can be part of different VolGroups.

   a Logical Volume is the quivalent of a partition. 

Logical Volumes are mapped to a device in /dev. A LogVol is what you actually mount to a mount point.


  • vgdisplay -- display attributes of volume groups.

See also `vga` for a more brief display.

  • pvdisplay -- display attributes of physical volumes.

See also `pvs` for a more brief display. Use this to figure out how much physical space is available.

  • vgscan -- to identify your volume groups by name.

example: VolGroup00

  • lvscan -- to identify your logical volumes by name.

example: LogVol00 LogVol01 LogVol02 LogVol03 LogVol04

  • pvcreate -- Add a partition to a physical volume.
  • vgextend -- Add a partition to a volume_group.
  • df -- to see which device names are mapped to which Logical Volumes.

The device name is what mount/umount/ext2online care about.

  • ext2online -- this resizes an online ext2 or ext3 filesystem.

You do not have to umount it. If you don't have ext2online then your Linux is old. You will have to umount the device first; use ext2resize; then mount the device again.

extend an ext3 partition to be 100GB

Say that you have some unallocated space that you want to give to /var. Use `vgs` too see how much unallocated space is free. If not enough space is free then you will have to shrink another logical volume or add more physical disk. Say that /var is mounted on device /dev/mapper/VolGroup00-LogVol04. Use the following commands:

lvextend -L100GB /dev/VolGroup00/LogVol04
ext2online /dev/mapper/VolGroup00-LogVol04

Device Manager

What is this dm or mod-dm.ko thing? This is the very heart of LVM. See `man dmsetup` or visit http://sources.redhat.com/dm/ . Sometimes while using partimage you might get this error:

/dev/dm inode doesn't exists.
Partimage can create it for you.
You can also use the manual mknod
command. Do you want this inode
to be created for you now ?

The solution is to create the /dev/dm node:

# mknod -m 644 /dev/dm b 240 0