In my opinion, there are two advantages of using LVM: it is convenient to dynamically expand/shrink partition size; it is not limited by the number of partitions.
There is a very good LVM usage Introduction At the howtoforge Website: http://www.howtoforge.com/linux_lvm
Here we record our operation process:
1. Create physical volumn using pvcreate
[Root @ jcwkyl ~] # Fdisk-l
Disk/dev/SDA: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 Cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Device boot
Start
End blocks ID system
/Dev/sda1
*
1
13 104391 83 Linux
/Dev/sda2
14 6540
52428127 + 83 Linux
/Dev/sda3
6541 13067
52428127 + 83 Linux
/Dev/sda4
13068 38913
207607995 8e Linux LVM
[Root @ jcwkyl ~] # Pvcreate/dev/sda4
Physical volume "/dev/sda4" successfully created
2. Use vgcreate to create a volumn group
[Root @ jcwkyl ~] # Vgcreate xen_space/dev/sda4
Volume group "xen_space" successfully created
3. Use lvcreate to create a logical volumn
[Root @ jcwkyl ~] # Lvcreate-n image_pool-L 100G xen_space
Logical volume "image_pool" created
[Root @ jcwkyl ~] # Lvcreate-n swap-L 5G xen_space
Logical volume "swap" created
4. Create a file system on the newly created logical volumn and mount and use it
[Root @ jcwkyl ~] # Mkfs. ext3/dev/xen_space/image_pool
Mke2fs 1.39 (29-may-2006)
Filesystem label =
OS type: Linux
Block size = 4096 (log = 2)
Fragment size = 4096 (log = 2)
13107200 inodes, 26214400 blocks
1310720 blocks (5.00%) reserved for the super user
First data block = 0
Maximum filesystem blocks = 0
800 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768,983 04, 163840,229 376, 294912,819 200, 884736,160 5632, 2654208,
4096000,796 2624, 11239424,204 23887872
Writing
Inode tables:
Done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs-c or-I to override.
[Root @ jcwkyl ~] # Mount/dev/xen_space/image_pool/vm
Add the following record to/etc/fstab so that the corresponding partition is automatically mounted at each boot:
/Dev/xen_space/image_pool
/Vm
Ext3
Defaults 0 0