The best guide is here:-
HowtoForge-LVM
This has all the basics on creating/moving/resizing/deleting physical volumes, volume groups and logical volumes. There is also a tutorial on creating a raid1 disk using LVM. one thing it forgets to mention is to install system-lvm-tools (a very handy tool for managing volumes) and also to modprobe device-mapper - you cant create logical volumes without it. (might be necessary to add to /etc/modules)
then mount it and youre away! no copy :)
then mount
the drive can the be unplugged.
HowtoForge-LVM
This has all the basics on creating/moving/resizing/deleting physical volumes, volume groups and logical volumes. There is also a tutorial on creating a raid1 disk using LVM. one thing it forgets to mention is to install system-lvm-tools (a very handy tool for managing volumes) and also to modprobe device-mapper - you cant create logical volumes without it. (might be necessary to add to /etc/modules)
sudo modprobe dm-mod
Creating a snapshot
from the logical volume you create another logical volume that is a snapshot of the first by using the -s flag. The full space seems to be reservedsudo lvcreate -s -L50G -n vmware1snap /dev/data/vmware1
Scanning for removable drive in the volume group
if all drive in the volume group aren't connected (i.e. usbdisks) then use 'vgscan' to scan the group first.sudo vgscan
sudo mount /dev/data/store /mnt/store/
Unmounting a volume group
set vg inactive, then sync.sudo vgchange -an data sudo sync
some commands
| command | description |
|---|---|
| fdisk /dev/sdb | start partitioning physical device (make partition type 8e) |
| pvcreate /dev/sdb1 | create physical volume |
| pvremove /dev/sdb1 | remove physical volume (like unmount) |
| pvmove /dev/sdb1 /dev/sdf1 | move physical volume |
| pvdisplay | diplsay physical volumes |
| vgcreate VG_NAME /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1 | create volume group |
| vgdisplay | display volume groups |
| vgrename VG_NAME NEW_VG_NAME | rename volume group |
| vgscan | scan for volume groups |
| vgextend VG_NAME /dev/sdf1 | add physical device to volume group |
| vgreduce VG_NAME /dev/sdb1 | remove physical volume from volume group |
| vgchange -an data | mark volume group active(-ay) or inactive(-an) |
| lvcreate --name LV_NAME --size 40G VG_NAME | create logical volume with name and size |
| lvcreate -s -L50G --name LV_NAME_NEW /dev/VG_NAME/LV_NAME | create snapshot logical volume with name and size |
| lvdisplay | display logical volume names |
| lvscan | scan for logical volumes |
| lvrename VG_NAME LV_NAME NEW_LV_NAME | rename logical volume |
| lvremove /dev/VG_NAME/LV_NAME | delete volume group |
| lvextend -LNEW_SIZE /dev/VG_NAME/LV_NAME | extend logical volume to NEW_SIZE (e.g.40G) |
| lvreduce -LNEW_SIZE /dev/VG_NAME/LV_NAME | reduce logical volume to NEW_SIZE (e.g.40G) |
| mkfs.ext3 /dev/VG_NAME/LV_NAME | make ext3 filesystem on logical volume |
| e2fsck -f /dev/VG_NAME/LV_NAME | check filesystem on logical volume |
| resize2fs /dev/VG_NAME/LV_NAME | resize ext2 partition (after using lvextend) |