xen-tools で Debian (etch) 環境を作る

さすがに、Debian 環境を作るのは超簡単。

必要なパッケージのインストール

既に Xen (dom0) が動いていることが前提。

 aptitude install xen-tools

xen-tools.conf の設定

/etc/xen-tools/xen-tools.conf:

dir = /var/xen
debootstrap = 1
size   = 4Gb      # Disk image size.
memory = 64Mb     # Memory size
swap   = 128Mb    # Swap size
fs     = ext3     # use the EXT3 filesystem for the disk image.
dist   = etch     # Default distribution to install.
image  = sparse   # Specify sparse vs. full disk images.
gateway   = 192.168.100.1
netmask   = 255.255.255.0
kernel = /boot/vmlinuz-2.6.18-6-xen-686
initrd = /boot/initrd.img-2.6.18-6-xen-686
arch=i386
mirror = http://ftp.us.debian.org/debian/

xen-tools のコマンド実行

 xen-create-image --verbose --hostname etch --ip 192.168.100.30

以下のファイルが生成される。

設定ファイル /etc/xen/etch.cfg
OSイメージ /var/xen/domains/etch/data.img
swapイメージ /var/xen/domains/etch/swap.img

domU の起動

 xm create -c /etc/xen/etch.cfg