TWiki
>
LinuxSupport Web
>
XenHowTo
>
PreparingXenGuestFilesystems
(2006-11-29,
JanIven
)
(raw view)
E
dit
A
ttach
P
DF
---++ Preparing Xen guest filesystems Xen guest are using filesystems exported to them via Xen hypervisor Virtual Block Devices (VBDs). Currently there are three methods of preparing such filesystems for Xen. ---+++ File-backed VBDs This is the least-performant Xen VBD type: all disk I/O must pass in hypervisor via loop-mounted filesystem (hence the significant performance drop). However these are the easiest to implement and still suitable for no-I/O-intensive guests. In order to prepare a file-backed VBD use dd: <pre> /bin/dd if=/dev/zero of=/somefile_somewhere.img bs=1024M count=20</pre> will prepare 20GB VBD for the guest. *NOTE*: Please avoid creating sparse VBDs for use with SLC3/SLC4 guests ( the _skip_ dd option): system installer will get confused about these and most likely crash. Such prepared VBD should be then exported to guest system in its config file in following way: <pre> disk = [ 'file:/somefile_somewhere.img,sda,w' ]</pre> ---+++ Physical (Raw) device VBDs Physical device VBDs will offer much better performance than file-based but are less convenient for the management (these reside on real device / partition). In order to prepare a physical-device backed VBD use parted: <pre> # /sbin/parted /dev/sda GNU Parted 1.6.19 ... Using /dev/sda (parted) p Disk geometry for /dev/sda: 0.000-152627.835 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.031 1027.595 primary ext3 boot 2 1027.595 21030.402 primary ext3 3 21030.403 25125.095 primary linux-swap (parted) mkpart extended 25125.095 152627.835 (parted) mkpart logical 25125.095 55125.095 (parted) mkpart logical 55121.462 85121.462 (parted) p Disk geometry for /dev/sda: 0.000-152627.835 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.031 1027.595 primary ext3 boot 2 1027.595 21030.402 primary ext3 3 21030.403 25125.095 primary linux-swap 4 25125.095 152625.344 extended 5 25125.126 55121.462 logical 6 55121.493 85117.829 logical (parted) q</pre> Above illustrates an example parted session where two VBDs were created for use by Xen guests: _sda5_ (minor 5) and _sda6_ (minor 6). *NOTE*: fdisk can be used to partition your devices too, but with current Xen Domain 0 kernels it will be necessary to reboot the hypervisor as fdisk fails to notify the kernel about partition table changes. Such prepared VBD should be then exported to guest system in its config file in following way: <pre> disk = [ 'phy:sda5,sda,w' ]</pre> ---+++ LVM based VBDs LVM based VBDs offer at the same time good performance and management flexibility: because of LVM device management flexibility ---++++ resize existing root file system Unless you have set aside space for the virtual machines when installing the hypervisor, you'll need to liberate some space that is currently taken up by the hypervisor's root filesystem. In this example, we'll restrict the hypervisor to 10G ([[http://www.linuxquestions.org/questions/showthread.php?t=337823][original post]]). Reboot into rescue mode (sorry, resizing the "/" filesystem cannot be done while it is mounted, so you'll need to boot from floppy/network/USB/..) and run <pre> # lvm vgchange -a y # e2fsck -f /dev/VolGroup00/LogVol00 # resize2fs -f /dev/VolGroup00/LogVol00 10G # lvm lvreduce -L10G /dev/VolGroup00/LogVol00 </pre> This assumes that your physical volume group is called _VolGroup00_ and the logical volume for "/" is _LogVol00_ (compare with what the first lines spits out). Which seem to be the default for anaconda-generated LVs. ---++++ Create new Volume Group for the guest Create a Volume Group for the new machine (5GB in this case): <pre> # lvm lvcreate -L5G -ndomU1 VolGroup00 Logical volume "domU1" created </pre> This can be done both from the rescue system or from the running hypervisor. ---++++ Configure Xen to use the new Volume Group Export the new "device" to the guest via the config file: <pre> ... disk = [ 'phy:VolGroup00/domU1,sda,w' ] </pre> <div align="right">-- Main.JaroslawPolok - 23 Nov 2006</div>
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
WYSIWYG
|
M
ore topic actions
Topic revision: r4 - 2006-11-29
-
JanIven
Log In
LinuxSupport
LinuxSupport Web
LinuxSupport Web Home
Changes
Index
Search
Main
FIOgroup
Cern Search
TWiki Search
Google Search
LinuxSupport
All webs
Copyright &© 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use
Discourse
or
Send feedback