Is it bad to defragment a USB Flash Drive?

18

2

If I defragment my 8 GB Kingston flash drive, will it decrease its lifetime?

Little Helper

Posted 2011-09-05T17:52:25.943

Reputation: 1 906

Answers

20

You should not defrag flash media.

First off, there is no benefit. Defragging a traditional magnetic hard drive is beneficial as the actuator arm has to move the heads around the platter to find the data. Defragmenting orders the data on the hard drive, and the actuator arm has to seek (move around) less. However, flash media has no moving parts, therefore is has virtually no seek time.

Flash media does wear out though. It takes a long time, with lots of writes to the same location repeatedly. Modern flash drives have a technology called TRIM that minimizes writes to the same location by spreading them around the entire drive. TRIM basically does the exact opposite of what you are trying to do - it fragments the data.

In addition to that, most OSs will not let you defragment flash media (for the reasons mentioned above). There may be some 3rd party tools that will bypass the restriction, but it is not a good idea.

Keltari

Posted 2011-09-05T17:52:25.943

Reputation: 57 019

1I don't know of a single USB FLash Drive on the market in 2012 or 2011 that supports TRIM. The solid state flash memory used in SSD HDDS and USB Flash Devices are honestly different. – Ramhound – 2012-09-12T17:30:09.877

whether the media supports TRIM or not, you still shouldnt defrag it. – Keltari – 2012-09-12T17:33:53.133

@Ramhound: At the end of 2012 a special USB flash drive with TRIM (and S.M.A.R.T.) support appeared: Kingston DataTraveler Workspace

– pabouk – 2013-10-17T08:18:58.300

Actually, what you're thinking of is wear leveling, not TRIM per se. TRIM can help the drive do wear leveling better, but the two are distinct.

– a CVn – 2013-12-01T12:53:48.730

3

I know many people will disagree.

I have already seen multiple posts on the net stating that there is not need to defrag USB flash drives. However there is a need to do it in some special cases.

Here is an example for your consideration:

Consider the situation when you have a complex grub.cfg with multiple OS running of the USB and some other files that you store on your USB drive. Files are badly fragmented and you need to add an ISO to boot. There is about 20% of empty space and ISO ends up fragmented. But grub4dos won't boot an ISO unless it is in contiguous disk space. What would you do?

Anyway since we are talking about Flash drive than there is no need to use traditional defrag tools that run in a loop and perform multiple (?unnecessary?) write ops. If your flash disk is reasonably small then you can just copy all your data to temporary directory (anywhere on your HDD), then wipe your flash drive, then copy data back onto it. This will be much more efficient then any defrag algorithm and still do the same job. And you will prevent wear and tear to your flash disk

So my answer would be: Don”t defrag flash drives unless you really have to. And if you have to, don't use defrag tools, just do it manually.

SMC

Posted 2011-09-05T17:52:25.943

Reputation: 31

This is great and it worked. My HDD did not have space but i had two external drives. copied from 1 to 2, bombed 1 and then copied back from 2. voila i have 30% extra space now – tgkprog – 2016-01-27T19:36:17.083

2

The Diskeeper program, which has been the best defrag utility, has a optimization module for SSDs, called Hyperfast. It doesn't defrag your SSD-type drives, it optimizes them.

Lance Roberts

Posted 2011-09-05T17:52:25.943

Reputation: 7 895

1I know this is a necropost, being a year later, but I was looking at some of my old answers and saw this and had to throw my 2 cents in. Although I know nothing of this Hyperfast, I dont believe for a second it is useful. Im sure there is a mathematically proven best method for ordering data on a SSD. However, with the speed of random seeks on SSDs, the benefit of this would probably take dayss to accumulate a second of saved time. – Keltari – 2012-07-16T06:57:29.920

@Keltari - I would have to agree. My guess its one of this features that don't actually do anything and can even do more harm then good. – Ramhound – 2012-09-12T17:28:36.713

1

It depends on what is on the drive. You will not get any performance increase by defragging a flash-drive, but it will have an impact on data-recovery.

On the one hand, flash-memory has a limited number of write cycles, so doing a lot of writing will eventually wear it out. Flash drives, memory cards, and SSDs use tricks like wear-leveling and TRIM to extend the life of the media, but defragmentation tends to cause a large number of writes, which will cause it wear out all the faster.

On the other hand, fragmented files are infinitely harder to recover when accidentally deleted, hit by a virus, etc. so keeping your files in a contiguous state (e.g., by defragmenting) will greatly increase the chances of recovery.

Therefore, like I said at the start, it depends on what is stored on the drive, how important the files are, how likely you are to need to perform data-recovery, and how frequently the files are changed (frequent deletions and copies will lead to fragmentation faster as well as eat up more write cycles).

Synetech

Posted 2011-09-05T17:52:25.943

Reputation: 63 242

1

While defragmenting SSD and Flash drives is generally frowned upon, one benefit is that you will sometimes recover free space on the drive, and then erasing (or "zeroing out") the remaining free space will also recover more usable space. This may be useful for cramming a drive full of files for a master image, or archive, but with additional read/write and trim activity, that unused space may be reclaimed by the drive again.

Mooncalf2012

Posted 2011-09-05T17:52:25.943

Reputation: 11

2Can you clarify why defragmenting would recover free space? – fixer1234 – 2015-09-22T01:52:10.090

Each file fragment requires data to reconstruct the file, to maintain file integrity, and sometimes extra "parity" data to prevent corruption. The more fragments, the more additional space used. A badly fragmented drive can contain several MB to GB of data, that's eventually discarded when files are brought back to a "contiguous" space on the drive. Much of this type of data though is left on the drive during daily use, and never fully recovered by drive algorithms, and not fully cleared even by the trim command on an SSD, often termed "garbage collection" schemes (for solid state drives). – Mooncalf2012 – 2015-09-23T11:14:07.897