Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SSD trim command in VM, help, please

Featured Replies

How does Unraid handle SSD TRIM when SSD drive is passed to VM entirely?

I am not talking about passing an entire SATA controller to Ubuntu 18.04 VM, but the disk itself "/Dev/disk/by-id/ata-XXXXXX. In this case SSD will be presented as some virtual disk "VDA". Is TRIM gonna be handled in host or guest OS?

Planning on purchasing Samsung 860 EVO BTW.

Open to any suggestions, even using vdisks too, all I need is to make sure TRIM command will be working correctly.

Thank you!!

  • Author

Bumped. Was wondering @johnnie.black if you could help me with this question above? 

I saw you posts regarding the vdisks and TRIM in Windows 7, but I am passing the disk itself entirely to Ubuntu VM (posted my question above), not the controller, just a disk itself. 

 

Thank you!! 

  • Community Expert

Sorry, no idea.

  • Author
3 hours ago, johnnie.black said:

Sorry, no idea.

Thank you anyway!! 

  • Author

Bumped. Anybody? Please 

   I honestly have no idea, but I would hazard my guess on the answer being, it is the guest OS that will do the TRIM. Such that  guestOS sends TIRM, passed to SATA (guestOS), which is passed through to host sata layer, which gives it to block device and ultimately the drive's own internal logic does trim. Only the guestOS is going to be aware of the unused blocks and issue the addresses to clear.  

 

 

  • Author
On 7/5/2018 at 9:58 PM, Jcloud said:

   I honestly have no idea, but I would hazard my guess on the answer being, it is the guest OS that will do the TRIM. Such that  guestOS sends TIRM, passed to SATA (guestOS), which is passed through to host sata layer, which gives it to block device and ultimately the drive's own internal logic does trim. Only the guestOS is going to be aware of the unused blocks and issue the addresses to clear.  

 

 

 

That's what's I figured, gotta do some testing to see if it works, these are just assumptions for now, will post results later. 

 

Thank you!! 

If you pass the controller to the VM, then the VM will know it's a SSD and can directly perform trim.

 

If you only pass the drive, then the OS will normally not perform trim because it doesn't understand that it's a SSD. The whole idea with VM is to virtualize the hardware allowing you to switch to different hardware without the VM knowing about it.


The only thing I have seen earlier is that it's possible to configure the image file to be underprovisioned, and have the VM sends trim so unused parts of the image file can be returned. But I'm not sure if this would be applicable if running directly on a SSD, and if the SSD will see any trim requests.

  • Author
On 7/9/2018 at 9:46 AM, pwm said:

If you pass the controller to the VM, then the VM will know it's a SSD and can directly perform trim.

 

If you only pass the drive, then the OS will normally not perform trim because it doesn't understand that it's a SSD. The whole idea with VM is to virtualize the hardware allowing you to switch to different hardware without the VM knowing about it.


The only thing I have seen earlier is that it's possible to configure the image file to be underprovisioned, and have the VM sends trim so unused parts of the image file can be returned. But I'm not sure if this would be applicable if running directly on a SSD, and if the SSD will see any trim requests.

Exactly, I can't pass the controller unfortunately, I have 4 SATA ports on MB with single controller, passing an entire controller means, passing all my drives. I can possibly use my SATA expansion card to pass it to the VM, it will solve the problem. 

VM image is another issue, I have seen some posts regarding TRIM command inside of VM and how to set it up to make sure VM reports unused space to host. 

 

Good post (although a little unrelated) link 

edit:

 

I thought you would be interested in this article link https://serverfault.com/questions/896448/qemu-trim-and-discard-on-a-physical-ssd-device

 

It's pertinent to my issue, too bad I am no longer interested in this option anymore, I am not gonna be able to test it as of this moment. Ended up passing the entire controller by adding a dedicated PCI SATA HBA card to the motherboard. 

 

Thank you anyway!!!

Edited by pervin_1

  • 5 months later...

@pervin_1 So were you able to get TRIM working on the SSD by passing through the entire controller? I want to do this for my M.2 PCI nvme drive and run OSX on it, but want to make sure TRIM will work, if not i think the drive will come to a crawl after heavy months of use...

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.