This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] Practical questions, ssh a domain, HD (Xen-Unstable)

To: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] Practical questions, ssh a domain, HD (Xen-Unstable)
From: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>
Date: Sat, 17 Jul 2004 21:52:33 +0100
Cc: Rune Johan Andresen <Rune.Johan.Andresen@xxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxxx, Ian.Pratt@xxxxxxxxxxxx
Delivery-date: Sat, 17 Jul 2004 21:53:55 +0100
Envelope-to: steven.hand@xxxxxxxxxxxx
In-reply-to: Your message of "Sat, 17 Jul 2004 11:16:12 BST." <E1BlmEn-0006fe-00@xxxxxxxxxxxxxxxxx>
List-archive: <http://sourceforge.net/mailarchive/forum.php?forum=xen-devel>
List-help: <mailto:xen-devel-request@lists.sourceforge.net?subject=help>
List-id: List for Xen developers <xen-devel.lists.sourceforge.net>
List-post: <mailto:xen-devel@lists.sourceforge.net>
List-subscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=subscribe>
List-unsubscribe: <https://lists.sourceforge.net/lists/listinfo/xen-devel>, <mailto:xen-devel-request@lists.sourceforge.net?subject=unsubscribe>
Sender: xen-devel-admin@xxxxxxxxxxxxxxxxxxxxx
> Alternatively, put a file system on the partition and export
> files to domains using the loopback device (losetup). This
> enables you to use sparse files, allocating disk space on demand.

Here's an example of how to do this:

# e.g. create a 2GB sparse file (actually only consumes 1KB of disk)
dd if=/dev/zero of=vm1disk bs=1k seek=2048k count=1

# choose a free loop back device, and attach file
losetup /dev/loop0 vm1disk

# make a file system on the loop back device
mkfs -t ext3 /dev/loop0

# populate the file system e.g. by copying from the current root
mount /dev/loop0 /mnt
cp -ax / /mnt
# tailor file system e.g. by editing /etc/fstab /etc/hostname etc.
# make sure you unmount !!!
umount /dev/loop0

You can then export the loop device to a domain using e.g.:

disk = [ 'phy:loop0,sda1,w' ]

As you write to the 'disk', the sparse file will become filled in
and consume more space (up to the original 2GB).

One feature we're planning to add to xend is to have it track
which loop devices are currently free and have it do the
allocation. You'd then be able to assign a file as a VD using:
 [ 'loop:vm1disk,sda1,w' ] 


This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
Xen-devel mailing list