I'm running Ubuntu 16.04 LTS and I am using QEMU+KVM+OVMF for a Windows VM. Is there a way to mount physical hard drives to the VM only without using a container, as well as keep the data that is still on them?

There are examples of this I assume but I only see them in XML format and I use QEMU command line script. Not very familiar with conversions, no idea what format I'd need to put it in.

http://pastebin.com/WRaZuM02 The script I use. I supposedly need to use UUID for my hard drives but I never seen that used in CLI before.


Simply specify the hard disk as the "file" qemu should use, for example /dev/sdb or /dev/disk/by-uuid/some-uuid-here. Of course, you must make sure nothing else is using that disk other than this vm or bad things (TM) will happen.

  • Would this be right then? -drive file=/dev/sdc2,id=disk2,if=none -device scsi-hd,drive=disk2 \ – Kyler Parson Apr 28 '16 at 0:19
  • @KylerParson, /dev/sdc2 is an individual partition of a disk, not a whole disk, which is what you asked about. I recommend using either regular files or LVM logical volumes to hold disk images. The nice thing about these is that you can give the vm a much larger virtual disk that only uses a fraction of that size to store the data it has actually written to the disk, and it can grow over time, rather than reserving a fixed amount when you create it, and having to deal with the hassle of resizing and moving partitions. – psusi Apr 28 '16 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.