Anybody defrag their SSD?

Executioner

Limp Gawd
Joined
Apr 22, 2015
Messages
506
I know you are not suppose to defrag SSD's, but I was having sluggish performance from mine. I checked using windows 7 defrag tool, and it stated it was fragmented by 40%. So I figure what the hey. Afterwards, it ran just like it did the first time I installed it.

I know that the SSD Trim is enabled as I checked it with some utilities. The only issue I have is with the windows 7 gadgets. After the defrag, then don't load automatically anymore due to how fast it boots to the desktop. I get them to load by simply right clicking on the desktop and select gadgets, and then they show up but not at boot up.

I did find a batch file that I found on the net that delays the start until the desktop is fully displayed.
 

Rav3n

Gawd
Joined
Jul 24, 2014
Messages
1,013
Still not a good idea. And I doubt it actually did anything. Defragging a spinning drive physically moved the files closer together for faster access time. A SSD would not benefit from the files being "physically" closer together. Sounds like a mind over matter situation.
 

Daeyx

Weaksauce
Joined
Feb 28, 2012
Messages
72
Still not a good idea. And I doubt it actually did anything. Defragging a spinning drive physically moved the files closer together for faster access time. A SSD would not benefit from the files being "physically" closer together. Sounds like a mind over matter situation.

This 100%.
 

SomeGuy133

2[H]4U
Joined
Apr 12, 2015
Messages
3,447
there is some benefit to defragging an SSD but only in extreme cases and if you don't know it will help you than you probably don't have one of those cases.

Main cases where defrag helps (IIRC correctly) is if all your requests are sequential so if your SSD simply servers sequential requests so like a file server or a media server defragging may help in CERTAIN cases but this is extremely rare and if this affects you, you will know whether or not it is an issue and the issue only exists with massive fragmentation. You would be hard press to make enough fragmentation that would warrant a defrag but again this is why i say you would know if it was an issue or not.

Please someone correct me if I am mistaken but IIRC correctly that was one of the major cases where defragmenting was beneficial because your removing the 4K and 512K seek times(random)...similar to regular HDDs but SSDs don't have 100-200x penalty for random reads that HDDs do. Their penalty is only 2-15x. That's if I did the math right in my head.

There is only one program that can safely defrag that I can recall and it was perfectdisk.
 
Last edited:

dragonstongue

2[H]4U
Joined
Nov 18, 2008
Messages
3,162
wonder how full the SSD was? are you sure that background garbage collection and all that stuff didnt just "kick in" cause I have yet to see either of my 2 SSD get above 0%, even my spinning HDD most I ever seen so far was 4% on a 3 year old drive, then again with SSD I leave a min 20% space, defrag shouldnt help SSD at all, unless for some reason it kicked in the TRIM that was sitting "dormant" which again begs question how full was your SSD?
 

Seithennin

Limp Gawd
Joined
Jul 30, 2008
Messages
317
SSD's Do Not need to be defragged. Defragging can reduce the lifespan of your SSD.
Defragmenting is for mechanical drives only, to move data into contiguous areas.
 

Epic|

Limp Gawd
Joined
Mar 20, 2010
Messages
457
While it's a futile gesture the worry about wearing out your drive from an occasional defrag amounts to a fart in the wind.
 

SomeGuy133

2[H]4U
Joined
Apr 12, 2015
Messages
3,447
While it's a futile gesture the worry about wearing out your drive from an occasional defrag amounts to a fart in the wind.

a defrag can waste more then a fill disk write depending on how it is done so that can as much as 5% of an SSDs warranty.
 

Nenu

[H]ardened
Joined
Apr 28, 2007
Messages
19,956
Fragmentation on an SSD isnt usually a problem because there is no head to move when data is located in different places. One address is pretty much as quick to access as another.
There can be a small performance drop if each block only contains a small amount of data, then data access requests may saturate the time the SSDs is in use. But the law of averages says this wont be something that happens a lot.
I suggest the problem lies elsewhere.

