I wanted to load a VM from a USB stick / msata sdd as I thought this could provide a performance boost for the NAS as the hdd disks are not busy. In a nutshell, the performance with my USB 3 MSATA drive is snappy and good enough for light web browsing.
Here are my findings on how to do this (boot VM from USB drive) on my DS218+ and also some additional thoughts about the VM performance.
First of all, I created a Windows 7 VM with virtio network interface (you can select this in the VM virtual machine manager). Windows 7 was mentioned on the Synology forum to perform better than Win 10 so I tried with this version.
In the VM network settings you need to click the gear and select the virtio network adapter. This is important as you will not have a network connection later on. Once the machine has been installed you need to download the virtio drivers from here virtio network driver and mount the image.
You also need to open the device manager on your guest and update the ethernet driver (the driver is in the NetKVM folder).
The machine can be shutdown when you have done the steps above and you are sure that you use the Redhat virtio network interface and you do have internet access with it.
You now need to start a SSH session and make yourself root with
sudo -i
As root cd into
cd /volume1/\@iSCSI/LUN/VDISK_BLUN/.
Here you can check the sub directories with
ls -allhd */*
for all your VMs and the image you would like to copy to the USB stick. Copy the image from the subdirectory with cp
to the root drive of your USB stick /volumeUSB1/usbshare/. If your USB drive is not detected in the NAS you can go to Control Panel -> External devices to format the drive as EXT4. You should keep a backup of your data before you format the stick.
After the vdisk image has been copied, you need to configure your network to route the IP traffic for the VM with:
ip tuntap add name tap0 mode tap;ifconfig tap0 up;ovs-vsctl add-port ovs_eth0 tap0
Now start qemu with:
/usr/local/bin/qemu-system-x86_64 -drive \
format=raw,file=/volumeUSB1/usbshare/vdisk.f6584cf5-6567-49c7-af33-d7f055c62bb4.a5bf8508-d623-4620-ad79-6c83cf143204.2.0_00000 \
-m 3000 -vnc :0 -mem-prealloc -mem-path /dev/virtualization/win7 -machine pc-i440fx-2.2,accel=kvm,usb=off \
-netdev tap,ifname=tap0,script=no,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=02:11:32:25:64:a7,bus=pci.0,addr=0x3 \
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4 -cpu host -smp 10
In the code above you need to change the vdisk filename to your image. The mem-path can also be updated to /tmp/W7 if you like. Adjust the -m argument to your memory (I configured 3000mb).
When qemu is running, you can ssh in with a second connection and check with top whether qemu is running and if so how much memory and cpu it uses.
Finally, use a VNC viewer to connect to the IP of the diskstation at port 5900 to get the Windows Desktop environment. I'd also recommend to set up remote desktop instead of using a VNC client.
If you want to use VMM again, you can remove the tap0 device from the bridge with:
ovs-vsctl del-port ovs_eth0 tap0
Overall I am satisfied with the performance from a USB stick. The USB stick version is definitely good enough for occasional browsing. Additionally I tested with my evo msata drive in a USB 3 enclosure. I had the impression that the EVO disk performed a tad better.