Logical Volume Manager For Linux
Logical Volume Manager For Linux
A Logical Volume
Manager for Linux
by
Heinz Mauelshagen
<[email protected]>
Goals
Concept2
u allocation of VG space to LVs (logical
volumes) in units of PEs (physical extends)
u use LVs like disks/partitions/
multiple devices for filesystems etc.
u extend or reduce VGs and LVs online
u access VGs and LVs through device special
files in /dev/VolumeGroupName/*
Concept4
u handle the attributes and mapping
information in a LVM driver/module
u add calls in
“/usr/src/linux/drivers/block/ll_rw_blk.c”
to call mapping function of the LVM
driver/module
u create a command and a library layer
Storage Architecture
u VG with 2 PVs and 1 LV
VG 2 PVs LV
Heinz Mauelshagen 05/28/1998
PV Commands
u pvchange - changes attributes
u pvcreate - initializes VGDA
u pvdata - outputs VGDA for debugging
u pvdisplay - shows PV attributes
u pvmove - moves PEs between PVs
u pvscan - scans periphery for PVs
VG Commands1
u vgcfgbackup - creates a VGDA backup
u vgcfgrestore - restores a VGDA to a PV
u vgchange - changes attributes
u vgcreate - create a new VG
u vgdisplay - shows VG attributes
u vgexport - changes to “unknown”
u vgextend - extends by new PV(s)
Heinz Mauelshagen 05/28/1998
VG Commands2
u vgimport - changes to “known”
u vgmknodes - creates device dir/nodes
u vgreduce - reduces by empty PV(s)
u vgremove - removes an empty VG
u vgrename - renames an inactive VG
u vgscan - scans periphery for VG(s)
LV Commands1
u lvchange - changes attributes
u lvcreate - creates a new LV
u lvdisplay - shows LV attributes
u lvextend - extends LV in size (online!)
LVM Commands
u lvmchange - resets LVM (emergency)
u lvmdiskscan - scans periphery for
LVM usable disks
(available in 0.4 alpha)
Example1a
Create a VG “test” with 2 PVs (/dev/sd[kl]1)
and 1 LV “tlv” containing an EXT2 filesystem:
# fdisk /dev/sdk # change the partion system id to 0xFE
# fdisk /dev/sdl # “
# pvcreate /dev/sd[kl]1
pvcreate -- physical volume /dev/sdk1 successfully created
pvcreate -- physical volume /dev/sdl1 successfully created
# vgcreate test /dev/sd[kl]1
vgcreate -- INFO: using default physical extend size of 4 MB
vgcreate -- INFO: maximum logical volume size is 63.988 Gigabyte
vgcreate -- doing automatic backup of test
vgcreate -- volume group test successfully created
#
Heinz Mauelshagen 05/28/1998
Example1b
Now we have:
u VGDA on /dev/sd[kl]1
u character device special /dev/test/group
u VG backup in /etc/lvmconf/test.conf
u VG name in /etc/lvmtab
u VGDA work copy in /etc/lvmtab.d/test
u loaded VGDA in driver/module to access “test”
Example1c
# lvcreate -L 300 -n tlv test
lvcreate -- doing automatic backup of test
lvcreate -- logical volume /dev/test/tlv successfully created
# mke2fs /dev/test/tlv
mke2fs 1.10, 24-Apr-97 for EXT2 FS ....
<SNIP>
Writing superblocks and filesystem accounting information: done
# mount /dev/test/tlv /usr1
....
Example2a
Display test´s attributes normal:
# vgdisplay test
--- Volume group ---
VG Name test
VG Write Access read/write
VG Status available/extendable
VG # 1
MAX LV 31
Cur LV 1
Open LV 1
MAX LV Size 63.988 GB
MAX PV 256
Cur PV 2
Act PV 2
VG Size 6.184 GB
PE Size 4 MB
Total PE 1583
Alloc PE / Size 75 / 300 MB
Free PE / Size 1508 / 5.891 GB
Heinz Mauelshagen 05/28/1998
Example2b
Display test´s attributes verbose:
# vgdisplay -v test
<SNIP>
--- Logical volume ---
LV Name /dev/test/tlv
VG NAME test
LV Write Access read/write
LV Status available
LV # 1
# open 1
LV Size 300 MB
Current LE 75
Allocated LE 75
Allocation next free
... to be continued
Example2c
Example3b
Reduce VG test by PV /dev/sdk1:
# vgreduce test /dev/sdk1
vgreduce -- doing automatic backup of test
vgreduce -- test successfully reduced
#
Whereto
u get the LVM:
put a “send lvm_LATEST.tar.gz” in the
body of a mail to
<[email protected]>
to get an uuencoded actual release
u ask for the LVM:
<[email protected]>