Add virtio-scsi as an option for vdisk bus


Recommended Posts

Using virtio-scsi together with discard='unmap' allows the vdisk to keep its "sparseness", i.e., Windows 8/10 detects the storage as thin provisioned and space is recovered immediately when a file is deleted on the vidisk, allowing the vdisk to remain as small as possible and for those sectors to be trimmed by fstrim when using the vdisk on an SSD.

 

After changing to that controller it's also possible to run defrag to recover all unused space.

 

It's now possible to add the virtio-scsi controller and change the bus by editing the XML but changes will be lost in any futures edits with the VM editor.

 

 

thin.png

before.png

after.png

Edited by johnnie.black
Link to comment
21 minutes ago, bonienl said:

Can you show where exactly "discard='unmap'" is added in the XML file?

 

 

 <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback' discard='unmap'/>
      <source file='/mnt/disks/840EVO/VMs2/Win10/vdisk1.img'/>
      <target dev='hdc' bus='scsi'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

And you need to add the controller:

 

    <controller type='scsi' index='0' model='virtio-scsi'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </controller>

 

  • Upvote 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.