How a large virtual machine disk affects SSD life time

5

2

I've an interesting doubt. Since virtual machines create a file that represents a hard disk - the so-called virtual disk -, and it usually takes 20-40GB (and even more), how does this affect a solid-state disk (SSD) life time?

For example, in my case I'm using VirtualBox latest version and since some more-than-a-year version, VirtualBox supports marking virtual hard disks as SSD in order to let guest operating system (i.e. Windows 7 and above) detect the whole disk as SSD and optimize the OS to work better with SSD pros and cons.

My virtual machine is a Windows 7 virtual development environment with Visual Studio and I rarely do intensive write operations. Well, saving code files when I edit them... But these are small writes.

The actual question is how virtualization software systems treat these big virtual disk files. I guess that a write in the guest machine is treated the same way as a write in the host machine, and a virtual machine doesn't shrinks SSD life-time more than a host OS, if I use virtual machines in the same way as host OSes.

Matías Fidemraizer

Posted 2014-09-14T16:54:47.407

Reputation: 259

You will need to make sure that the necessarily reduced memory in the virtual machine does not cause a lot of swapping, as this will certainly reduce the SSD life, since all reads and writes are in the same area of disc. – AFH – 2014-09-14T17:31:18.960

@AFH Ah yeah, I see. VM has 4GB of RAM and I'm never using more than 2-2,5GB. Host machine has other 4GB (8GB of total physical RAM memory). It seems that swapping concern should be an issue in my case. Thanks for this suggestion. – Matías Fidemraizer – 2014-09-14T17:45:55.170

Answers

2

Your assumption is mostly correct, a write on the VM's disk equals a write on the physical disk, even though there are many different virtual disk formats and the answer will be different for each one of them, I'm pretty sure some formats implement caching which can lower the number of writes on the physical disk.

The important part is that you shouldn't do in the VM anything that you wouldn't do on your real machine, that includes defragmentation, etc... that's actually why there is an option to mark a drive as an SSD in most virtualization software, so that guest OSes will disable such features that are harmful to SSDs.

Note that TRIM in virtual machines has no effect but isn't dangerous or harmful in any way, the virtual storage controller will just ignore the discard commands sent by the guest OS.

user256743

Posted 2014-09-14T16:54:47.407

Reputation:

I see! My main concern - which is unrelated to how VM works with SSD - is I assume I shouldn't save VM state to restore it whenever I want to develop, situation I really hate, because I don't want to open Visual Studio, Web Browser, some Redis DB and a DNS server whenever I want to start my development session... I want to investigate if I can store VM state in another drive or even a pen drive (because I don't care if I lose a VM state because that pendrive gets too many writes and it ends its life...)... – Matías Fidemraizer – 2014-09-14T17:49:25.657

@MatíasFidemraizer A pen drive or even a standard HDD would probably take longer to load the VM's state than just booting it from the SSD. – None – 2014-09-14T17:51:24.513

@AndréDaneil Yeah, but I prefer to wait 4 minutes in an unattended way than having to open everything step by step, which might be slower than loading the state from a pendrive lol – Matías Fidemraizer – 2014-09-14T17:53:14.327

I've opened another question about this other concern: http://superuser.com/questions/811663/how-to-change-where-virtualbox-stores-virtual-machine-state-when-closing-it

– Matías Fidemraizer – 2014-09-14T18:00:44.897

@MatíasFidemraizer what about putting everything you need in the Startup folder of the start menu and turning on auto login ? That way the VM boots and start everything you need without manual intervention. – None – 2014-09-14T18:03:03.777

This wouldn't be possible, or maybe it could be achieved this way, but I would lose my last session state (files I had already opened), which is interesting, because you remember what you did last day with ease – Matías Fidemraizer – 2014-09-14T18:04:46.250

I'm trying-out the external drive approach with a SD card, and it's taking a long time... argh, maybe a USB3 drive might work for this... – Matías Fidemraizer – 2014-09-14T18:20:12.507

@MatíasFidemraizer Just try fast SD card (like Kingston SDCA10 card) with good quality reader (like Kingston MobileLite G4 3.0). Many cheap card readers are horribly slow (1-3MB/s), no matter if you are using fast or slow card. – Kamil – 2014-11-23T22:37:31.067

a write on the VM's disk equals a write on the physical disk. Can you refer an authoritative source on this?, for example, when applied to the common .vdi format?. – Jaime Hablutzel – 2019-01-05T21:43:38.473

1

You can experiment with that.

Many (or maybe all?) SSD drives have counter of written data in SMART.

You can use some tool like CrystalDiskInfo, Intel SSD Toolbox (for Intel SSDs) and see how "host writes" attribute changes.

Kamil

Posted 2014-09-14T16:54:47.407

Reputation: 2 524