2

As part of my coursework I need to show some evidence (screen shot) of myself defragmenting a computer. Since I missed out doing it at college, I need to do it at home. This requires me to use a Windows virtual machine since I have a Mac (needs to be Windows).

Is it safe for me to defrag a virtual machine where the host is a SSD? The reason why I am asking this is because I've heard that you shouldn't defrag SSDs.

6
  • The advice not to defrag SSDs to avoid harm is ancient and obsolete. It will do almost no good on a modern SSD, but it won't do any significant harm either. (The main reason to defrag an HD was to reduce latency. Defragging won't affect latency on an SSD. But it will slightly reduce the number of I/Os needed to read/write, which can provide some benefit in IOPS-limited workloads.) Commented Dec 23, 2015 at 21:13
  • @DavidSchwartz So is it still safe to defrag a VM with the host using a SSD?
    – iProgram
    Commented Dec 23, 2015 at 22:05
  • Yes you can do that. The defrag saga for SSDs means that it is a useless exercise to defrag an SSD because the access time to any point on the SSD is the same and you gain nothing with a defrag - you don't lose anything either.
    – whs
    Commented Dec 23, 2015 at 22:16
  • 1
    @whs It's not true that you gain nothing. Many SSD operations are IOPS limited, and accessing contiguous data takes fewer I/Os than accessing discontiguous data. Commented Dec 23, 2015 at 22:58
  • Now you are slicing it awfully thin. I deal only with real cases.
    – whs
    Commented Dec 24, 2015 at 0:51

3 Answers 3

2

It is safe. It doesn't damage the VM, nor the SSD, unless you it do a thousand times.

I do it often, to be able to reduce the file size of the virtual machine afterwards, so backups don't take hours, and for that you need to Defrag and then sdelete.

2
  • Do you mean SSD? Hard Drives are magnetic.
    – iProgram
    Commented Dec 23, 2015 at 22:47
  • 1
    yes, on an SSD. For me the term 'hard disk' meant any kind of disk
    – Aganju
    Commented Dec 23, 2015 at 22:48
0

The short answer is Yes. The long answer is that it doesn't matter because it's a virtual disk, not a real one, on top of a filesystem on top of an SSD. In this case, you are modifying a file which is being modified either way by simply turning on the VM.

The only reason I would think of for saying you shouldn't defrag an SSD is because of all the data movement that comes along with it. SSDs tend to make use of all the space because there is a specific number of time you can write to each bit. Defragmenting will move a lot of data around using the SSD sectors.

8
  • That's what I thought. Just wanted to check. Thanks.
    – iProgram
    Commented Dec 23, 2015 at 21:03
  • 1
    Do you understand why they say don't defrag on SSD ?
    – Digisec
    Commented Dec 23, 2015 at 21:04
  • 2
    You can rewrite every single byte on a typical modern SSD once a week for three years. Commented Dec 23, 2015 at 21:20
  • 1
    The reason people say SSD don't need to be defragged is because there are no moving parts and every part of the SSD takes the same amount of time to access. Also the access time is typically <1ms(0.1ms on good drives) vs 9-14ms for a hdd so fragments are less noticeable. 1000 frags on a ssd is 1000*0.1 or 100ms, on a hdd 1000*9 is 9000. However, a SSD can still benefit from a defrag, but unless your drive is horribly fragged benefits are really small. I would do it once a year.
    – cybernard
    Commented Dec 23, 2015 at 21:45
  • 1
    @iProgram Absolutely. You can even defrag a modern SSD every month if you want to. It won't help very much at all, but it won't hurt very much either. Commented Dec 23, 2015 at 22:59
0

I know this is an old article but I feel it's important as it isn't clear and can be miss leading. They say never try to defrag an SSD. Defragmenting the drive writes and rewrites data, which can age your SSD faster. So technically it is harming the disk, but only by extra use, which shortens the life span for the disk. Modern SSDs have a similar life to HDDs now, but let's not shorten the life for no benifits.

SSD's do not store data the same way as HDD, and therefore it does not need to be defragged and performance will not be improved. VMs use the same disk so it inherits the lack of need for that to be defragged also.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .