Print Logo

LVM Support for the Linux 2.4 Kernel - Compiling and Configuring LVM




<<  <   >  >>

Now that the device mapper is all happy (see this article), let's install the LVM software. Grab the source from here. Extract, configure, compile, and install:

sv-1# tar -xzf LVM2.2.01.15.tgz
sv-1# cd LVM2.2.01.15
sv-1# ./configure --prefix=/usr
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for gawk... gawk
.
.
.
config.status: creating test/format1/Makefile
config.status: creating test/regex/Makefile
config.status: creating test/filters/Makefile
sv-1# 
sv-1# make
make -C doc
make -C include
make[1]: Entering directory `/usr/src/LVM2.2.01.15/include'
find . -maxdepth 1 -type l -exec rm -f \{\} \;
for i in `cat .symlinks`; do ln -s $i ; done
make[1]: Entering directory `/usr/src/LVM2.2.01.15/doc'
make[1]: Nothing to be done for `all'.
.
.
.
gcc -o lvm dumpconfig.o formats.o lvchange.o lvconvert.o lvcreate.o lvdisplay.o
lvextend.o lvmchange.o lvmcmdline.o lvmdiskscan.o lvreduce.o lvremove.o 
lvrename.o lvresize.o lvscan.o polldaemon.o pvchange.o pvcreate.o pvdisplay.o 
pvmove.o pvremove.o pvscan.o reporter.o segtypes.o toollib.o vgcfgbackup.o 
vgcfgrestore.o vgchange.o vgck.o vgcreate.o vgconvert.o vgdisplay.o vgexport.o 
vgextend.o vgimport.o vgmerge.o vgmknodes.o vgreduce.o vgremove.o vgrename.o 
vgscan.o vgsplit.o lvm.o -Wl,--export-dynamic -L../lib -L/usr/lib -llvm 
-ldevmapper -ldl  -rdynamic
make[1]: Leaving directory `/usr/src/LVM2.2.01.15/tools'
sv-1# 
sv-1# make install
make -C doc
make -C include
make[1]: Entering directory `/usr/src/LVM2.2.01.15/include'
make -C daemons install
make[1]: Entering directory `/usr/src/LVM2.2.01.15/daemons'
.
.
.
make[1]: Leaving directory `/usr/src/LVM2.2.01.15/daemons'
make[1]: Leaving directory `/usr/src/LVM2.2.01.15/man'
sv-1#

Set up the partitions as type Linux LVM using fdisk:

Hex code (type L to list codes): 8e
Changed system type of partition 4 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/hda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1        62    497983+  83  Linux
/dev/hda2            63       124    498015   82  Linux swap
/dev/hda3           125      1341   9775552+  83  Linux
/dev/hda4          1342     30401 233424450   8e  Linux LVM
Command (m for help):w
.
.
.

Run lvmdiskscan to see what disks are available:

sv-1# lvmdiskscan
/dev/hda1 [      486.31 MB] 
/dev/hda2 [      486.34 MB] 
/dev/hda3 [        9.32 GB] 
/dev/hda4 [      222.61 GB] 
0 disks
4 partitions
0 LVM physical volume whole disks
0 LVM physical volumes

Create a physical volume and volume group:

sv-1# pvcreate /dev/hda4
Physical volume "/dev/hda4" successfully created
sv-1# vgcreate volgroup /dev/hda4
Volume group "volgroup" successfully created
sv-1# vgdisplay
--- Volume group ---
VG Name               volgroup
System ID             
Format                lvm2
Metadata Areas        1
Metadata Sequence No  1
VG Access             read/write
VG Status             resizable
MAX LV                0
Cur LV                0
Open LV               0
Max PV                0
Cur PV                1
Act PV                1
VG Size               222.61 GB
PE Size               4.00 MB
Total PE              56988
Alloc PE / Size       0 / 0   
Free  PE / Size       56988 / 222.61 GB
VG UUID               qauL7L-rO53-5EBU-6jgj-49CN-xJwL-sun5C0

Create a logical volume:

 
sv-1# lvcreate -L200G -nlogicalvol volgroup
Rounding up size to full physical extent 200 GB
Logical volume "logicalvol" created

This is how the block device looks:

sv-1# ls -l /dev/volgroup/logicalvol
lrwxrwxrwx    1 root     root           31 Jun 24 17:56 
/dev/volgroup/logicalvol -> /dev/mapper/volgroup-logicalvol
sv-1# 





This article comes from NetAdminTools:
http://www.netadmintools.com/

The URL for this story is:
http://www.netadmintools.com/art552.html

Copyright 1997-2009 NetAdminTools.com. Read our Terms of Use.