xfs_fsr defragments files in a "dumb" manner. An allocation is attempted for the size of the file and if the extent count of the new allocation is less than the old allocation, the file is copied to the new allocation and the original one is removed.
This is done with zero regard for any other filesystem circumstances. Defragmenting XFS can move your files to other allocation groups and generally scatter them about randomly. Any work done by XFS to try to keep files together when written initially can be blown away. Distance between files being accessed is a rarely discussed problem since defragmentation is commonly known about due to the influence of Windows, yet it has effects that can be worse than accepting a certain amount of file fragmentation. There is no reason to run xfs_fsr for the entire system unless you let your disks fill up and then deleted a large amount of data. If you are worried about large files being fragmented, write a shell script using the find command to locate huge files and pass them along for individual defragmentation, but other than that you're almost certainly doing more harm than good. Also, if you have 12TB worth of storage in that machine and you're using any kind of RAID then unless you have 10GbE you're not going to be able to slow the disks down enough in most use cases to NOT be able to totally saturate a gigabit link, so it's even more of a moot point. If your files are small and numerous enough and your accesses random enough to make the network outrun the disks, you won't benefit from the defrag work anyway because xfs_fsr has a good probability make them even slower than access relative to each other. All this effort to speed up the system could be making it even slower, plus your storage will be quite slow if xfs_fsr is running while you're trying to use the device for its intended purpose. Read the XFS FAQ to get more information on this topic. The XFS people have covered all of these questions very comprehensively. Jody Bruchon On October 12, 2015 11:21:39 AM EST, Mike Dean <md...@emacinc.com> wrote: >Sorry, but he gave you terrible advice. I have to wonder if he's ever >used >XFS. > >The xfs_fsr utility will exit once it has finished defragging the >filesystem. What you really should do is this: > >1. Run xfs_fsr -v manually, and let it run until it finishes. Run it >one >more time, unless you still notice plenty of extents: before: xx >after: >xx messages. Once you stop seeing these, move on to the next step. >2. Set a cronjob to run DAILY to defrag the filesystem. Not much >fragmentation should be added daily, so this step should complete very >quickly. > >If you wait a full month between defrags, it will take significantly >longer >to defrag and your overall performance will potentially suffer. Keep >in >mind that you need to ensure there's always enough free space on your >drive >to make a duplicate of the largest file you keep on there. Also, rules >of >thumb: > >If the drive is > 95%, it will fragment quickly. >If the drive is < 90% full, it shouldn't fragment very much. > >So, try to keep it below 90% full; preferably, below 85% full. > > > > >On Sun, Oct 11, 2015 at 6:23 PM, Matthias Andersson < >matthias.anders...@pp1.inet.fi> wrote: > >> Hello, >> >> Very well, I might schedule the job once a month. >> >> //Matthias >> >> >> On 11.10.2015 22.23, Hin-Tak Leung wrote: >> >>> I am curious about your plan of running it on a weekly basis. >>> >>> For a lightly used system, that seems a bit too frequent; for a >system >>> that's constantly being used, that may be justifiable, but >>> then running it that frequently will probably (1) affect the >performance >>> of the system for regular tasks (during that hour your system's, >>> responsiveness will probably be bad, and that's a couple of hours >>> per week, not a small proportion of time), (2) increase >tear-and-wear. >>> >>> In any case, I'd probably only do a defrag every few months, >>> or keep occupancy below a certain level (say, 60-70%) to keep >>> fragmentation low though... just my 2 cents. >>> >>> -------------------------------------------- >>> On Sun, 11/10/15, Matthias Andersson ><matthias.anders...@pp1.inet.fi> >>> wrote: >>> >>> Hello, >>> >>> I own a Buffalo Linkstation Pro Quad 12 Tb which runs the >>> busybox OS. >>> >>> The NAS uses the XFS filesystem and provides the xfs_fsr >>> defragmentation >>> tool. The problem I've noticed is that the program doesn't >>> obey the -t >>> (seconds) parameter, I've tried xfs_fsr -t 3600 /dev/md2 and >>> it runs >>> over an hour. I then tried with 8 hours but it didn't stop >>> there either. >>> The -p 1 flag seems to work... >>> >>> I'm trying to set up a cron-job to run xfs_fsr for a couple >>> of hours on >>> a weekly basis. >>> >>> //Matthias Andersson >>> >>> >>> >> _______________________________________________ >> busybox mailing list >> busybox@busybox.net >> http://lists.busybox.net/mailman/listinfo/busybox >> > > >------------------------------------------------------------------------ > >_______________________________________________ >busybox mailing list >busybox@busybox.net >http://lists.busybox.net/mailman/listinfo/busybox -- Sent from my Android phone with K-9 Mail. Please excuse my brevity. _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox