xfs
[Top] [All Lists]

Re: Defragging XFS File Systems

To: Kenneth Emerson <kenneth.emerson@xxxxxxxxx>
Subject: Re: Defragging XFS File Systems
From: Stan Hoeppner <stan@xxxxxxxxxxxxxxxxx>
Date: Tue, 07 Jun 2011 07:05:54 -0500
Cc: xfs@xxxxxxxxxxx
In-reply-to: <BANLkTi=40mmE+DCbLcSWBwNQtWpP=N=tXw@xxxxxxxxxxxxxx>
References: <BANLkTi=40mmE+DCbLcSWBwNQtWpP=N=tXw@xxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
On 6/6/2011 10:52 PM, Kenneth Emerson wrote:
> I hadn't given much thought to fragmentation of my TV recordings volume
> (XFS) until reading through some MythTV-users threads recently that
> mentioned how fragmented an XFS file system could become.  After running
> xfs_db, I found out that my fs appeared to be quite bad:
> 
> $ sudo xfs_db -c frag -r /dev/mapper/appl_vg-appl_lv
>  actual 1138668, ideal 11023, fragmentation factor 99.03%
> 
> I then ran xfs_fsr with all defaults (ran for two hours) and then re-ran

>From man xfs_fsr:

       It runs for up to two hours after which it records the
       filesystem where it left off, so it can start there the next
       time.  This  information  is stored in the file
       /var/tmp/.fsrlast_xfs.  If the information found here is somehow
       inconsistent or out of date it is ignored and reorganization
       starts at the beginning of the first filesystem found in
       /etc/mtab.

If xfs_fsr stopped at 2 hours, multiple additional runs will likely be
required to get good defragmentation.

> xfs_db and got the following results:
> 
> $ sudo xfs_db -c frag -r /dev/mapper/appl_vg-appl_lv

The -r above suggests you created a large realtime section for your
MythTV storage.  It may be helpful for you to provide xfs_info output
for the heavily fragmented filesystem.

> invalid numrecs (27111) in bmapbtd block
> invalid numrecs (4716) in bmapbtd block
> invalid numrecs (58978) in bmapbtd block

I'll leave these errors for one of the devs to tackle.

> actual 1034793, ideal 11024, fragmentation factor 98.93%
> 
> The fragmentation level was reduced, 

It was likely reduced much more than this.  Dropping caches or
unmounting and remounting the filesystem is often necessary after
running xfs_fsr in order to show the actual fragmentation level.  Try:

# echo 3 > /proc/sys/vm/drop_caches

and then run xfs_db again.

> but I was concerned about the error
> messages.  Before I go any further, am I corrupting my file system with the
> defragging or are these "invalid numrecs" messages unimportant?

Run 'xfs_check' or 'xfs_repair -n' and post the results.

-- 
Stan

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