FAQ Feedback - for VM FAQ


RobJ

Recommended Posts

1 hour ago, bastl said:

@fluisterben If you have custom edits inside the xml for your network lets say changing the model of the emulated device, these changes will be lost if you change something else in the VM settings. Keep that in mind. As stated from itimpi increasing the vdisk size in the webui doesn't change the filesystem size inside the VM. You have to expand the partion inside the VM by yourself. Also to be mentioned and been documented in Unraids wiki, never decrease the vdisk size or you will break your VM if sectors of the vdisk are used by the VM and you cut them off. 

I have done nothing out of the ordinary with this VM, no xml editing, I don't even know where those xml files are located. Funny thing is: I tried expanding the disk size internally, but it needs network access to install the required apps for that to work. So yeah, catch 22 there.

Also; Is there a VNC access tool that actually copy pastes from and into the terminal window? The Remote VNC included with Unraid does not do that. Really annoying.

 

I tried the virt-manager docker in hopes to change network settings for the VM, installed it, but it doesn't connect to anything, doesn't prompt me to do anything, it's basically a tool for advanced users without proper docs. Must say I really expected more from Unraid and its VM Manager, or its plugins/apps.

Edited by fluisterben
Link to comment
3 hours ago, bastl said:

@fluisterben Try to create a fresh VM and point it at your existing vdisk.

Tried that, still no network access. Seems to be something inside the Ubuntu guest that causes the network to fail. I've just recreated an entire VM with the exact same properties, but starting with a larger disk, same problem.

 

I'll now create a new fresh VM, from scratch, and will check each step and see where it goes wrong. May be of interest to other users..

Link to comment

OK, figured out after which change network fails, as soon as I add a mount (fill in under the Edit VM setup);

 

Unraid Share:

Unraid Mount tag:

 

at next boot of the VM, network iface is down. After checking the XML, this is what it does;

    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/mnt/user/nxt/'/>
      <target dir='/nxt/'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </filesystem>
    <interface type='bridge'>
      <mac address='52:54:00:57:cb:d9'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>

note that it changed bus=0x01 into bus=0x03 for the network interface.

Changing that back to 0x01 for the network interface fixed network, but the mount does not seem to work when I change that bus to 0x03, or that may not be the reason, don't know yet.

Edited by fluisterben
  • Thanks 1
Link to comment

@fluisterben Check if this works for you 

 

I had no issues setting this up in a Mint VM. XML looks like the following

    <filesystem type='mount' accessmode='passthrough'>
      <source dir='/mnt/user/downloads/dl'/>
      <target dir='dl'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </filesystem>
    <interface type='bridge'>
      <mac address='52:54:00:e0:e7:31'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </interface>

 

Edited by bastl
Link to comment
  • 3 months later...
On 4/29/2017 at 8:03 AM, johnnie.black said:

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?

 

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 (doesn't matter if the vdisk is on an SSD or HDD) 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 (again both on an SSD or 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:

 

 

After:

 

 

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.

 

Do I need to add the discard='unmap' if I'm passing the physical disk to unraid?

Link to comment
  • trurl pinned this topic
  • 2 years later...

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.