Most likely the blocks you wish to write to have not been cleared in time so you are having to wait for them to be cleared.
TRIM should sort this most of the time but if it has enough backlog, it might not be able to complete before the space is needed.
This can happen when you are low on space or are writing huge amounts of data.
Background wear management can also spring into action and interfere with drive availability.

Its not sensible to run an OS SSD with very little space left as the few free cells will get a much higher write rate.
The wear management algorithms may be able to prevent this becoming a drive fail issue but these take time to move data around and could cause the problem you are having.

Solution:
Leave more space free on the OS drive and/or allocate part of the drive as unused.
I have reserved free space on my Samsung 840 Pro for this exact reason because system restore backups can quickly fill the OS partition.
The reserved space shows up as approx 24GB of unused space on the drive in drive manager.
Any newish SSD can have space reserved to help with drive wear by leaving some space unused.

SSDs already have some free scratch space. Just make this a bit bigger by leaving part of the SSD unpartitioned/unused.
 

SomeGuy133

2[H]4U
Joined
Apr 12, 2015
Messages
3,447
Fragmentation on an SSD isnt usually a problem because there is no head to move when data is located in different places. One address is pretty much as quick to access as another.
There can be a small performance drop if each block only contains a small amount of data, then data access requests may saturate the time the SSDs is in use. But the law of averages says this wont be something that happens a lot.
I suggest the problem lies elsewhere.

Most likely the blocks you wish to write to have not been cleared in time so you are having to wait for them to be cleared.
TRIM should sort this most of the time but if it has enough backlog, it might not be able to complete before the space is needed.
This can happen when you are low on space or are writing huge amounts of data.
Background wear management can also spring into action and interfere with drive availability.

Its not sensible to run an OS SSD with very little space left as the few free cells will get a much higher write rate.
The wear management algorithms may be able to prevent this becoming a drive fail issue but these take time to move data around and could cause the problem you are having.

Solution:
Leave more space free on the OS drive and/or allocate part of the drive as unused.
I have reserved free space on my Samsung 840 Pro for this exact reason because system restore backups can quickly fill the OS partition.
The reserved space shows up as approx 24GB of unused space on the drive in drive manager.
Any newish SSD can have space reserved to help with drive wear by leaving some space unused.

pretty much. Basically what he was referring to was the endurance wall you hit when you reach true steady state. To make this take longer you need to OP the drive. I generally do 25% but I do a lot of reads and writes.
 

Nenu

[H]ardened
Joined
Apr 28, 2007
Messages
19,956
I think he made a valid observation but the reasons behind it were not known.
The defrag caused all the backlogged cell clears to be processed.
Then he no longer had to wait for the SSD to perform background processing when he wanted to use the drive.

As has been stated, defragging an SSD will cause excess wear that is avoidable.
 
D

Deleted member 126051

Guest
People who defrag SSDs go to The Special Hell.

88549-Firefly-special-hell-gif-Imgur-XyWz.gif
 

zrav

Limp Gawd
Joined
Sep 22, 2011
Messages
181
On modern SSDs there is no correlation between data that appears to be logically organized in a certain way (in sequence, for instance) and to how it is actually stored on the SSD flash. The SSD controller transparently performs mapping from the logical blocks to physical pages considering a number of factors, wear leveling being one of them, also intentionally spreading data between all flash packages for performance gains. Factors that an OS or filesystem is completely oblivious to. Thus, a filesystem defrag makes no sense.
TRIMing or secure erasing an SSD is all the beneficial maintenance a user could do, apart from setting a reasonable over provisioning area as has been mentioned.
 

GotNoRice

[H]F Junkie
Joined
Jul 11, 2001
Messages
10,608
Most new defrag tools will just preform a TRIM optimization on the SSD instead if you try to defrag it. I think that started with Windows 8 though.
 

Executioner

Limp Gawd
Joined
Apr 22, 2015
Messages
506
People who defrag SSDs go to The Special Hell.

88549-Firefly-special-hell-gif-Imgur-XyWz.gif
Oh no I'm going to hell (probably for other reasons).

Thanks for all the replies. My drive was not full. It's a 250 gig and I had 120 free. I've noticed in windows 8 that you can invoke trim, which runs and takes about 15 or 20 seconds. I don't see this with windows 7.
 

