30

It seems to me that since RAID volumes are logical (as opposed to physical), the layout that the OS believes they have might not correspond to the actual phsyical layout.

So does defrag make sense for RAID?

Aidan Ryan
  • 1,253
  • 2
  • 13
  • 16

3 Answers3

32

Yes, defrag does still make sense for RAID. While it's true that the layout the OS sees isn't the same as the physical layout, it's monotonic, ie the virtual sectors are in the same order on the disk as they are on the array, it's just they are scattered across disks.

Also, the RAID controller will use predictive caching (if it has it) based on an understanding of the array layout, so that will work better if you have defrag.

The only time you don't need to defrag is if the underlying storage medium is random access, so don't defrag your USB key, and don't defrag an SSD.

Richard Gadsden
  • 3,696
  • 4
  • 28
  • 58
  • 8
    +1 I really like the note about SSD; quite right! The reason for this is that most SSD and flash memory employs something called wear leveling, which writes data to physical locations that aren't used much. Since this is usually transparent to the OS, defragmenting has no meaning on these media. – msanford Jun 07 '09 at 23:08
  • 1
    I wouldn't say that SSDs don't need defragmenting, since it's [trivial to show](http://www.anandtech.com/show/6935/seagate-600-ssd-review/5) significant differences between sequential and random access data rates. Wear leveling will come in to play eventually, but only as the media ages, just like bad sector detection does on a spinning metal disk. However, in the general/common case, clusters/extents that are logically sequential on the volume will be physically sequential sectors on the media, again just like spinning metal. Depending on use case, it may be beneficial. – Bacon Bits Feb 13 '15 at 16:38
  • 1
    Defragmenting a flash memory **is** dangerous as the operation relocates data uselessly by increasing device wear. Only a bad-written software would even simply allow you to perform such operation – usr-local-ΕΨΗΕΛΩΝ Feb 06 '17 at 22:01
  • @BaconBits Every "bit" of any flash memory, including SSDs, can only be written to so many times before it becomes unusable. SSDs typically are capable of more capacity than the specs, simply because when one bit dies, another spare one opens up. Because they're expected to eventually die. But there's only so many spares... – Jerry Dodge May 26 '19 at 01:31
6

Yes it does. No matter what RAID level you're running, you may still be affected by fragmentation (unless you're running SAN solutions like NetApp with their WAFL layout).

RAID1 is just a mirror of the fragmentation on both drives. RAID0 is just splitting fragmented files up on two drives. RAID5, 10, etc.

Mark S. Rasmussen
  • 2,108
  • 2
  • 21
  • 31
0

No.

  1. It is unlikely you will access the data on the drive in a linear fashion.
  2. The data is distributed across multiple drives so there is no "start" or "end" or "beginning".
  3. Writes are VERY expensive on the "typical" RAID 5 array. Even on other RAID layouts your using up power & CPU.
  4. Almost impossible to prove that defragging DOES actually improve performance.

Yes, on a desktop PC with a single drive. Servers? Not worth the effort.

Guy
  • 2,658
  • 2
  • 20
  • 24