How a large virtual machine disk affects SSD life time

16,610

Solution 1

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.

Solution 2

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.

Share:
16,610

Related videos on Youtube

Matías Fidemraizer
Author by

Matías Fidemraizer

I define myself as a passionate software guy. From a young age I have always looked forward to new technologies. I have seen first-hand how the Internet has grown and evolved. From plain hypertext to the internet of services and cloud computing. I grew up along with the Internet, I have been learning Web tech and programming for more than 15 years. I am self-taught but an enthusiast and big fan of Computer Science, this has led me to learn and challenge myself every day. I understand Software as more than just code, it is creativity and innovation and a great opportunity to share knowledge with other professionals. After all, the tool does not make the professional. My principle is "enthusiasts do great things". A tool is just a possible expression of some valid solution to get things done right! What am I looking for? I am committed to grow, share, build, create and innovate. At the end of the day, to learn and enjoy.

Updated on September 18, 2022

Comments

  • Matías Fidemraizer
    Matías Fidemraizer over 1 year

    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.

    • AFH
      AFH over 9 years
      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.
    • Matías Fidemraizer
      Matías Fidemraizer over 9 years
      @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.
    • QMaster
      QMaster almost 6 years
      Read this maybe useful: forums.macrumors.com/threads/…
  • Matías Fidemraizer
    Matías Fidemraizer over 9 years
    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...)...
  • Admin
    Admin over 9 years
    @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.
  • Matías Fidemraizer
    Matías Fidemraizer over 9 years
    @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
    Matías Fidemraizer over 9 years
    I've opened another question about this other concern: superuser.com/questions/811663/…
  • Admin
    Admin over 9 years
    @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.
  • Matías Fidemraizer
    Matías Fidemraizer over 9 years
    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
    Matías Fidemraizer over 9 years
    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...
  • Kamil
    Kamil over 9 years
    @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.
  • Jaime Hablutzel
    Jaime Hablutzel over 5 years
    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?.