HiĀ I want to use btrfs defrag tool but before that i want to know how much the disk is fragmented. I have tried to use filefrag but it gives me FIBMAP:invalid argument for many times. I am using e2fsprogs version 1.42 on debian squeeze. Is there another way to find out the level of fragmentation on btrfs filesystem? Thanks in advance -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Mar 01, 2012 at 04:41:02AM -0800, bella tk wrote:> I want to use btrfs defrag tool but before that i want to know how > much the disk is fragmented. I have tried to use filefrag but it gives > me FIBMAP:invalid argument for many times.The only way to trigger FIBMAP on btrfs is to run filefrag with -B option, but it should use FIEMAP by default and it works. With -v option it''ll list all extents.> I am using e2fsprogs version 1.42 on debian squeeze. Is there another > way to find out the level of fragmentation on btrfs filesystem?For while filesystem fragmentation, you can use the btrfs-filefrags too that Arne sent to the list some time ago. If you''re interested in file level fragmentation, then filefrag is the tool to use, but beware that just counting extents is not enough, and compression makes things more complicated to interpret results correctly. Also, defragmentation does unCOW the files (until the snapshot aware defrag is finished). david -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Mar 01, 2012 at 01:58:14PM +0100, David Sterba wrote:> On Thu, Mar 01, 2012 at 04:41:02AM -0800, bella tk wrote: > > I want to use btrfs defrag tool but before that i want to know how > > much the disk is fragmented. I have tried to use filefrag but it gives > > me FIBMAP:invalid argument for many times. > > The only way to trigger FIBMAP on btrfs is to run filefrag with -B > option, but it should use FIEMAP by default and it works. With -v option > it''ll list all extents.We actually disabled bmap to keep the swap code from remembering fixed offsets for btrfs files. The only way to get the mapping is with fiemap. The defrag ioctl won''t bother defragging files that are not fragmented. -chris -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html