cyclone3d

[H]F Junkie
Joined
Aug 16, 2004
Messages
14,722
Yes, I defrag SSDs every once in a while. Much less than I did HDDs, but that is because fragmentation on an SSD doesn't drop the performance as much on an SSD as it does on an HDD.

My observations of before/after defragmenting SSDs is that sometimes it can help a lot and other times it doesn't seem to help that much. Slow boot times can turn into fast boot times if the drive is really fragmented.

I think the main issue with SSDs and Windows 7 slowing down is how Windows 7 handles the file system. Just because the SSD itself doesn't care if the files are fragmented (to a point), it doesn't mean that Windows doesn't think that it has to do extra calculations in order to do non-sequential reads.

It could also have to do with the specific SSD.

I mean, look at the reviews and their benchmarks. If an SSD read/wrote at the same speed no matter what, the benchmarks would show the same exact speed for every single test.

But that is not the case. Being able to do a lot fewer sequential reads is of course going to be faster than everything being fragmented all over the place and having to do tons of non-sequential reads.

I have personally seen on an SSD, where the drive has become so fragmented that Windows starts acting up. Much the same with what happens when a HDD is super fragmented.

And degfragging an SSD every once in a while is not going to put near as much wear on a drive as leaving hibernate enabled will.
 

Rav3n

Gawd
Joined
Jul 24, 2014
Messages
1,013
a defrag can waste more then a fill disk write depending on how it is done so that can as much as 5% of an SSDs warranty.

SSD's to my knowledge are not based on R/W. They are soley based on time. ;) So unless this SSD is a time machine, I think his warranty is fine
 

dragonstongue

2[H]4U
Joined
Nov 18, 2008
Messages
3,162
SSD are not "time" based, they ARE write cycles which are P/E or program erase, which to my understanding is a cell needs to be clear before it can be erased erased or programming a cell "writes" to it, the same can be said with "defragging" is as to do so, theory, you are telling drive to move from chip/sector X to Y instead in HDD case no big deal in SSD case it could burn ALOT of cycles depending on how often it is done, how deep it does it etc.

I think the problem might be the drive itself? the firmware used on said said drive, the way it is use (to little capacity left so it simply cannot do a proper TRIM) possibly the drive is not being left passive often enough as I am not sure with ALL drives as there are so many of them but I thought for TRIM and BGC to work a drive has to not be being used or whatever, so if my theory holds then it could be the drive in OP case either to damn full :p or maybe some things are just keeping it to active constantly so it simply does not have time to do its thing.

Not being used in a RAID style? I know there are quite a few that will not do TRIM BGC when RAID style. So many variables might be worth digging for some of these things, as an SSD controller to my mind should not allow it to "fragment" as bits and pieces can be effectively everywhere on the drive and it simply should not matter unlike a regular HDD where it most certainly does.

Another thought, what was the sector format when you "made" the OS partition, 512byte, 4k etc? and AHCI of course?
 

SomeGuy133

2[H]4U
Joined
Apr 12, 2015
Messages
3,447
SSD's to my knowledge are not based on R/W. They are soley based on time. ;) So unless this SSD is a time machine, I think his warranty is fine

every SSD has a TBW warranty and a time warranty. The 950 Pro 512GB has a nice 400 TB TBW warranty while the 1.2 Tb intel has 219 TB TBW...wtf. Thats why I refused to bother with the 750. A single filling of the drive can equal .5% or more of TBW -_-

Sorry it was .5% not 5% but still it is a crap ton of wear.
 

Executioner

Limp Gawd
Joined
Apr 22, 2015
Messages
506
On my desktop that I use out in the garage, I had to perform an erase using the mfg's utility, as the system was so slow and would hang. I was going to send the drive back, but the tech told me to erase it with the utility he sent me. Took about 10 seconds to wipe it. I reinstalled my image from a month ago and all is well again with that system.
At first, I thought it was something else going bad like a video card or memory, but those checked out okay.
 

CaptNumbNutz

