What is LVM ?

Note: This may answer the question, why editing the /etc config files does nothing.

If you don't have a backup, you can re-create the equivalent of an LVM2 backup file by examining the LVM2 header on the disk and editing out the binary stuff. LVM2 typically keeps copies of the metadata configuration at the beginning of the disk, in the first 255 sectors following the partition table in sector 1 of the disk. See /etc/lvm/lvm.conf and man lvm.conf for more details. Because each disk sector is typically 512 bytes, reading this area will yield a 128KB file. LVM2 may have stored several different text representations of the LVM2 configuration stored on the partition itself in the first 128KB. Extract these to an ordinary file as follows, then edit the file:
 dd if=/dev/md2 bs=512 count=255 skip=1 of=/tmp/md2-raw-start
 vi /tmp/md2-raw-start

full text: http://www.linuxjournal.com/article/8874

LVM on the compute nodes

LVM setup script

This is the lvm (as of friday, may 25th 2007) script used to set up LVM on a compute node
 #!/bin/bash
 lvscan | sed s/ACTIVE/\ / | sed s/inherit/\ / | sed s/^\ *\'/\ / | sed s/\'.*$/\ / | lvremove
 
 export USE_DEVICE=/dev/sda4
 export USE_NAME=masterlvm
 
 echo create lvm device... $USE_DEVICE
 pvcreate -y -ff $USE_DEVICE
 echo create lvm group... $USE_NAME
 vgcreate  $USE_NAME $USE_DEVICE
 lvcreate -L 2G -n home $USE_NAME
 lvcreate -L 8G -n usr $USE_NAME
 lvcreate -L 8G -n var $USE_NAME
 lvcreate -L 1G -n tmp $USE_NAME
 
 echo done...
 lvscan
 
 mkfs.ext3 /dev/sda2
 mkfs.ext3 /dev/sda3
 mkfs.ext3 /dev/$USE_NAME/home
 mkfs.ext3 /dev/$USE_NAME/usr
 mkfs.ext3 /dev/$USE_NAME/var
 mkfs.ext3 /dev/$USE_NAME/tmp

a target directory is created. The system will be installed into that dir an it's subdirs, which are mounted to the futur dirs boot,home,usr,var,tmp.

 /bin/mkdir /tmp/target
 /bin/mount /dev/sda3 /tmp/target
 
 /bin/mkdir /tmp/target/boot
 /bin/mkdir /tmp/target/home
 /bin/mkdir /tmp/target/usr
 /bin/mkdir /tmp/target/var
 /bin/mkdir /tmp/target/tmp
 
 /bin/mount /dev/sda2 /tmp/target/boot
 /bin/mount /dev/mapper/masterlvm-home /tmp/target/home
 /bin/mount /dev/mapper/masterlvm-usr /tmp/target/usr
 /bin/mount /dev/mapper/masterlvm-var /tmp/target/var
 /bin/mount /dev/mapper/masterlvm-tmp /tmp/target/tmp
 
 mount

DocumentationForm edit

Title How to recreate a backup by using LVM
Description This page describes how you can re-create the equivalent of an LVM2 backup file by examining the LVM2 header on the disk and editing out the binary stuff.
Tags LVM backup
Category Admin
This topic: ATLAS > WebHome > GeneralDocumentation > Lvm
Topic revision: 10 Feb 2012, ArthurVarkentin
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback