kvm guest OS의 잡다한 설정

사용환경
OS: Ubuntu 11.04
CPU: Intel Xeon 3.7GHz x2 (4 core, 2 hyperthread per core)
RAM: 8GB
가상머신: KVM, Qemu
설정화일: /etc/libvirt/qemu/guest_os_name.xml
공통사항: 설정화일 수정후 libvirtd 재실행 할것.

1. 의외로 별거 아닌데 오랜 시간이 걸렸던, 게스트 OS의 그래픽 해상도 설정 문제.
guest OS를 설치하면(설치할때 옵션이 있는지는 모르겠다.)
보통 그래픽 해상도가 1024×768 까지밖에 지원되지 않는다. 설정(/etc/libvirt/qemu/guest_os_name.xml)을 확인해보면,

<video>
<model type=’vmvga‘ vram=’9216′ heads=’1′/>
<address type=’pci’ domain=’0×0000′ bus=’0×00′ slot=’0×02′ function=’0×0′/>

또는

<video>
<model type=’cirrus‘ vram=’9216′ heads=’1′/>
<address type=’pci’ domain=’0×0000′ bus=’0×00′ slot=’0×02′ function=’0×0′/>
</video>

이런 식으로 설정되어 있으며, 최대 해상도가 1024×768까지 설정됨을 확인할 수 있다. Linux계열이야 GUI를 많이 안쓰니까 상관없지만, windows 계열은 많이 불편하다. 이것 저것 확인해 보니 해상도를 높이는 방법은 의외로 간단했다.

<model type=’vga‘ vram=’9216′ heads=’1′/>

위쪽의 vmvga나 cirrus를 vga로 변경만 해주면된다.

2. CPU개수를 더 할당 하거나, 메모리를 더 할당할때.(물론, 반대도 가능하다).

<memory>1048576</memory>
<currentMemory>1048576</currentMemory>

위의 설정은 게스트 OS의 메모리가 1GB인 상태. 2GB로 늘리려면,

<memory>2097152</memory>
<currentMemory>2097152</currentMemory>

위처럼 변경해주면 해결.
게스트 OS의 속도가 좀 느리다는 생각이 들면, CPU를 더 할당해본다.

<vcpu>1</vcpu>

위의 항목을 찾아서,

<vcpu>2</vcpu>

처럼 바꿔준다.

3. Guest OS의 이름을 잘못줬다!!!(solaris 를 soalris로 잘못줬을경우)
물론, 그냥 써도 된다. 하지만 왠지 그냥 쓰고 싶지는 않다.

<name>soalris</name>
<source file=’/home2/VM2/soalris.vimg’/>

먼저,

<name>solaris</name>

로 변경한다. 두번째 줄은 선택사항이다. 이미지화일의 이름도 생성시 잘못들어갔다면, 역시 바꿔주면된다. 물론, 바꿔준후 원래 화일(soalris.vimg)의 이름을 solaris.vimg 로 바꿔주면 된다. 귀찮으면, 그냥 써도 된다.

4. Guest OS에 할당한 디스크가 너무 작다! 가상디스크를 추가하려면?
참고문서: http://itsignals.cascadia.com.au/?p=28

4.1. 실행중인 guest OS(xpsp2)를 중지시키고, 이미지화일을 백업해둔다.

4.2. 증가시킬만큼(여기서는 10GB) 아래 커맨드로 이미지화일을 생성한다.

# qemu-img create -f raw add-disk.raw 10g
Formatting ‘add-disk.raw’, fmt=raw size=10737418240

4.3. 두 화일을 합쳐서 더 큰 화일로 만든다. 시간이 좀 걸리므로 참고 기다리자.
여기서, windows.vimg는 원래 guestOS의 화일, add-disk.raw는 추가로 만든 화일, xp.vimg는 새로 만들어지는 화일.

cat windows.vimg add-disk.raw >> xp.vimg
#ls -alh
-rwxr-xr-x 1 root root 12G Feb 28 11:07 windows.vimg
-rw-r–r– 1 root root 10G Feb 28 11:58 add-disk.raw
-rwxr-xr-x 1 libvirt-qemu kvm 22G Feb 28 12:16 xp.vimg

