Question regarding QEMU using Physical SSD drive

Hi, so in short, I’m unsure on how to go about using a physical SSD I have (not mounted, previous windows install on it) in my VM. Tried to search but my google fu was not strong.

Also is it better to use a .raw image stored on an ssd or just use the ssd itself? not sure how it works. Thanks for any input!

I use the SSD itself.

    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='threads' discard='unmap'/>
      <source dev='/dev/sda'/>
      <target dev='vda' bus='virtio'/>
      <boot order='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

EDIT: This allows you to also boot the machine from this drive if you wanted to since all the partitions are available.

1 Like

Be aware that this doesn’t tell the guest OS that it’s a SSD, it sees a VirtIO device and as such may not use TRIM.

1 Like

You’re correct, I don’t think it recognizes the TRIM. I couldn’t find a way to balance TRIM and being able to boot into it natively, all the things I could find about keeping TRIM called for a qcow2 image and using virtio-scsi. I think you can add discard=‘unmap’ to the driver line but I’m not entirely sure if that will cover it, I’d have to try it out. here you go. this should work. I did have to format the drive, not a big deal to reinstall for me

I want to bump this thread and see if this is still relevant?

Had some issues playing w/ virtmanager settings last night

1 Like

where is this file located?

1 Like