Top
Cloud Storage Gateway V1.2.0 User's Guide
FUJITSU Software

D.1.2 Creating Snapshots in KVM Environments

  1. 1. Stop the virtual machine of this product if it is running.
    Log in to the console of this product using the administrator account to stop the virtual machine with the following command.

    # csgadm power stop
  2. Log in to the KVM host.

  3. Use the qemu-img command to create a qcow2 image based on the virtual disk images for the system and cache areas.
    The following example shows how to create CSG_v110_kvm_tmp.qcow2 from the CSG_v110_kvm.qcow2 virtual disk file for the system area and how to create CSG_v110_cache_tmp.qcow2 from the CSG_v110_cache.raw virtual disk file for the cache area.

    # cd /var/lib/libvirt/images
    # qemu-img create -f qcow2 -b CSG_v110_kvm.qcow2 CSG_v110_kvm_tmp.qcow2
    # qemu-img create -f qcow2 -b CSG_v110_cache.img CSG_v110_cache_tmp.qcow2
  4. Change the settings of the virtual machine to use the created qcow2 image by using the virsh edit command.
    In the virtual disk file for the system area, change the file attribute of the <source> tag to the created qcow2 image.
    In the virtual disk file for the cache area, change the type attribute of the <driver> tag from raw to qcow2 and the file attribute of the <source> tag to the created qcow2 image.
    The following is an execution example. Domain names are virtual machine names displayed in the virtual machine manager.
    [Execution example]

    # virsh edit domain_name

    The following example illustrates how to change the parameters. The highlighted parts need to be changed.

    [Before the change]

      <devices>
         <emulator>/usr/libexec/qemu-kvm</emulator>
         <disk type='file' device='disk'>
           <driver name='qemu' type='qcow2'/>
           <source file='/var/lib/libvirt/images/CSG_v110_kvm.qcow2'/>
           <target dev='hda' bus='ide'/>
           <address type='drive' controller='0' bus='0' target='0' unit='0'/>
         </disk>
         <disk type='file' device='disk'>
           <driver name='qemu' type='raw'/>
           <source file='/var/lib/libvirt/images/CSG_v110_cache.img'/>
           <target dev='vda' bus='virtio'/>
           <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
         </disk>

    [After the change]

      <devices>
         <emulator>/usr/libexec/qemu-kvm</emulator>
         <disk type='file' device='disk'>
           <driver name='qemu' type='qcow2'/>
           <source file='/var/lib/libvirt/images/CSG_v110_kvm_tmp.qcow2'/>
           <target dev='hda' bus='ide'/>
           <address type='drive' controller='0' bus='0' target='0' unit='0'/>
         </disk>
         <disk type='file' device='disk'>
           <driver name='qemu' type='qcow2'/>
           <source file='/var/lib/libvirt/images/CSG_v110_cache_tmp.qcow2'/>
           <target dev='vda' bus='virtio'/>
           <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
         </disk>

Note

If you are using multiple virtual disk files for the cache area, create a qcow2 image for each one of them and change the virtual machine settings.