4.4 생성한 xp.vimg를 사용하도록 xml화일을 수정해도 되고, 화일 이름을 변경해도 된다. 나는 xml화일에서 windows.vimg 를 xp.vimg로 수정하였다.

4.5. guestOS 를 실행하여 윈도우xp의 디스크관리에 들어가보면, 추가된 10GB가 보인다. 이것을 파티션잡고 포맷하여 사용하면 된다.

마지막으로, qemu-img resize windows.img +10GB 하면 된다고 위 참고문서에 누군가가 답글을 달아 놓은것을 보았다. 쉽게 되는것을 너무 어렵게 했나? ;ㅡㅡ

sun v480 error message…

처음 에러 메시지
Dec 13 06:47:11 solaris9 picld[60]: [ID 679711 daemon.error] NOTICE: Device FAN_TRAY_0 (CPU1_FAN) OK
Dec 13 06:47:11 solaris9 picld[60]: [ID 114988 daemon.error] FSP_GEN_FAULT_LED has turned OFF
Dec 13 08:22:26 solaris9 picld[60]: [ID 562987 daemon.error] WARNING: FAN_TRAY_0 (CPU1_FAN) failure detected
Dec 13 08:22:28 solaris9 picld[60]: [ID 691918 daemon.error] FSP_GEN_FAULT_LED has turned ON
Dec 13 08:22:41 solaris9 picld[60]: [ID 562987 daemon.error] WARNING: FAN_TRAY_0 (CPU1_FAN) failure detected
Dec 13 08:22:57 solaris9 picld[60]: [ID 679711 daemon.error] NOTICE: Device FAN_TRAY_0 (CPU1_FAN) OK
Dec 13 08:22:58 solaris9 picld[60]: [ID 114988 daemon.error] FSP_GEN_FAULT_LED has turned OFF

FAN TRAY를 교체하려고 준비했을때는 아래와 같이 바뀌었음.
Jan 19 15:24:11 solaris9 picld[60]: [ID 562987 daemon.error] WARNING: FAN_TRAY_0 (CPU0_FAN) failure detected
Jan 19 15:24:11 solaris9 picld[60]: [ID 562987 daemon.error] WARNING: FAN_TRAY_0 (CPU1_FAN) failure detected
Jan 19 15:24:11 solaris9 picld[60]: [ID 562987 daemon.error] WARNING: FAN_TRAY_0 (CPU2_FAN) failure detected
Jan 19 15:24:26 solaris9 picld[60]: [ID 679711 daemon.error] NOTICE: Device FAN_TRAY_0 (CPU0_FAN) OK
Jan 19 15:24:26 solaris9 picld[60]: [ID 679711 daemon.error] NOTICE: Device FAN_TRAY_0 (CPU1_FAN) OK
Jan 19 15:24:26 solaris9 picld[60]: [ID 562987 daemon.error] WARNING: FAN_TRAY_0 (CPU2_FAN) failure detected
Jan 19 15:26:41 solaris9 last message repeated 9 times
FAN TRAY를 교체하고 (이때 FAN Tray의 fan 3개는 모두 정상적으로 돌고 있었음.) 재부팅했을때 아래와 같음.
Jan 19 15:38:59 solaris9 ntpdate[234]: [ID 558275 daemon.notice] adjust time server 10.100.88.42 offset 0.266879 sec
Jan 19 15:39:02 solaris9 xntpd[292]: [ID 702911 daemon.notice] xntpd 3-5.93e Mon Sep 20 15:47:11 PDT 1999 (1)
Jan 19 15:39:02 solaris9 xntpd[292]: [ID 301315 daemon.notice] tickadj = 5, tick = 10000, tvu_maxslew = 495, est. hz = 100
Jan 19 15:39:02 solaris9 xntpd[292]: [ID 798731 daemon.notice] using kernel phase-lock loop 0041
Jan 19 15:39:02 solaris9 last message repeated 1 time
Jan 19 15:39:04 solaris9 picld[60]: [ID 562987 daemon.error] WARNING: FAN_TRAY_0 (CPU2_FAN) failure detected
Jan 19 15:39:05 solaris9 picld[60]: [ID 691918 daemon.error] FSP_GEN_FAULT_LED has turned ON
Jan 19 15:39:19 solaris9 picld[60]: [ID 562987 daemon.error] WARNING: FAN_TRAY_0 (CPU2_FAN) failure detected
Jan 19 15:40:05 solaris9 last message repeated 3 times

일단 팬트레이를 교체해도 문제가 해결되지 않아서 더 찾아보니, picld 버그일 가능성이 있다고 한다. 패치를 찾아서 시도해 보아야 할 상황인데, 패치를 받기가 힘들다. sun이 오라클에 합병당해서

ubuntu 서버에 networker client 설치하기

넷워커는 공식적으로 데비안패키지를 지원하지 않는다. 이건 넷백업도 마찬가지로 생각되지만,
아무튼, rpm패키지를 deb패키지로 변환해주는 alien 패키지를 설치하여 넷워크 클라이언트를 설치할 수 있다.
설치는 아래 사이트를 참고 했다.
http://blog.mc-thias.org/?title=networker-7-5-1-client-on-debian-gnu-linux-5-0-ubuntu-9-04&more=1&c=1&tb=1&pb=1

순서는…
1. 우분투 서버에 alien 패키지 설치.
2. alien 커맨드로 rpm 패키지를 deb 패키지로 변환.
3. 패키지 설치
4. nsrexecd 를 실행하여 /nsr 디렉토리가 생성되게 한다. 그후 kill로 nsrexecd를 중지시킨다.
5. /nsr/res/servers화일을 생성한다고 하는데, 이 부분은 필요 없다. 대신,
/etc/hosts 화일에 넷워커 서버와 서버에 설정된 클라이언트의를 설정해 준다.
6. 레드햇 계열에서는 자동으로 생성되는 시작 스크립트 /etc/init.d/networker 가 우분투에서는 설치되지 않으므로,
기존에 설치된 화일을 복사하여 사용한다. 없는 경우에는, 아래 스크립트를 사용하면 된다.
#! /bin/sh
# Copyright (c) 1990-2010, EMC Corporation
# All rights reserved.
# chkconfig: 35 95 05
# description: EMC Networker. A backup and restoration software package.
### BEGIN INIT INFO
# Provides: networker
# Required-Start: syslog network
# Required-Stop: syslog network
# X-UnitedLinux-Should-Start: portmap
# Should-Start: portmap
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: EMC Networker. A backup and restoration software package.
### END INIT INFO
case $1 in
start)
(echo ‘starting NetWorker daemons:’) > /dev/console
LD_LIBRARY_PATH=/usr/lib/nsr:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
if [ -f /usr/sbin/nsrexecd ]; then
if [ -f /usr/sbin/NetWorker.clustersvr ]; then
if [ -f /nsr.NetWorker.local -o -h /nsr.NetWorker.local ]; then
if [ -h /nsr ]; then
rm -f /nsr
ln -s /nsr.NetWorker.local /nsr
fi
fi
fi
(/usr/sbin/nsrexecd) > /dev/console 2>&1
(echo ‘ nsrexecd’) > /dev/console
fi
if [ -f /usr/sbin/lgtolmd ]; then
(/usr/sbin/lgtolmd -p /nsr/lic -n 1) > /dev/console 2>&1
(echo ‘ lgtolmd’) > /dev/console
fi
if [ -f /usr/sbin/nsrd -a \
! -f /usr/sbin/NetWorker.clustersvr ]; then
(/usr/sbin/nsrd) > /dev/console 2>&1
(echo ‘ nsrd’) > /dev/console
fi
;;
stop)
(echo ‘stopping NetWorker daemons:’) > /dev/console
if [ -f /usr/sbin/nsr_shutdown ]; then
if [ -f /usr/sbin/NetWorker.clustersvr ]; then
(/usr/sbin/nsr_shutdown -q) > /dev/console 2>&1
(echo ‘ nsr_shutdown -q’) > /dev/console
else
(/usr/sbin/nsr_shutdown -q) > /dev/console 2>&1
(echo ‘ nsr_shutdown -q’) > /dev/console
fi
fi
;;
status)
if [ -f /usr/sbin/nsr_shutdown ]; then
/usr/sbin/nsr_shutdown -l
fi
;;
*)
echo “usage: `basename $0` {start|stop|status}”
;;
esac
7. update-rc.d networker default 커맨드로 시작 스크립트에 등록한다.

