VM FAQ


RobJ

Recommended Posts

This TOC is broken, at least for now. See the "repaired" TOC here:

 

https://forums.unraid.net/topic/51703-vm-faq/?tab=comments#comment-557627

 

Something seems to have broken the links that were imported from the old forum software.

 

 

 

 

__________________________________________________________________________________________________________________

 

This thread is reserved for Frequently Asked Questions, concerning everything that's VM related on unRAID, their setup, operation, management, and troubleshooting.  Please do not ask for support here, such requests and anything off-topic will be deleted or moved, probably to the VM FAQ feedback topic.  If you wish to comment on the current FAQ posts, or have suggestions or requests for the FAQ, please put them in the VM FAQ feedback topic.  Thank you!

 

Note: there are lots of graphics, allow your browser extra time!  Each page may jump around some as it loads.


 

Getting Started

General Questions

Maintenance and Troubleshooting


 

unRAID FAQ's and Guides -

* Guides and Videos - comprehensive collection of all unRAID guides (please let us know if you find one that's missing)

* FAQ for unRAID v6 on the forums, general NAS questions, not for Dockers or VM's

* FAQ for unRAID v6 on the unRAID wiki - it has a tremendous amount of information, questions and answers about unRAID.  It's being updated for v6, but much is still only for v4 and v5.

* Docker FAQ - concerning all things Docker, their setup, operation, management, and troubleshooting

* FAQ for binhex Docker containers - some of the questions and answers are of general interest, not just for binhex containers

* VM FAQ - a FAQ for VM's and all virtualization issues

 

Know of a question that ought to be here?  Please suggest it in the VM FAQ feedback topic.

 

-------------------------------------------------------

Suggested format for FAQ entries - clearly shape the issue as a question or as a statement of the problem to solve, then fully answer it below, including any appropriate links to related info or videos.  Optionally, set the subject heading to be appropriate, perhaps the question itself.

 

While a moderator could cut and paste a FAQ entry here, only another moderator could edit it.  It's best therefore if only knowledgeable and experienced users create the FAQ posts, so they can be the ones to edit it later, as needed.  Later, the author may want to add new info to the post, or add links to new and helpful info.  And the post may need to be modified if a new unRAID release changes the behavior being discussed.

 

Moderators:  please feel free to edit this post.

  • Like 1
Link to comment

How do I get started using unRAID VMs ?

 

Things to read -

 

** VM  Basics,  A brief synopsis of KVM, HVM, and VFIO by Jonp

    http://lime-technology.com/forum/index.php?topic=38689

 

** VM, Guide/Manual,UnRAID 6/VM Management -- Offical Limetech guide to VM management

    http://lime-technology.com/wiki/index.php/UnRAID_6/VM_Management#Using_Virtual_Machines

 

 

Things to watch -

 

** VM Guide - An introduction to unRAID VMS in unRAID 6.2.3 and what to do first. by gridrunner

    Thread  http://lime-technology.com/forum/index.php?topic=53573.0

 

 

 

** VM Guide - Enabling VM management in unRAID 6 by jonp

 

 

 

  • Thanks 1
Link to comment

What kind of performance can I expect from a VM ?

 

Things to read -

 

**Article - Gaming on a NAS? You better believe it! Limetech website

http://lime-technology.com/gaming-on-a-nas-you-better-believe-it/

 

Things to watch -

 

** VM benchmark/demo - 3 Gamers, 1 mATX Motherboard, 1 CPU and various benchmarks. by gridrunner

    forum link http://lime-technology.com/forum/index.php?topic=53169.0

 

 

** VM benchmark/demo -Physical vs. Virtual Machine - 3D Mark Benchmark Comparison by jonp

 

Link to comment

Whilst installing Windows 7 VM I'm getting stuck at the "Starting Windows" screen ?

 

When installing Windows 7 it is best to set the vnc video driver, graphics type to 'cirrus'

 

You will not see this option until you togle the advanced view

 

Screen_Shot_2016_11_09_at_15_50_07.png

 

Then you will see the option to change graphics type

 

Screen_Shot_2016_11_09_at_15_50_35.png

 

** forum link http://lime-technology.com/forum/index.php?topic=53346.msg512381#msg512381 

Link to comment

Why cant I get a network connection or the wrong IP in my VM?

 

Scenario 1 Windows VMs

 

If you have a problem with a windows vm then it is probably because windows needs to have virtio drivers (the same drivers that you used when installing the VM) installed for the network adaptor.

 

Screen_Shot_2016_11_09_at_16_34_18.png

 

Scenario 2 All  VMs

 

If you are getting an unexpected IP address in your VM and cant see it in your local network, then you may not have the network type set as a NAT bridge (virbr0). That will mean the VM is not visible on the local LAN. The check this toggle the advanced tab.

 

Screen_Shot_2016_11_09_at_15_50_07.png

 

Then check that the network type is set to 'br0'

 

Screen_Shot_2016_11_09_at_16_26_29.png

 

Scenario 3  OS X  VMs

 

OS x needs to have the network adaptor type set to  <model type='e1000-82545em'/> in order to be compatible with the OS.

 

If you find that you network was working fine one day and not the next. Have you been editing the xml of the vm?

Because as well as having the correct type, it must be assigned the address below.

 

<address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>

 

This is because OSX fails to detect network link unless we manually move the network card to a separate hardware IRQ line away from the AHCI/SATA controller.

 

Link to comment

I dont have onboard graphics. Can I pass-through my GPU in the primary slot 1?

 

Yes you can pass-through a GPU in your primary slot when you dont have onboard graphics. Nvidia cards need to have the rom file

passed through to the VM for this to work.

 

Things to read -

 

** VM forum guide by hupster

http://lime-technology.com/forum/index.php?topic=43644.msg452464#msg452464

 

Things to watch -

 

** VM Guide - How to passthrough an nvidia gpu as primary gpu in unRAID by gridrunner

 

 

forum link

 

  • Upvote 1
Link to comment

I have a VM with custom xml edits. Is there a way to use the GUI to make changes without loosing the custom edits?

 

Unfortunately with the unRAID VM manager you must be careful. You can view things in the VM manager, but any changes made with the GUI will remove custom xml edits.

 

There is a way around that. This is to use virt-manager as an alternative VM manager for use with your custom edited VMs.

 

Things to watch -

 

** VM Guide - How to connect virt-manager to unRAID to help manage your VMs by gridrunner

    forum post - http://lime-technology.com/forum/index.php?topic=53443.0

 

 

 

 

Link to comment

I passed-through my graphics card to a VM but now i cant see the unRAID console on my monitor. Why is this?

 

This is normal and to be expected. It only occurs when you pass-through the GPU that unRAID uses to display console (Primary).

You can still access the server by the web interface, telnet or ssh so really isn't a problem for most.

On reboot of the server, the console will return until that GPU is used in a VM again.

This does not occur if you pass-through a GPU that isn't used to display the unRAID console.

  • Like 1
Link to comment

Ok, so I have made a few VMs but how do I back them up?

 

Things to read -

 

** VM Forum guide -Automatic backup script by danioj  http://lime-technology.com/forum/index.php?topic=47986.0

 

Things to watch -

 

**  VM video guide - How to manually backup and restore unRAID VMs by gridrunner

 

 

** VM video guide - How to automatically backup unRAID VMs vdisks and xml files by gridrunner

 

 

  • Like 1
  • Upvote 1
Link to comment
  • 1 month later...

How do I pass through a USB controller so i can hotswap in my vm ?

 

Things to read -

 

** ***GUIDE*** Passthrough Entire PCI USB Controller by archedraft

http://lime-technology.com/forum/index.php?topic=36768.0   

 

Things to watch -

 

**VIDEO GUIDE** How to easily and safely pass through a USB controller **  by gridrunner

    Thread  http://lime-technology.com/forum/index.php?topic=54753

 

 

 

 

 

 

 

Link to comment

How can I pass through a physical Network controller to a VM?

 

Things to read -

 

** ***GUIDE*** Passing Through Network Controllers to unRAID 6 Virtual Machines by jonp

http://lime-technology.com/forum/index.php?topic=39638 

 

Things to watch -

 

**VIDEO GUIDE** How to isolate then pass-through a Network Controller in unRAID*  by gridrunner

Thread  http://lime-technology.com/forum/index.php?topic=54937.0

 

 

 

 

Link to comment
  • 2 weeks later...

How do I create a vdisk snapshot on a btrfs device?

 

There are two methods of creating instant copy/snapshot with btrfs, if it's a single file like a vdisk use the first one, if you want to snapshot an entire folder use the 2nd, e.g., I have all my VMs in the same folder/subvolume so with a single snapshot they are all backed up instantly.

 

Method 1 - Creating a reflink copy:

 

Simple way for making an instant copy of a vdisk creating a reflink copy, which is essentially a file-level snapshot:

 

cp --reflink /path/vdisk1.img /path/backup1.img

 

Requirements:

Both the source and destination file must use the same BTRFS volume, can be a single device or pool.

Copy-on-write on (enable by default)

 

 

Method 2 - Snapshot:

 

Btrfs can only snapshot a subvolume, so first thing we need to do is create one, example below uses the cache device, it can also be done on an unassigned device adjusting the paths.

 

btrfs subvolume create /mnt/cache/VMs

 

You can use any name you want for the subvolume, I use one for all my VMs.

 

The subvolume will look like a normal folder, so if it's a new VM create a new folder inside the subvolume with the vdisk (e.g: /mnt/cache/VMs/Win10/vdisk1.img), you can also move an existing vdisk there and edit the VM template.

 

Now you can create a snapshot at any time (including with the VM running, but although this works it's probably not recommended since the backup will be in a crash consistent state), to do that use:

 

btrfs subvolume snapshot /mnt/cache/VMs /mnt/cache/VMs_backup

 

If at any time you wanted to go back to an earlier snapshot, stop the VM, and move the snapshot or edit the VM and change the vdisk location to a snapshot.

 

To replace the vdisk with a snapshot:

 

mv /mnt/cache/VMs_backup/Win10/vdisk1.img /mnt/cache/VMs/Win10/vdisk1.img

 

or edit the VM and change vdisk path to confirm this is the one you want before moving it:

 

e.g., change from /mnt/cache/VMs/Win10/vdisk1.img to /mnt/cache/VMs_backup/Win10/vdisk1.img

 

Boot the VM, confirm this is the snapshot you want, shutdown and move it to the original location using the mv command above.

 

 

 

 

Using btrfs send/receive to make incremental backups:

 

Snapshots are very nice but they are not really a backup, because if there's a problem with the device (or even serious filesystem corruption) you'll lose your VMs and snapshots, using btrfs send/receive you can make very fast copies (except for the initial one) of you snapshots to another btrfs device (it can be an array device or an unassigned device).

 

Send/receive only works with read only snapshots, so they need to be created with -r option, e.g.:

 

btrfs subvolume snapshot -r /mnt/cache/VMs /mnt/cache/VMs_backup

 

Run sync to ensure that the snapshot has been written to disk:

 

sync

 

Now you can use send/receive to make a backup of the initial snapshot:

 

btrfs send /source/path | btrfs receive /destination/path

 

e.g.:

 

btrfs send /mnt/cache/VMs_backup | btrfs receive /mnt/disk1

 

no need to create destination subvolume, it will be automatically created.

 

Now for the incremental backups, say it's been some time since the initial snapshot so you'll do a new one:

 

btrfs subvolume snapshot -r /mnt/cache/VMs /mnt/cache/VMs_backup_01-Jan-2017

 

Run sync to ensure that the snapshot has been written to disk:

 

sync

 

Now we'll use both the initial and current snapshots for btrfs to send only the new data to the destination:

 

btrfs send -p /mnt/cache/VMs_backup /mnt/cache/VMs_backup_01-Jan-2017 | btrfs receive /mnt/disk1

 

A VMs_backup_01-Jan-2017 will be created on the destination but much faster than the initial copy, e.g., my incremental backup of 8 VMs took less than a minute.

 

 

 

 

A few extra observations:

 

To list all subvolumes/snapshots use:

 

btrfs subvolume list /mnt/cache

 

You can also delete older unneeded volumes/snapshots, e.g:

 

btrfs subvolume delete /mnt/cache/VMs_backup

 

To change a snapshot from read only to read/write use btrfs property, e.g.:

 

btrfs property set /mnt/cache/VMs_backup_01012017 ro false

 

 

A snapshot only uses the space required for the changes made to a subvolume, so you can have a 30GB vdisk and 10 snapshots using only a few MB of space if your vdisk is mostly static.

  • Like 3
  • Upvote 3
Link to comment
  • 3 months later...

How do I keep my sparse vdisk as small as possible?

How do enable trim on my Windows 8/10 or Windows Server 2012/2016 VM?

 

NOTE: according to this post by @aim60virtio devices also support discard on recent versions of qemu, so you just need to add the discard='unmap' option to the XML.

 

Still going to leave the older info here for now just in case.

 

 

 

By default vdisks are sparse, i.e., you can chose 30GB capacity but it will only allocate the actual required space and use more as required, you can see the current capacity vs allocated size by clicking on the VM name, problem is that over time as files are written and deleted, updates installed, etc, the vdisk grows and it doesn't recover from the deleted files.

 

This has two consequences, space is wasted and if the vdisk in on an SSD that unused space is not trimmed, it's possible to "re-sparsify" the vdisk e.g., by cping it to another file, but this it's not very practical and there's a better way.

 

You can use the vitio-scsi controller together with discard='unmap', this allows Windows 8/10 to detect the vdisk as "thin provisioned drive", and any files deleted on the vdisk are immediately recovered as free space on the host (might not work if the vdisk is on a HDD), and this also allows fstrim to then trim those now free sectors when the vdisk is on an SSD.

 

On an existing vdisk it's also possible to run Windows defrag to recover all unused space after changing to that controller.

 

Steps to change an existing Windows8/10 VM (also works for Windows Server 2012/2016):

 

1) First we need to install the SCSI controller, shutdown the VM (For Windows 8/10 I recommend disabling Windows fast Startup -> Control Panel\All Control Panel Items\Power Options\System Settings before shutdown, or else the VM might crash on first boot after changing the controller).

 

Then edit the VM in form mode (toggle between form and XML views is on the upper right side), and change an existing device other than your main vdisk or virtio driver cdrom to SCSI, for example your OS installation device if you still have it, if not you can also add a second small vdisk and chose SCSI as the vdisk bus, save changes

 

2) Start the VM and install the driver for the new "SCSI controller", look for it on the virtio driver ISO (e.g., vioscsi\w10)

 

