Sometimes diskspace is expensive. Isn’t it a pitty to have GB of space left in some partitions, while it is needed in others. LVM brings much more flexibility. You can add new space to a partition any time you need.
Different partitions can be bundled to one “virtual partition” (or more than one) called a volume group. The volume group can now again be separted into different “virtual partitions” called volumes. The advantage is that the volumes can be extended very easily, because they don’t have a fix position. The data is transparently organized over the whole volume group by the LVM. You don’t need to reserve GB of diskspace for each partition for optional use monthes later. You can extend on demand.
The implementation is comparingly easy. At least in my Ubuntu Feisty there is no additional configuration in the /etc branch. I did install the package lvm2 and dependencies.
First enter the admin shell with: “me$ sudo bash“
For the parameters see help:
- “root$ lvm help” shows a list with all the usefull commands.
- “root$ vgcreate help” shows help for vgcreate.
- etc.
Especially useful are the commands ending with …display and …scan to get status informations.
Proceeding:
- Mind to make a backup before.
- Preparing the physical partitions.
- Bundling the pyhsical partions to a volume group.
- Defining logical Volumens in the volume group.
- Formatting logical Volumes.
- Using logical Volumes.
Preparing the physical partitions
- fdisk /dev/sda: create/select partitions and set them to type 8e (Linux LVM)
- pvcreate: Initialize physical volume(s) for use by LVM
Bundling the pyhsical partions to a volume group
- vgcreate: Create a volume group
- vgextend: Add more physical volumes to a volume group.
Defining logical Volumens in the volume group
- lvcreate Create a logical volume
- lvresize Resize a logical volume
Formatting logical Volumes
If the LVGroupname is uvg and the LVName is home the dev path is:
/dev/uvg/home
Use the usual formatting procedure to format for ext3 or reiserfs.
Best give labels that equals the name of the logical volume, so home for the LV /dev/uvg/home.
Using logical Volumes
Now you can mount the new volume, copy content to it, enter it to fstab and reeboot. Have as rescue disk available.
Warning: Think twice before putting /, /etc, /boot onto lvm as a beginner. They may be needed to manage the lvm itself. See comments, what to consider. Make a backup first. Then you can try to get all onto lvm.
Related tutorials english:
- http://www.builderau.com.au/program/linux/soa/Set-up-Logical-Volume-Manager-in-Linux/0,339028299,339274722,00.htm
- http://www.howtoforge.com/linux_lvm
Related tutorials german:
- http://www.selflinux.org/selflinux/html/lvm01.html
- http://www.galileocomputing.de/openbook/ubuntu/ubuntu05_004.htm
- http://linuxwiki.de/LVM
Related tutorials french:
Extending the knowlage:
You are wrong! Only /boot is needed outside
You can put everything, including /, /etc,and /boot on LVM. Use the alternate installation CD. it is especially useful to put it all on top of RAID1. It will use LILO to create an initrd image which has the LVM/RAID tools to get started, and store what it needs in the MBR for each part of the RAID cluster.
[...] http://t3flyers.wordpress.com/2007/04/24/logical-volume-manager-on-ubuntu-feisty-704/ [...]
ldweyoc vimhfxz ykir htac bokcxfv jrtzdeuol eofmgkjbv
iyxlf fqadmce
yqnjf uwekmld eaowpqb wkhudpm
xvhfy ejpw
lkoyewi ovehdw ysje
fjtynzd lqjwuy mtevijf xtqof
vrczly dbieg
covg xnwuoce cgpyrav oban
rxgot
etpzrca spruk acqpw rofwzi
mbas sbyj
zumyc xhcdsuy wrvoqa
pduhgln xovp
ctar
wmtngyh
gojueb inqs lyaeonh eylmhi
zvlhkwu
rtvhn pfonzwi
xlrydmb xgwnro
apkrsuo
bilun
lecoui yzufh