CentOS 5.7 KVM guest os network interface 변경

CentOS 5.7에 KVM 설치하면 ubuntu와는 다르게 가상 네트워크 인터페이스 virbr0가 생긴다. virbr0는 guest OS가 NAT를 사용하게 하는데, 호스트OS와 같은 네트워크를 사용하려면, 이 virbr0를 사용하지 않으면 된다.
virsh # net-list
virsh # net-destroy default
# /etc/init.d/libvirtd restart
이렇게 하면 virbr0는 사라진다. 하지만 게스트 OS의 네트워크쪽에 문제가 생겨서 게스트가 실행되지 않는 현상이 발생
윈도우는 디바이스를 다시 잡지만 리눅스는 아래 에러 발생
virsh # start ubuntu
error: Failed to start domain ubuntu
error: Network not found: no network with matching name ‘default’
/etc/libvirt/qemu/ubuntu.xml 화일에서
<interface type=’network‘>
<mac address=’54:52:00:5e:53:d2′/>
<source network=’default‘/>
</interface>
부분을
<interface type=’bridge‘>
<mac address=’54:52:00:5e:53:d2′/>
<source bridge=’br0′/>
</interface>
로 수정 하면 잘됨
아래는 다시 NAT 로 사용하고자 할 때 .
virsh # net-list –all
Name State Autostart
—————————————–
virsh # net-define /usr/share/libvirt/networks/default.xml
Network default defined from /usr/share/libvirt/networks/default.xml
virsh # net-autostart default
Network default marked as autostarted
virsh # net-start default
Network default started
게스트 OS의 network를 NAT에서 bridge로 바꾸니 매우 느린 현상도 없어졌음.

hpux 디스크 추가.

HPUX 디스크 추가.(1개를 통채로 잡는방법)

