On 10/13/2015 02:44 AM, Dan Egli wrote:
> I was wondering if anyone had heard of any utilities that would allow one
> to defragment a Linux Native file system (i.e., ext4, btrfs, etc...)?
> Considering how much mechanical HDD performance falls due to fragmentation
> I'd think there would be at least one, but I can't think of it. Can anyone
> else?
>
>
>
> Thanks!
> --- Dan
>
>
ext4 has a defragger, but I've never used it.  Occasionally I will get
curious and run filefrag to find out how many extents each file has.  I
just ran e4defrag -c on my root and home volumes, and it found very
little fragmentation in my home, and only mild fragmentation in my
root.  I might defrag my root for fun, but I doubt I'll see any improvement.

xfs has xfs_fsr, and I've used it a few times.  But xfs_fsr defrags
different than you would expect.  It only reorganizes the most
fragmented files one pass at a time, and stops after a specified time
limit.  The downside is, if the aggregation group doesn't have enough
contiguous space to store the defrag-ed file, it will look in other
aggregation groups for space.  Normally, all files in a directory are
created within the same aggregation group to improve locality.  So
depending on your workload, defragging may hurt performance more than it
helps. 

The only time I've defragged XFS where it helped was when I ran a MythTV
box with two capture cards.  Then I got smart and set XFS for minimum of
64MB extents in my video storage pools.  That did more for preventing
fragmentation and helping performance than defragging ever did.

Defragging other filesystems can be done by tarring up the volume to a
separate device, deleting all the (regular) files, and untarring back in
place.  It isn't fast and can't be done online, but you certainly have
the option.

Grazie,
;-Daniel




/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to