前回はこちら。
1. 事前準備
Oracle Linux 6.3 をインストールしたサーバを用意しておきます。
※これは、VortualBox 上の VM でも OK です。
下記のIPアドレスを設定をしておくことにします。
- eth0: 192.168.56.110 → このサーバへの通常アクセス用。
- eth1: 192.168.10.110 → Kickstart 用の NW に接続しておく。
[root@ovs11 ~]# vi /OVS/running_pool/EL52_vm1/vm.cfg
vif = ['type=netfront']
↓(編集)vif = ['mac=00:16:3E:00:00:01, bridge=xenbr0, type=netfront','mac=00:16:3E:10:00:01, bridge=xenbr1, type=netfront',]
[root@ovs11 ~]# lomount -t ext3 \
> -diskimage /OVS/running_pool/EL52_vm1/System.img -partition 2 /mnt/
[root@ovs11 ~]#
[root@ovs11 ~]# cd /mnt/etc/sysconfig/network-scripts/
[root@ovs11 network-scripts]# vi ifcfg-eth0(ファイルの内容)
DEVICE=eth0ONBOOT=yesBOOTPROTO=staticHWADDR=00:16:3E:00:00:01TYPE=EthernetIPADDR=192.168.56.31NETMASK=255.255.255.0
[root@ovs11 network-scripts]# cp ifcfg-eth0 ifcfg-eth1
[root@ovs11 network-scripts]# vi ifcfg-eth0(ファイルの内容)
DEVICE=eth1 ★変更ONBOOT=yesBOOTPROTO=staticHWADDR=00:16:3E:10:00:01 ★変更TYPE=EthernetIPADDR=192.168.0.31 ★変更NETMASK=255.255.255.0
[root@ovs11 network-scripts]# cd
[root@ovs11 ~]# vi /mnt/etc/sysconfig/networkHOSTNAME=localhost.localdomain
↓(編集)HOSTNAME=vm1
[root@ovs11 ~]# umount /mnt/
[root@ovs11 ~]# xm create /OVS/running_pool/EL52_vm1/vm.cfgVMの仮想NICは、vm.cfgファイルに指定したブリッジに接続されました。
Using config file "/OVS/running_pool/EL52_vm1/vm.cfg".Started domain EL52_vm1 (id=3)
[root@ovs11 ~]# brctl show
bridge name bridge id STP enabled interfaces
xenbr0 8000.080027c59f4e no vif3.0
eth0
xenbr1 8000.08002743ab84 no vif3.1
eth1
[root@ovs11 ~]# ssh 192.168.56.31
The authenticity of host '192.168.56.31 (192.168.56.31)' can't be established.RSA key fingerprint is 1f:2d:bd:25:fb:56:d7:b7:58:de:44:cb:a3:56:f4:ea.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added '192.168.56.31' (RSA) to the list of known hosts.root@192.168.56.31's password:Last login: Sat Jan 5 06:45:37 2013[root@vm1 ~]# uname -nvm1 ★ホスト名が変更されている[root@vm1 ~]# ifconfig | grep addr[root@vm1 ~]# ifconfig eth0| grep addr
eth0 Link encap:Ethernet HWaddr 00:16:3E:00:00:01
inet addr:192.168.56.31 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:fe00:1/64 Scope:Link
[root@vm1 ~]# ifconfig eth1| grep addr
eth1 Link encap:Ethernet HWaddr 00:16:3E:10:00:01
inet addr:192.168.0.31 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::216:3eff:fe10:1/64 Scope:Link


[root@vm1 ~]# fdisk -l
Disk /dev/xvda: 2155 MB, 2155023360 bytes
255 heads, 63 sectors/track, 262 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 12 96358+ 83 Linux
/dev/xvda2 13 261 2000092+ 83 Linux
/dev/xvda3 262 262 8032+ 82 Linux swap / Solaris
[root@vm1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 92M 11M 76M 13% /boot
/dev/xvda2 1.9G 493M 1.4G 27% /
tmpfs 129M 0 129M 0% /dev/shm

[root@ovs11 ~]# ls /mnt/
[root@ovs11 ~]# ★マウント前は何も見えない。
[root@ovs11 ~]# cd /OVS/running_pool/EL52_vm1/
[root@ovs11 EL52_vm1]# lomount -t ext3 -diskimage System.img -partition 2 /mnt
[root@ovs11 EL52_vm1]# ls /mnt/
bin dev home lost+found mnt proc sbin srv tmp usr
boot etc lib media opt root selinux sys u01 var
★System.imgの中身が/mnt配下で見られるようになった。
[root@ovs11 EL52_vm1]# umount /mnt
[root@ovs11 EL52_vm1]# ls /mnt/
[root@ovs11 EL52_vm1]# ★アンマウントしたので何も見えなくなった。

[root@ovs11 ~]# fdisk -l
Disk /dev/sda: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 14 1044 8281507+ 83 Linux
/dev/sda2 * 1 13 104391 83 Linux
Partition table entries are not in disk order
Disk /dev/sdb: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1435 11526606 83 Linux
/dev/sdb2 1436 1566 1052257+ 82 Linux swap / Solaris
[root@ovs11 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 7.7G 1.5G 5.8G 21% /
/dev/sda2 99M 45M 49M 48% /boot
tmpfs 257M 0 257M 0% /dev/shm
none 256M 40K 256M 1% /var/lib/xenstored
/dev/sdb1 11G 4.2G 6.9G 38% /var/ovs/mount/84D81812DF944D3CBF42AB164A70CC06
[root@ovs11 ~]# ls -ld /OVSDom0から見たVMの仮想ディスク(System.img)は、
lrwxrwxrwx 1 root root 47 Dec 29 16:33 /OVS -> /var/ovs/mount/84D81812DF944D3CBF42AB164A70CC06

[root@ovs11 ~]# ls -lh /OVS/running_pool/EL52_vm1/*
-rw-r--r-- 1 root root 2.1G Dec 31 17:35 /OVS/running_pool/EL52_vm1/System.img
-rw-r--r-- 1 root root 251 Dec 30 20:56 /OVS/running_pool/EL52_vm1/vm.cfg

[root@vm1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda2 1.9G 493M 1.4G 27% /
/dev/xvda1 92M 11M 76M 13% /boot
tmpfs 129M 0 129M 0% /dev/shm
[root@vm1 ~]# fdisk -l
Disk /dev/xvda: 2155 MB, 2155023360 bytes
255 heads, 63 sectors/track, 262 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/xvda1 * 1 12 96358+ 83 Linux
/dev/xvda2 13 261 2000092+ 83 Linux
/dev/xvda3 262 262 8032+ 82 Linux swap / Solaris






