Moving KVM images to FreeNAS

This morning I decided that the mirrored 146GB disks on my HP DL360 GL server was not going to give me enough working space to setup more than about 5 VMs.  I have about 4TB left on my FreeNAS Mini storage array so I figured why not just access all the VMs via  NFS from the FreeNAS and see what would happen.  I use the VMs mostly for learning and testing so if they so if they are destroyed they are easily rebuilt. It also allows me to rebuild the server easily too as all the VM images are on the FreeNAS mini.

The modifications to move the VM images to the FreeNAS was relatively simple.

  • Export the directory location on the FreeNAS mini.
  • Update /etc/fstab on the server.
  • Mount the VM volume on the server.
  • Stop libvirtd.
    • (service libvirtd stop)
  • Move the VMs to the FreeNAS mini
    • mv /var/lib/libvirt/images/ /VM/images
  • Change the VM locations.
    • Edit /etc/libvirt/storage/default.xml Change location from /var/libvirt/images/ to /VM/images
    • Edit each VM image location in /etc/libvirt/qemu*.xml (for each VM)
      Change ‘source file” location from /var/lib/libvirt/images/server.xml to /VM/images/server.xml
  • Start libvirtd
  • Start all your VMs. ( I usually start them manually from virsh)
    • virsh#start puppet
    • virsh#start lab1

So far the performance is acceptable. Its a lab and not production.


This entry was posted in Uncategorized. Bookmark the permalink.