3) Shutdown the VM, edit the VM again, again using the form view and change the main vdisk controller to "SCSI", now change view to XML and add "discard='unmap'" to the SCSI controller:

 

Add after cache='writeback', e.g. before:

 

Quote

    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>

      <source file='/mnt/cache/domains/Windows 10/vdisk1.img'/>

 

After:

 

Quote

    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback' discard='unmap'/>

      <source file='/mnt/cache/domains/Windows 10/vdisk1.img'/>

 

4) Start the VM (if you added a 2nd vdisk you can remove it now before starting), it's should boot normally, you can re-enable Windows fast startup.

 

5) Run Windows Defrag and Optimize drives, check that he disk is now detected as "Thin provisioned drive" and run optimize to recover all previous unused space.

 

From now on all deleted files on the vdisk should be immediately trimmed.

 

Note: If after this you edit the VM using the GUI editor these changes will be lost and will need to be redone.

 

  • Like 4
  • Thanks 4
  • Upvote 6
Link to comment
  • 1 year later...

Why do my remote share mappings fail after I updated UD?

 

The latest version of UD maps the remote shares to /mnt/remotes/.  You are encouraged to change your VM mappings to the new mount point.

 

If you can't do that, go the UD settings and set 'Legacy Mount Point Compatibility?' to 'Yes'.  Then unmount and re-mount the remote shares.  There will be symlinks created at /mnt/disks/ to the remote shares mounted at /mnt/remotes/.

