LVM
From SystemImager
Contents |
HOWTO: using LVM with SystemImager
Overview
LVM is a method to manage block devices that extends the conventional partitioning scheme. With LVM you can concatenate, stripe (RAID0) or combine partitions into larger virtual block devices, that can be resized or moved possibly while they are being used.
LVM is suppported natively into the Linux kernel.
LVM does not support RAID1 or RAID5 mirroring; if you need redundancy of data see SoftwareRaid.
LVM support in SystemImager
SystemImager is able to manage LVM from version >=3.5.2. This means that you can install a golden client with your custom volume groups and logical volumes and SystemImager is able to automatically clone your partitioning schema and LVM configuration and to export this configuration to any number of target clients.
Simply run the command si_prepareclient (see man si_prepareclient for more details) in the golden client to clone the configuration of the disks.
The LVM configuration will be stored into the file /etc/autoinstallscript.conf in the golden client's filesystem. When you run si_getimage the file is automatically propagated on the image server, under the chrootable file system of the image (/var/lib/systemimager/<IMAGENAME>/etc/systemimager/autoinstallscript.conf).
You can do future customizations simply editing this file. The file is in XML and the syntax is defined in the opportune manpage (see man autoinstallscript.conf). Every time you do some changes to this file remember to run si_mkautoinstallscript on the image server.
When you manually edit your LVM configuration remember that:
- a partition can be used with LVM only if you enable the flag lvm;
- to assign a partition in a volume group use the attribute lvm_group="<lvm_vg_name>";
- define all the other LVM stuff inside the <lvm></lvm> section.
Following an autoinstallscript.conf example using a generic LVM configuration:
<config>
<disk dev="/dev/hda" label_type="msdos" unit_of_measurement="MB">
<part num="1" size="101" p_type="primary" p_name="-" flags="boot" />
<part num="2" size="134" p_type="primary" p_name="-" flags="-" />
<part num="3" size="*" p_type="primary" p_name="-" flags="lvm" lvm_group="systemvg" />
</disk>
<disk dev="/dev/hdc" label_type="msdos" unit_of_measurement="MB">
<part num="1" size="101" p_type="primary" p_name="-" flags="-" />
<part num="2" size="*" p_type="primary" p_name="-" flags="lvm" lvm_group="systemvg" />
</disk>
<lvm>
<lvm_group name="systemvg" max_log_vols="0" max_phys_vols="0" phys_exent_size="4096K">
<lv name="optlv" size="2048M" />
<lv name="rootlv" size="2048M" />
<lv name="tmplv" size="2048M" />
<lv name="usrlv" size="4096K" />
<lv name="varlv" size="2048K" />
</lvm_group>
</lvm>
<fsinfo line="10" real_dev="/dev/systemvg/rootlv" mp="/" fs="reiserfs" options="acl,user_xattr" dump="1" pass="1" />
<fsinfo line="20" real_dev="/dev/hda1" mp="/boot" fs="reiserfs" options="acl,user_xattr" dump="1" pass="2" />
<fsinfo line="30" real_dev="/dev/systemvg/optlv" mp="/opt" fs="reiserfs" options="acl,user_xattr" dump="1" pass="2" />
<fsinfo line="40" real_dev="/dev/systemvg/tmplv" mp="/tmp" fs="ext2" options="acl,user_xattr" dump="1" pass="2" />
<fsinfo line="50" real_dev="/dev/systemvg/usrlv" mp="/usr" fs="reiserfs" options="acl,user_xattr" dump="1" pass="2" />
<fsinfo line="60" real_dev="/dev/systemvg/varlv" mp="/var" fs="reiserfs" options="acl,user_xattr" dump="1" pass="2" />
<fsinfo line="70" real_dev="/dev/hda2" mp="swap" fs="swap" options="defaults" dump="0" pass="0" />
<fsinfo line="80" real_dev="/dev/hdc1" mp="swap" fs="swap" options="defaults" dump="0" pass="0" />
<fsinfo line="90" real_dev="proc" mp="/proc" fs="proc" options="defaults" dump="0" pass="0" />
<fsinfo line="100" real_dev="sysfs" mp="/sys" fs="sysfs" options="noauto" dump="0" pass="0" />
<fsinfo line="110" real_dev="devpts" mp="/dev/pts" fs="devpts" options="mode=0620,gid=5" dump="0" pass="0" />
<fsinfo line="120" real_dev="/dev/dvd" mp="/media/dvd" fs="subfs" options="noauto,fs=cdfss,ro,procuid,nosuid,nodev,exec,iocharset=utf8" dump="0" pass="0" format="no" />
<fsinfo line="130" real_dev="/dev/cdrecorder" mp="/media/cdrecorder" fs="subfs" options="noauto,fs=cdfss,ro,procuid,nosuid,nodev,exec,iocharset=utf8" dump="0" pass="0" format="no" />
<fsinfo line="140" real_dev="/dev/fd0" mp="/media/floppy" fs="subfs" options="noauto,fs=floppyfss,procuid,nodev,nosuid,sync" dump="0" pass="0" />
<boel devstyle="static"/>
</config>
See also
--Righi 16:27, 29 June 2006 (CDT)
