LVM on XEN (dom0)

From Wiki

Jump to: navigation, search


LVM (Linux Volume Manager) is installed on the Free/Unallocated space

LVM allows for great flexibility when allocating Hard disk partitions. The reason partitions are used is because: of seperate xen host servers, and for providing for a more stable server: if /var/tmp is filled up - the server can still function, as other partitions are unaffected.

  • Check if there is partitions available.
  • If a partition is made via cfdisk - a reboot maybe required for udev to pick it up.
  • The commands listed below should be self-explainatory.
apt-get install lvm2
pvcreate /dev/sda3
pvcreate /dev/sdb2
vgcreate main-vol /dev/sda3 /dev/sdb2

lvcreate -n zachome --size 50g main-vol
lvcreate -n zachomeswp --size 1g main-vol

mkfs.ext3 /dev/main-vol/zachome
mkswap /dev/main-vol/zachomeswp 

resize2fs /dev/main-vol/zachome 40000
lvreduce -L-10g /dev/main-vol/zachome   #subtract 10Gb from current size!



Increase the Size of an LVM Partition

//umount the partition or poweroff the domU server.
//the commands below should be available on the dom0 or main server.
lvextend -L+10G /dev/main-vol2/twister   //extend the LinuxVolume. Add 10 gigabytes to the present size.
e2fsck -f /dev/main-vol2/twister         //Run a (forced) check on the filesystem
resize2fs /dev/main-vol2/twister       //resize the filesystem

Increase size of an LVM Swap Partition

swapoff -v /dev/VolGroup00/LogVol01
lvm lvresize /dev/VolGroup00/LogVol01 -L +256M
mkswap /dev/VolGroup00/LogVol01
swapon /dev/VolGroup00/LogVol01

Shrink Size of a LVM Partition

e2fsck -f /dev/vg0/vm07-root
resize2fs -p /dev/vg0/vm07-root 10G
lvresize -L 11G /dev/vg0/vm07-root
e2fsck -f /dev/vg0/vm07-root
resize2fs -p /dev/vg0/vm07-root

Main One =

Personal tools