Fully [H]
Joined
Apr 11, 2007
Messages
22,821
Most new defrag tools will just preform a TRIM optimization on the SSD instead if you try to defrag it. I think that started with Windows 8 though.
That's what I'm thinking. OP said he uses Win7. I could have sworn Win7 still labeled it Defrag even though it only did TRIM on the SSD. If that's the case it would explain a performance bump.

I'm certain that this is not the case with Win8 and Win10.
 

cyclone3d

[H]F Junkie
Joined
Aug 16, 2004
Messages
14,722
That's what I'm thinking. OP said he uses Win7. I could have sworn Win7 still labeled it Defrag even though it only did TRIM on the SSD. If that's the case it would explain a performance bump.

I'm certain that this is not the case with Win8 and Win10.

Win7 does do a real defrag on SSDs.

Win8 and 10 just do a TRIM.
 

dragonstongue

2[H]4U
Joined
Nov 18, 2008
Messages
3,162
it may seem "small" compared to samsungs way of doing it but reality is, once your drive is "filled" at least while still leaving a reasonable amount of OP, that is a HELL of alot of endurance, my drives if I recall where both in the 62-74TB range (Crucial MX100/200 256-500) and even with that I would have to be writing in the ~60GB/day for 356/year for 3 years to meet this cap, very very few people write this much unless you are constantly erasing and installing a crap ton again, when you are talking say 512gb or 1.2TB that is tons of data especially in the 1.2TB range, and to be able to just "fly" through this as your post seems to allude to, maybe you should look at the higher durability "enterprise" models instead, correct me if I am wrong but isnt Intel one of the few that actually rate their SSD very lenient in regards to TBW (not to mention a drive doesnt just up and die or whatever if meets the total P/E cap especially if one actually gave it more OP room)

I dont know, but I think and not intending to be rude or whatever, but most people simply DONT go through anywhere close to this amount per day which in Intels case by what you are saying that is some 70 GB/day 365 days per year for like 8 years which is still only like 204.4 TB written again, a massive amount if you dont plan on using it this long OR dont write nearly as much it will outlive most computer we now use :p
 

jiminator

[H]F Junkie
Joined
Feb 2, 2007
Messages
11,607
You guys may be all wrong. If an SSD is getting close to being full then it may split a file through many partially full blocks. So although there may not he any drive head movement, accessing that file will require reading all of the blocks it is written to. If you have a lot of data like that then yeah, defrag would help. That may sound unlikely but imagine a scenario with a browser cache on an almost full SSD. It would result in lots of fragmentation and possible latency when pulling up websites, which is where people would notice it.
 

Nenu

[H]ardened
Joined
Apr 28, 2007
Messages
19,956
You guys may be all wrong. If an SSD is getting close to being full then it may split a file through many partially full blocks. So although there may not he any drive head movement, accessing that file will require reading all of the blocks it is written to. If you have a lot of data like that then yeah, defrag would help. That may sound unlikely but imagine a scenario with a browser cache on an almost full SSD. It would result in lots of fragmentation and possible latency when pulling up websites, which is where people would notice it.

That wont happen because SSDs are over-provisioned.
There will never be so little space to make that necessary because there are gigabytes of spare space.
When that spare space gets used a lot (ie because the drive is full), TRIM may not have time to run so old data hasnt been deleted yet and the cells are not ready to use until that has completed.
This is why drives slow down when they get full, each non empty cell has to be cleared before it can be written to.

Be aware that to write any data into a cell, the whole cell must be written in one go.
If any data is to survive, it has to be copied to memory, the cell marked for deletion, new data added to the original data and then another cell is written.

Over provisioned space is always available for use but it cannot be guaranteed to be empty when it is needed.
 
Last edited:

dragonstongue

2[H]4U
Joined
Nov 18, 2008
Messages
3,162
there may be SOME drives that this would affect, but I suppose would only be likely in say Samsung drives that use that fancy TLC like the 840 EVO as it can drastically cut the speed, or older drives or smaller drives that simply do not have enough cells or a robust enough controller so it cannot access enough cells at the same time to keep speed high.

Most mid to high end SSD generally should suffer next to no degradation if used reasonably as the controller would pick up everything properly, I imagine an improper Firmware, bad Sata/PCIE implementation etc or just badly used (as in on purpose heavily written to with no chance for drive to "recover")

