LoginSignup
0
0

More than 1 year has passed since last update.

KVMでよく使うコマンドメモ

Posted at

KVM

KVMとはカーネルベースの仮想マシン
最近使うことが多いので、コマンドをメモしておこうと思い記事にしております。

イメージ作成

$ qemu-img create -f qcow2 /var/lib/libvirt/images/TEST.qcow2 16G

インストール

$ virt-install --virt-type kvm --name TEST --memory 2048 \
> --vcpus 1 \
> --disk /var/lib/libvirt/images/TEST.qcow2,format=qcow2 \
> --network type=direct,source=nic1,source_mode=bridge,model=virtio \
> --os-type=linux --os-variant=centos7.0 \
> --location=/root/CentOS-7_6-x86_64-DVD-1810.iso \
> --graphics none \
> --extra-args="console=tty0 console=ttyS0,11520n8"

VM一覧表示

$ virsh list --all

VM強制シャットダウン

$ virsh destroy TEST

VM定義抹消

$ virsh undefine TEST

イメージ削除

$ rm -f /var/lib/libvirt/images/TEST.qcow2

クローン

$ virt-clone --original TEST --name TEST2 --file /var/lib/libvirt/images/TEST2.qcow2

スナップショット一覧

$ virsh snapshot-list --domain TEST

スナップショット作成

$ virsh snapshot-create-as --domain TEST --name test --description "first ss"

スナップショット削除

$ virsh snapshot-delete --domain TEST --snapshotname test
0
0
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
0