xfs
[Top] [All Lists]

Re: Defragging XFS File Systems

To: Stan Hoeppner <stan@xxxxxxxxxxxxxxxxx>
Subject: Re: Defragging XFS File Systems
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Sat, 11 Jun 2011 03:56:56 +1000
Cc: Michael Monnerie <michael.monnerie@xxxxxxxxxxxxxxxxxxx>, Kenneth Emerson <kenneth.emerson@xxxxxxxxx>, xfs@xxxxxxxxxxx
In-reply-to: <4DF10FDF.1090508@xxxxxxxxxxxxxxxxx>
References: <BANLkTi=40mmE+DCbLcSWBwNQtWpP=N=tXw@xxxxxxxxxxxxxx> <201106090749.37745@xxxxxx> <4DF080AC.2090507@xxxxxxxxxxxxxxxxx> <201106091212.36227@xxxxxx> <4DF10FDF.1090508@xxxxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.20 (2009-06-14)
On Thu, Jun 09, 2011 at 01:24:31PM -0500, Stan Hoeppner wrote:
> On 6/9/2011 5:12 AM, Michael Monnerie wrote:
> > On Donnerstag, 9. Juni 2011 Stan Hoeppner wrote:
> >> When is running xfs_fsr recommended?
> > 
> > Good question. One case that comes to my mind is a filesystem that was 
> > used a long time when filled >85%, which has now either been expanded or 
> > files removed so you have a lot of space again, and you want to defrag 
> > all those files that have been badly fragmented.
> >  
> >> I scheduled it twice a week some time ago due to a filesystem
> >> containing active mbox files.  I did so because they became so
> >> heavily fragmented in short order, especially those swallowing
> >> copious amounts of list mail.  Before cron'ing xfs_fsr I was seeing
> >> mbox files with over 1000 fragmented extents, and increasing MUA
> >> latency as the files became more fragmented.  The filesystem is
> >> currently 90% free.
> > 
> > This is also an example where defrag may help. You have 10% usage, so 
> > there's enough space. Maybe your usage fits the mount option 
> > "allocsize", 
> 
> I tried allocsize=1m but it didn't seem to help already existing files.
>  I simply don't think there's much that can be done in filesystem logic
> to keep long lived constantly appended files from fragmenting, short of

YOu can stop XFS from truncating speculative preallocation beyond
EOF by either telling the inode it has preallocated space or
or turning it into a an append-only file. e.g.

$ xfs_io -f -c "resvsp 0 4k" <file>

or

$ sudo chattr +a <file>

Either way, XFS won't truncate extents beyond EOF on file close for
such a file and that should prevent most future fragmentation of the
file.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>