I don't know I just don't picture it unless there is something amiss, which in most cases is crappy drive OR user error.

Cells are written X, so if X of one cell is needed, then X of the entire cell will be, not part of one. I suppose with fancier drives like Crucial or Samsung due to that TLC acting like SLC it might be more prone to speed drops as it is simply over-taxed due to running out of "steam"


Going with what Nenu is saying and my understanding, if you example do OS in 4k sector format and your app uses a number not divisible by this amount then it would use more cells then it may otherwise need to if it were say 512 format instead which would affect P/E more then anything else.

There is MANY intricacies about flash memory, the thing that hurts SSD performance the most either way is exactly that, using to much and leaving to little space for it to do its thing or I suppose writing a crap ton to the drive as it does not have enough cells for the controller to do it all at high speed of course. Again many little bits and pieces.
 

Executioner

Limp Gawd
Joined
Apr 22, 2015
Messages
506
Been reading up on SSD's, and found this interesting read:
http://www.hanselman.com/blog/TheRealAndCompleteStoryDoesWindowsDefragmentYourSSD.aspx

I dug deeper and talked to developers on the Windows storage team and this post is written in conjunction with them to answer the question, once and for all
"What's the deal with SSDs, Windows and Defrag, and more importantly, is Windows doing the RIGHT THING?"

It turns out that the answer is more nuanced than just yes or no, as is common with technical questions.

The short answer is, yes, Windows does sometimes defragment SSDs, yes, it's important to intelligently and appropriately defrag SSDs, and yes, Windows is smart about how it treats your SSD.

Conclusion

No, Windows is not foolishly or blindly running a defrag on your SSD every night, and no, Windows defrag isn't shortening the life of your SSD unnecessarily. Modern SSDs don't work the same way that we are used to with traditional hard drives.

Yes, your SSD's file system sometimes needs a kind of defragmentation and that's handled by Windows, monthly by default, when appropriate. The intent is to maximize performance and a long life. If you disable defragmentation completely, you are taking a risk that your filesystem metadata could reach maximum fragmentation and get you potentially in trouble.

So it sound like windows 7 will defrag if you have the option enabled, but do it intelligently.

Also, what if you had a win7 install on a mechanical HD, then created an image onto a new SSD. Will windows know that you now have a SSD and not a mechanical drive?
 

Nenu

[H]ardened
Joined
Apr 28, 2007
Messages
19,956
Windows 7x64 will not let me set a schedule to automatically defragment my SSD.
When selecting drives to schedule, the SSDs drive partitions are not in the list so cannot be ticked.
 

evilsofa

[H]F Junkie
Joined
Jan 1, 2007
Messages
10,078
Been reading up on SSD's, and found this interesting read:
http://www.hanselman.com/blog/TheRealAndCompleteStoryDoesWindowsDefragmentYourSSD.aspx

So it sound like windows 7 will defrag if you have the option enabled, but do it intelligently.

Also, what if you had a win7 install on a mechanical HD, then created an image onto a new SSD. Will windows know that you now have a SSD and not a mechanical drive?

Read the comments on that article, all the way to the end. The article is written about Windows 8 and later; a few of the comments talk about Windows 7 behavior, which is different from Win8 and later.

Windows 7 will only defrag your SSD on a schedule if it has not detected it as an SSD; if it has been detected as an SSD, it will not appear on the list of devices you can select to schedule for defragmentation, just as Nenu describes.

If your SSD does appear in that list, you can force Windows 7 to detect it as an SSD by running WEI. Press the "Windows Key" + "Pause|Break Key" on your keyboard, click "Windows Experience Index", and click the "Rate this computer" button; when WEI is done, reboot the computer three times.
 

Trimlock

[H]F Junkie
Joined
Sep 23, 2005
Messages
15,228
we are assuming a full drive and not somehow managing to get data to a single channel...that would be hard to do.

No SSD to my knowledge only stores data to one chip at a time, they intentionally fragment data stores.
 

AlienTech