pvcreate -f /dev/rdisk/disk39
cd /dev
mkdir vg05
cd vg05
mknod group c 64 0×050000
vgcreate -s 32 /dev/vg05 /dev/disk/disk39
vgdisplay vg05
lvcreate -l `vgdisplay Free PE값’ /dev/vg05
newfs -F vxfs -o largefiles /dev/vg05/rlvol1
# strings /etc/lvmtab
/dev/vg00
/dev/disk/disk1_p2
/dev/vg02
/dev/disk/disk68
/dev/vg03
/dev/disk/disk42
/dev/vg01
/dev/disk/disk41
/dev/vg04
/dev/disk/disk40
/dev/vg05
/dev/disk/disk39
/dev/vg06
/dev/disk/disk38
# bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 115048448 14713576 99557352 13% /
/dev/vg00/lvol1 2097152 192504 1889856 9% /stand
/dev/vg02/lvol1 24760320 3563645 19872682 15% /oracle
/dev/vg01/lvol1 517963776 193597 485409550 0% /archive
/dev/vg01/lvol1 517963776 193597 485409550 0% /archive
/dev/vg03/lvol1 517963776 3965111 481873868 1% /oradata/data1
/dev/vg04/lvol1 517963776 193597 485409550 0% /oradata/data2
/dev/vg05/lvol1 517963776 193597 485409550 0% /oradata/data3
/dev/vg06/lvol1 517963776 193597 485409550 0% /oradata/data4
볼륨 삭제.(vg01을 삭제하고자 할때)
vgchange -a n vg01
vgexport vg01

hpux 오라클 .profile 화일

umask 022
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10gr2
export ORACLE_SID=orcl
export TMPDIR=$ORACLE_BASE/tmp
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export NLS_LANG=American_America.KO16KSC5601
export NLS_DATE_FORMAT=’YYYY-MM-DD HH24:MI:SS’
export PATH=$ORACLE_HOME/bin:/usr/bin:/sbin:/usr/ccs/bin:/usr/bin/X11:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:/lib:/usr/lib:$ORACLE_HOME/rdbms/lib
export SHLIB_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:/usr/lib
export ORACLE_HOSTNAME=`hostname`
export PS1=`hostname`:’${PWD}/$ ‘
alias ls=’ls -F’

Centos5.7 KVM 설치

1. CPU가 kvm을 지원하는지 확인한다.(intel: vmx, AMD: svm 지원되어야 가상화 지원됨)

[root@snowolf ~]# egrep ‘(vmx|svm)’ –color=always /proc/cpuinfo

2. 커널에 kvm모듈이 로딩되어 있는지 확인한다.

[root@snowolf ~]# lsmod | grep
kvmkvm_intel 85256 0
kvm 224928 2 ksm,kvm_intel
[root@snowolf ~]# modprobe kvm
[root@snowolf ~]# modprobe kvm-intel
FATAL: Error inserting kvm_intel (/lib/modules/2.6.18-274.12.1.el5/weak-updates/kmod-kvm/kvm-intel.ko): Operation not supported

만약 CPU가 가상화 지원되지만 위와같은 FATAL 에러가 발생했다면, 서버(또는 PC)의 BIOS에서 가상화 지원부분을 확인해야 한다. 테스트중인 RX200 S3의 BIOS에서는 가상화가 disable되어 있어서 enable 시켜 주었다. 이후 lsmod는 위쪽처럼 정상적으로 보임을 확인했다.

3. kvm패키지 설치

# yum install kvm libvirt python-virtinst qemu-kvm
# yum install bridge-utils
# yum install virt-manager libvirt qemu-system-x86 openssh-askpass

4. 게스트 OS설치

# virt-install --connect qemu:///system --name centos6 --ram 1024 --vcpus=1 --disk path=/var/lib/libvirt/images/centos6.img,size=8 --cdrom /home/CentOS-6.8-x86_64-minimal.iso  --vnc –noautoconsole --os-type linux --os-variant linux
  184  virt-install --connect qemu:///system --name centos6 --ram 1024 --vcpus=1 --disk path=/var/lib/libvirt/images/centos6.img,size=8 --cdrom /home/CentOS-6.8-x86_64-minimal.iso  --vnc --noautoconsole --os-type linux --os-variant linux
Starting install…Creating storage file… | 8 GB 00:00Creating domain… | 0 B 00:00Domain installation still in progress. Waiting for installation to complete.

5. xmanager나 xming을 이용하여 설치시 그래픽화면을 볼 수 있다.
xmanager사용시 , xstart 실행 -> 호스트,프로토콜(ssh), id, password, 실행명령에 /usr/bin/gnome-session –display $DISPLAY나 virt-manager를 입력하여 실행.
또는 virt-viewer -c qemu:///system winxp 처럼 직접 입력하여도 된다.

6. 게스트OS의 삭제.
삭제는 생성한 OS의 이미지를 삭제하고, qemu의 설정화일(/etc/libvirt/qemu/winxp.xml)을 삭제한 후 재부티을 하면된다. 커널 kvm모듈을 제거(rmmod)하면 될 것 같지만, 의외로 다른 연관된 모듈때문에 rmmod가 되지 않는다. 그래서 재부팅을 해야만 했다. 이렇게 하면 게스트os가 삭제되긴 하지만, 맞는 방법인지는 모르겠다.


2017.2.1. centos 7(minimal 버전)에 qemu/kvm 설치하기 동영상 추가

우분투에서 md0가 md127로 바뀌는 현상

우분투리눅스(11.04)에서 디스크 두개를 mdadm으로 미러 구성을 하고, 메타디바이스를 md0로 설정하였다.
하지만, 재부팅하면 md0는 사라지고 대신 md127로 인식을 하는 현상이 발생.
mdadm –detail /dev/md127 하여나오는 결과중에 UUID와 Name을 아래 화일에 설정해 준다.

/dev/md127:
Version : 1.2
Creation Time : Tue Nov 29 21:22:23 2011
Raid Level : raid1
Array Size : 488382841 (465.76 GiB 500.10 GB)
Used Dev Size : 488382841 (465.76 GiB 500.10 GB)
Raid Devices : 2 Total Devices : 2
Persistence : Superblock is persistent
Update Time : Fri Dec 2 17:14:15 2011
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Name : fox:0 (local to host fox)
UUID : 4c2ddcae:30672ec0:f6065242:f4702e40
Events : 19
Number Major Minor RaidDevice State
0 8 17 0 active sync /dev/sdb1
1 8 33 1 active sync /dev/sdc1
/etc/mdadm/mdadm.conf
ARRAY /dev/md0 devices=/dev/sdb1,/dev/sdc1 name=fox:0 UUID=4c2ddcae:30672ec0:f6065242:f4702e40 level=1 num-devices=2 auto=yes

여기서 fox는 호스트네임.
이후 아래커맨드 실행 후 재부팅 하면, 정상적으로 md0로 인식됨.

update-initramfs -u

rp 3440 turn off the red blinking system LED

1. connect MP (serial cable, ctrl+B)
[mp00215a9a04db] MP>
MP MAIN MENU:
CO: Console
VFP: Virtual Front Panel
CM: Command Menu
CL: Console Log
SL: Show Event Logs
CSP: Connect to Service Processor
SE: Enter OS Session
HE: Main Help Menu
X: Exit Connection
System state Activity # of logs since boot
————— ——– ——————–
HPUX init process start 746
2. show display Front system LED : VFP command
LEDs | LOCATOR | SYSTEM | POWER
—————————————————————————–
| OFF | FLASH RED | ON GREEN
—————————————————————————–
Status | Fatal System State detected. Check System Event Log (SL) for error
| messages.
—————————————————————————–
3. execute dc command.( CM -> dc)
[mp00215a9a04db] MP> cm
[mp00215a9a04db] MP:CM> dc
DCThis command will restore all MP Configurations to their default values.
To restore specific configurations to their defaults use the following commands:
Remote Console Serial Port Modem configuration: CA -remote DEFAULT
MP IP configuration : LC -all DEFAULT
Remote Access Configuration : SA -all
DEFAULT Command Interface configuration : IT -all
DEFAULT MP Security configuration : SO -opt DEFAULT
MP Session configuration : IT -all DEFAULT
MP User configuration : UC -all DEFAULT
MP LDAP directory configuration : LDAP -all DEFAULT
SNMP Configuration : SNMP -all DEFAULT
Restore All MP configuration default values? (Y/[N]):
Restore All MP configuration default values? (Y/[N]): yy
-> All MP configuration will be reset to its default values.
-> Users may be disconnected in this process
Command execution may take 25 seconds.
-> MP IP configuration
-> Remote Console Serial Port Modem configuration
-> Paging configuration
-> Remote Access
-> MP Security configuration
*************************************************************************
This is a private system.
Do not attempt to login unless you are an authorized user.
Any authorized or unauthorized access or use may be monitored and can
result in criminal or civil prosecution under applicable law.
*************************************************************************
*************************************************************************
Only default users are configured. Use one of the following user/password pairs to login:
Admin/Admin Oper/Oper
*************************************************************************
MP login:

4. MP login and VFP , then red led were turn offed.
LEDs | LOCATOR | SYSTEM | POWER
—————————————————————————–
| OFF | OFF | ON GREEN
—————————————————————————–
Status | No code is executing. System is Off.
—————————————————————————–

cisco 1720 flash rom backup

CISCO 1720
TFTP server: 10.0.0.58
Router Ethernet: 10.0.0.57
Router#sh flash
System flash directory:
File Length Name/status
1 3038760 c1700-y-mz.121-3
[3038824 bytes used, 5349784 available, 8388608 total]
8192K bytes of processor board System flash (Read/Write)
Router#copy flash tftp
Source filename []? c1700-y-mz.121-3
Address or name of remote host []? 10.0.0.58
Destination filename [c1700-y-mz.1213]?
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3038760 bytes copied in 19.132 secs (159934 bytes/sec)