Link to comment
  • 9 months later...

Why is my vdisk being detected as a HDD inside windows, when the file is on a SSD?

 

The default emulation for disks includes a setting that causes vdisk image files to be detected by the VM as rotational media. To override that, you must edit your XML.

 

Find this section

<disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback' discard='unmap'/>
      <source file='/mnt/user/domains/Windows 10/vdisk1.img'/>
      <target dev='hdc' bus='scsi'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
</disk>

and add rotation_rate='1' to the target dev line, like this

<disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback' discard='unmap'/>
      <source file='/mnt/user/domains/Windows 10/vdisk1.img'/>
      <target dev='hdc' bus='scsi' rotation_rate='1'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
</disk>

 

Thanks to ghost82 for this information!

Edited by JonathanM
Updated info
  • Thanks 1
Link to comment
  • 10 months later...

Why are some of the menus in the "Nvidia control panel" missing?

 

For those of you that do gpu passthrough with NVIDIA cards and pull your hair why half of the menus in the "Nvidia control panel" are missing. - problem that google didn't help at all.

I have the luck to have nvme passtrought and could boot baremetal so i could see that baremetal menus are visible so for them to be visible in vm put :
 

<kvm>
<hidden state='on'/>
</kvm>

in the "<features>" section of your xml.

 

 

 

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.