Frantisek Rysanek <frantisek.rysa...@post.cz>

> Hi D,
>
> I'm not sure what exactly your goal is.
>
> Prevent the guest OS from realizing, that the HDD is of type
> "virtio"? In that case I'd look at how the hard drive is specified to
> qemu-system-x86_64. Or first of all, how the controller is specified.
> At the level of command-line args to qemu-system-x86_64, I'd focus on
> the options -machine. I haven't found an option to specify the IDE
> controller model to emulate - therefore, I'd suggest trying
>
> -machine pc
> or
> -machine q35
> see also
> -machine help
>
>
Since I am using RedHat family, I focus at q35 machine type (pc-i440fx is
no longer supported) and virtio-blk/virtio-scsi device.
take windows 10 as an example, it will identify the disk as "ssd"or "hard
disk" when installed on physical hardware.
It will identify qemu virtual disk as "thin provisioned disk"(with newer
virio-blk/virtio-scsi) driver. (old virtio driver will make windows think
the disk is a traditional hard disk).
Windows use NTFS and sometimes it needs defragment. the default weekly disk
optimization task will do "trim+ sometimes defragment" to ssd. and do
"defragment only" to hard disk.
I think "thin provisioned disk" is like "ssd" under windows.

Or, do you specifically want to prevent qemu from using the
> discard/trim feature?
> Why?
> It is generally useful.
> In bare metal SSD hardware, it saves the wear on your flash chips.
> In a Qemu VM, it allows Qemu to save storage space in the filesystem
> underlying your image file by using a so called "sparse" image file.
> Which in turn can save space in backups.
>
>
trim is useful for ssd and sparse image file and I am using it. but for
hard disk I don't want extra layers to slow it down. so I use
thick-provisiond lvm device for vm disk backend.
trim is bad for the situation. in fact my vm may have both ssd backend and
hard disk backend. I don't care much at linux. but they need different
optimization method under windows. I can manually setup defrag job for it
(although some windows versions didn't allow defrag for thin device) . it
is best if I can set it correctly at hypervisor level so the upper layer os
can handle it automatically.

Thanks a lot for your help!

Reply via email to