Limp Gawd
Joined
Sep 30, 2004
Messages
286
You dont need to defrag SSD's as you are not supposed to get any performance from doing it. BUT I hae found that when you have many millions of small files, some programs refuse to work because of the number of fragments, especially image backup programs that run out of memory as they have to read the fragments and save them as a file into the image. You need this if you are creating compressed images and such. Keeping all this in memory takes up a lot of ram and usually a program only have 2GB of ram it can use. So yes I defrag the SSD once an year or so. Or when a program errors out as being out of memory to complete a function. Also the small files are not supposed to take up any disk space and are supposed to store the file in the MFT entry itself if its if the cluster size is larger than the file. So defragging the MFT would work just as well..

So unless you need the SSD defragged for such reasons there is no difference in normal usage. Another thing is, for safety reasons defragging makes sence as it will only corrupt the next few sections of the same file instead of arbitary number of sectors belonging to various files. Yea bad programming and stack overflows and such things do happen causing some programs to just go wild. Rare but still happens.. As I only do it very rarely I dont care if it takes a few gb's out of SSD's life.. I figure with my usuage I can easily get 5+ years and more like 10 years.. After more than 2 years I still have 90% life left.. So I wont do it once it hits 50% in hmmm 5-10 more years...
 

AlienTech

Limp Gawd
Joined
Sep 30, 2004
Messages
286
Windows 7x64 will not let me set a schedule to automatically defragment my SSD.
When selecting drives to schedule, the SSDs drive partitions are not in the list so cannot be ticked.

Yea all defraggers were set to not defrag SSD's but recently they have foudn that sometimes it is absolutely necessary and give you an option to do it. Microsoft is not among them. I use Auslogics diskdefrag and it is much faster and gives you the option for SSD's.. Although it is not good at defragging MFT's.. Use a third party tool to do it.
 

Executioner

Limp Gawd
Joined
Apr 22, 2015
Messages
506
If your SSD does appear in that list, you can force Windows 7 to detect it as an SSD by running WEI. Press the "Windows Key" + "Pause|Break Key" on your keyboard, click "Windows Experience Index", and click the "Rate this computer" button; when WEI is done, reboot the computer three times.
Why would you need to reboot your pc 3 times?
 

Bastich

n00b
Joined
Nov 13, 2006
Messages
42
Has anyone done any actual testing? I have. After about a year with a 256GB Samsung 840 Pro in Windows 7 I built up 42% fragmentation and Windows took ~9 seconds to boot (tested multiple times). After a defrag, I then shut down and cold booted the machine and Windows then repeatedly loaded in just 5 seconds.

It's been 7 months since I did that and I was at 23% fragmentation and a 7 second boot as of this morning. I defragmented right now and my boot time is back down to 5 seconds again. The performance improvement on my end is empirically testable and repeatable, so anyone who says SSDs don't show noticeable improvement in some metrics with defragmentation is clearly wrong.

My drive is over-provisioned by 20GB and always has at least 120GB of free space on the partition at all times as well, so I am never even remotely close to filling the drive. I use less than half the space on it.

And anyone who thinks a few minutes a year or twice a year of heavy write activity due to defragmentation is going to cause any real decrease in longevity of an SSD is just plain ignorant. You'll get rid of the drive because it's too small or too slow long before then or it will fail for a completely different reason.
 

Nenu

[H]ardened
Joined
Apr 28, 2007
Messages
19,956
Interesting results.
They dont matter to me now but I can see that it could be useful to some and maybe me later.
Booting is a particularly stressful use of any drive, far more than loading any other application.
Especially because Windows rewrites tons of its files which can fragment them more.

I have the same SSD as you and boot takes a while but this doesnt bother me.
Operation in Windows is very quick, I have no reason to troubleshoot.
Loading save games might improve by a second, but again, I'm not fussed, its very quick.
I have no reason to defrag my SSD.

But given your results the ops experience does look valid.
fyi my SSDs OS partition is 17% fragmented.
My game partition is 0% fragmented and has never been defragmented.

Rather than defragmenting a heavily fragmented OS drive, it might cause less wear to backup then restore the OS.
That would be interesting to know.
 
Last edited:
Top