marking a virtual disk as SSD: what it do?

This is for discussing general topics about how to use VirtualBox.
Post Reply
piggyz
Posts: 70
Joined: 13. Feb 2013, 12:28

marking a virtual disk as SSD: what it do?

Post by piggyz »

Like in the subject, boviously related with the guests configuration. If you do that in VMware under Windows guests, you can install special driver to take advantage of it. What happen in Virtualbox? And what happen if that SSD is a NVME drive? It doesn't seem to exist any VIrtualbox special driver for SSD and/or Virtualbox guest support.

So, marking a virtual disk as an SSD in Virtualbox, it is usefull for what? And should it be done, obviously admitting you really run the guest from an SSD drive (and you should becouse this is an ENORMOUS IMPROVEMENT in performace)?
Rootman
Posts: 251
Joined: 1. Oct 2012, 18:29

Re: marking a virtual disk as SSD: what it do?

Post by Rootman »

Marking it as an SSD simply tells the OS that it is, so that it can implement the SSD TRIM command if it supports it ( https://en.wikipedia.org/wiki/Trim_(computing) ).

It provides no performance enhancement per say, it simply allows the OS to do trimming.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: marking a virtual disk as SSD: what it do?

Post by mpack »

That's correct, so I'm struggling to see why VMWare would require a driver in the guest to support this function. Trimming is a function of the drive controller, not an OS driver. Unless the driver is intended for legacy guests that don't know about TRIM... but I'd think that would violate too many assumptions in such a guest.

If you want the performance of an SSD you simply locate the VM on an SSD, simple as that. Trim being an optional extra. Marking a VDI as SSD when it's not located on an SSD will not improve performance. Potentially it could decrease performance if it causes image blocks to be shuffled, causing extra seek latencies.
piggyz
Posts: 70
Joined: 13. Feb 2013, 12:28

Re: marking a virtual disk as SSD: what it do?

Post by piggyz »

Rootman wrote:Marking it as an SSD simply tells the OS that it is, so that it can implement the SSD TRIM command if it supports it ( https://en.wikipedia.org/wiki/Trim_(computing) ).

It provides no performance enhancement per say, it simply allows the OS to do trimming.
Yep I know about the TRIM. Then, in some of my quick testing, it seems it is not really available in guest mode on machines with my fav ext4 file systems.

It seems you need something different from zero in this command to be able to activate TRIM:
NAME   DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
sda           0        0B       0B         0
├─sda1        0        0B       0B         0
└─sda2        0        0B       0B         0
sr0           0        0B       0B         0
It is supposed this command will prepare file system for TRIM, then it do not work at all in my case:
tune2fs -o discard /dev/sda1
It doesn't prepare anything for me.

So activating the TRIM via fstab with something like this command:
/dev/sda1               /               ext4            defaults,discard   0  1
doesn't help at all.

Now I'm curious if some user here on this forum was able to get TRIM in virtual linux guest.
Last edited by socratis on 26. Apr 2019, 07:13, edited 1 time in total.
Reason: Enclosed the information in [quote][pre] tags for better readability
Post Reply