LVM

The aim of this page is to summarize the LVM relevant parts.

?TableOfContents

Prerequisites

Installed and running XEN Dom0. (with NAT)

In the test a Debian sid netinstall was used.

Preparations

test:~# modprobe dm-mod
test:~# lsmod|grep dm
dm_snapshot            15552  0
dm_mirror              19152  0
dm_mod                 50232  2 dm_snapshot,dm_mirror

(2) Install Packages

aptitude install lvm2
=>  lvm-common lvm2

(3) Adjust Drive Range

vim /etc/lvm/lvm.conf
 
    # By default we accept every block device
    # filter = [ "a/.*/" ]
    filter = [ "a|/dev/sda4|", "r/.*/" ]

(4) Make sure we have no pre-installed drives

vgscan
  Reading all physical volumes.  This may take a while...
  No volume groups found
vgchange -a y
  No volume groups found

(5) Create a Volume

pvcreate /dev/sda4
  Physical volume "/dev/sda4" successfully created

(6) Create Volume Group

vgcreate vg /dev/sda4
  Volume group "vg" successfully created
(not done: vgextend vg /dev/sdb4)

(7) Create virtual Machine

xen-create-image --hostname buildsid --ip 10.0.2.40 --gateway 10.0.2.40

make LVM snapshot

lvcreate -L 2G --snapshot -n buildsid-disk-ss /dev/vg/buildsid-disk

restore LVM snapshot time

The aim of this section is to measure the time

(1) Start virtual machine

(2) Log into machine

(3) Make some changes

buildsid:~# dd bs=1024 count=100000 if=/dev/urandom of=test.img
100000+0 records in
100000+0 records out
102400000 bytes (102 MB) copied, 25.68 s, 4.0 MB/s

(4) This makes some changes to the snapshot:

  lvdisplay /dev/vg/buildsid-disk-ss
  [...]
  LV Size                10,00 GB
  Current LE             2560
  COW-table size         2,00 GB
  COW-table LE           512
  Allocated to snapshot  4,86%
  Snapshot chunk size    8,00 KB
  [...]

(5) Shut down the machine

(6) An now the test:

time lvremove -f /dev/vg/buildsid-disk-ss; time lvcreate -L 2G --snapshot -n buildsid-disk-ss /dev/vg/buildsid-disk

(7) The result is:

  Logical volume "buildsid-disk-ss" successfully removed

real    0m0.088s
user    0m0.000s
sys     0m0.036s
  Logical volume "buildsid-disk-ss" created

real    0m0.225s
user    0m0.000s
sys     0m0.048s

(8) A second run on an unchanged snapshot:

  Logical volume "buildsid-disk-ss" successfully removed

real    0m0.067s
user    0m0.000s
sys     0m0.032s
  Logical volume "buildsid-disk-ss" created

real    0m0.170s
user    0m0.000s
sys     0m0.052s

Subjective observation: Sometimes it can take up to 3 seconds.

(9) Results:

remove

create

total time

Debian Sit 10GB/2GB

0.088s

0.225s

0.243s

turnaround time

The trunaround time is the time from t0 (shutting down machine A) to tn (machine B is up). The following stages can be forseen:

Time

Event

t0

trigger shutdown

t1

shutting down machine A

t2

machine is down

t3

start delete snapshot

t4

end delete snapshot

t5

start create snapshot

t6

end create snapshot

t7

start booting machine B

t8

end of booting machine B

t9

sending signal from B

Preparations:

(1) boot the machine

(2) make it is up and running

(3) Copy a ssh key for a user on that

The following script measures the time:

time turnaround.pl

The "turnaround.pl" script do work

TODO