LoginSignup
0
2

More than 5 years have passed since last update.

いろいろメモ

Last updated at Posted at 2017-06-10

KVMもろもろ

インストール

ホスト:CentOS7 ゲスト:CentOS6x64

#!/bin/bash
virt-install \
--name centos6x64 \
--ram 3096 \
--disk path=/var/kvm/images/centos6x64.img,size=30 \
--vcpus 2 \
--os-type linux \
--os-variant rhel6 \
--network bridge=br0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://ftp.iij.ad.jp/pub/linux/centos/6/os/x86_64/' \
--extra-args 'console=ttyS0,115200n8 serial'

ホスト:CentOS7 ゲスト:CentOS7

#!/bin/bash
virt-install \
--name centos7 \
--ram 3096 \
--disk path=/var/kvm/images/centos7.img,size=30 \
--vcpus 2 \
--os-type linux \
--os-variant rhel7 \
--network bridge=br0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://ftp.iij.ad.jp/pub/linux/centos/7/os/x86_64/' \
--extra-args 'console=ttyS0,115200n8 serial'

スナップショット

# virsh list --all
 Id    名前                         状態
----------------------------------------------------
 2     centos6                        実行中
 3     centos7                        実行中

表示

# virsh snapshot-list centos7
 名前               作成時間              状態
------------------------------------------------------------
 centos7-snapshot-160109 2016-01-09 20:49:26 +0900 running

作成

# virsh snapshot-create-as centos7 centos7-ss

復元

# virsh snapshot-revert centos7 centos7-ss

削除

# virsh snapshot-delete centos7 centos7-ss-160109-2206
ドメインのスナップショット centos7-ss-160109-2206 が削除されました

ゲストOSの名前変更

# uuidgen
38c71a44-e03a-4174-89e2-e27a6b1ab9c8 ←メモ
# virsh edit 仮想マシン名
<name>表示させたい名前</name>
<uuid>上でメモしたuuid</uuid>    ←メモしたuuidへ書き換える。

# virsh define /etc/libvirt/qemu/仮想マシン名.xml <--再定義する。
# virsh list --all                               <--新しい名称と古い名称の仮想マシンが表示される。
# virsh start 新しい仮想マシン名        <--新しい仮想マシン名で起動して、正常に動作することを確認する。
# virsh undefine 古い仮想マシン名        <--古い仮想マシン名を定義を解除する。
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2