transform virtio-blk to scsi-virtio

Afox

Renowned Member
Dec 18, 2014
257
12
83
Hello,
I just realized I can´t use the discard option with my virtio block device and want to "transform" the storage to a SCSI-virtio device.

Is there a painless and save way to do this?

Thanks in advance,

Afox
 
on Windows it gives me bluescreen(s). Is there a special way I need to do it there?

Edit:
I made it work as follows:
  1. shutdown the VM and add an extra SCSI-virtio drive
  2. boot the VM and install the driver (device manager)
  3. shutdown the VM and remove the extra drive
  4. change the desired drive to SCSI-virtio and start again
 
Last edited:
  • Like
Reactions: ozgurerdogan
I have another phenomenon that exist with a newly created VM.
On install it recognized the "old" virtio drive as /dev/vdX. Now, when I change to SCSI-virtio, it gets somehow changed to /dev/sdX and does not boot anymore because it can´t find the /dev/vdX device.
 
somehow it is hardcoded in the grub bootloader. I am not quite sure how to fix this.

Edit: It turns out running
Code:
update-grub
did the trick before changing the device. Then the hardcoded device became an UUID.

If it is too late to do this, reboot the VM and press "E" to edit the grub options manually. Change the device name (e.g. /dev/vdX to /dev/sdX) manually and then log in and run the command above.

if you don´t know how the device got renamed, use the initramfs-shell you got stuck in and run
Code:
blkid
to find out the new name.
 
Last edited:
it is Debian 9 and what I read it is not recommended to edit the grub.cfg file manually. update-grub did the trick so far :)
 
ok, thank you :)
meanwhile I also changed a Windows 7 guest, enabled the discard option, got a "0" when running
fsutil behavior query DisableDeleteNotify
but still am not sure if it is working and how to run it (TRIM) once manually.

I found a command for PowerShell but it does not seem to be working for Windows 7:
Code:
Optimize-Volume -DriveLetter C -ReTrim -Verbose
It gives me a CommandNotFoundException.
 
ok, thank you :)
meanwhile I also changed a Windows 7 guest, enabled the discard option, got a "0" when running

but still am not sure if it is working and how to run it (TRIM) once manually.

I found a command for PowerShell but it does not seem to be working for Windows 7:
Code:
Optimize-Volume -DriveLetter C -ReTrim -Verbose
It gives me a CommandNotFoundException.

it's only supported since win8/2012. (maybe 8.1,2012r2)

(you also have a gui, "optimize disk")
 
is there nevertheless any way to make trim work on Windows 7? Because on my Guest it doesn´t look like the drive is even recognized as SSD which in consequence does not enable TRIM.
I tested with this tool: https://github.com/CyberShadow/trimcheck
 
Last edited:
Too bad, no. Windows 7 supports discard only with s-ata trim Command, which is not supported in qemu sata.

The SCSI unmap Command is only supported with Windows 8 and newer versions.

I searched for Utilities, but with no success. There is One from VMware, but it had no Effect with virtio-scsi. It probably needs some special features from VMware. There was one from EMC but development has ceased 2013 and is not anymore available even with an EMC contract.

If somebody knows an working Utility, i would be glad, as I have some win7 as well as some win 2008r2 vm's.
 
did you make a backup before and after? for me it noticably reduced the backup size.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!