内容へ移動
fl8 Wiki
ユーザ用ツール
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
現在位置:
Dokuwiki.fl8.jp
»
01_linux
»
08_仮想化
»
kvm
»
08 qcow2 バックアップ 外部へ取得する場合(online external)
トレース:
01_linux:08_仮想化:kvm:08_qcow2_online_external_backup
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== 08 qcow2 バックアップ 外部へ取得する場合(online external) ====== 内部スナップショットは、[[01_linux:08_仮想化:kvm:10_qcow2_backup_internal]] ===== ディスク確認 ===== <code> root@hvdev1001:~# virsh domblklist testvm Target Source ------------------------------------------------ vda /var/lib/libvirt/images/testvm.qcow2 sda - </code> ===== スナップショット作成 ===== <code> root@hvdev1001:~# virsh snapshot-create-as testvm --name testsnap --no-metadata --disk-only Domain snapshot testsnap created </code> ==== スナップショット作成後 ==== <code> root@hvdev1001:~# virsh domblklist testvm Target Source --------------------------------------------------- vda /var/lib/libvirt/images/testvm.testsnap sda - </code> <code> # virsh dumpxml testvm . . . <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/testvm.testsnap' index='3'/> <backingStore type='file' index='2'> <format type='qcow2'/> <source file='/var/lib/libvirt/images/testvm.qcow2'/> <backingStore/> </backingStore> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/> </disk> . . </code> ===== スナップショット後は、元ファルがバックアップできる ===== <code> # qemu-img info /var/lib/libvirt/images/testvm.qcow2 image: /var/lib/libvirt/images/testvm.qcow2 file format: qcow2 virtual size: 25 GiB (26843545600 bytes) disk size: 4.16 GiB cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: true refcount bits: 16 corrupt: false # cp /var/lib/libvirt/images/testvm.qcow2 /backups/ </code> ==== 圧縮するとサイズが小さくなる ==== 容量の節約には圧縮しとく方法もある。 ※コンバートには時間がかかります。 <code> # qemu-img convert -c -f qcow2 -O qcow2 /var/lib/libvirt/images/testvm.qcow2 /backups/testvm.qcow2.bk # qemu-img info /var/lib/libvirt/images/testvm.qcow2 image: testvm.qcow2 file format: qcow2 virtual size: 100 GiB (107374182400 bytes) disk size: 12.9 GiB cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: true refcount bits: 16 corrupt: false # qemu-img info /backups/testvm.qcow2.bk image: testvm.qcow2.bk file format: qcow2 virtual size: 100 GiB (107374182400 bytes) disk size: 6.88 GiB cluster_size: 65536 Format specific information: compat: 1.1 lazy refcounts: false refcount bits: 16 corrupt: false # ll -h /backups/testvm.qcow2.bk -rw-r--r-- 1 root root 6.9G Apr 28 07:55 /backups/testvm.qcow2.bk </code> ===== バックアップ後は、元ファイルへマージ ===== <color #ed1c24>※注意 --base --topはフルパスじゃないとエラーになります。</color> <code> root@hvdev1001:~# virsh blockcommit testvm vda --base /var/lib/libvirt/images/testvm.qcow2 --top /var/lib/libvirt/images/testvm.testsnap --wait --verbose --pivot Block commit: [100 %] Successfully pivoted </code> <code> root@hvdev1001:~# virsh domblklist testvm Target Source ------------------------------------------------ vda /var/lib/libvirt/images/testvm.qcow2 sda - </code> <code> # virsh dumpxml testvm . . . <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/testvm.qcow2' index='2'/> <backingStore/> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/> </disk> </code> {{tag>kvm qcow2}}
01_linux/08_仮想化/kvm/08_qcow2_online_external_backup.txt
· 最終更新: 2023/04/27 23:17 by
matsui
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