Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Wiki pages for btrfs and other how-tos talk about online defragmentation and other related topics but they don't say how to find out how fragmented a file system is. Is there a method to determine how many files are fragmented or to produce some other meassure of file system fragmentation?

share|improve this question

1 Answer 1

filefrag command works with btrfs as well as with other filesystems.

$ filefrag ubuntu-8.04.1-desktop-i386.iso
ubuntu-8.04.1-desktop-i386.iso: 7 extents found

It only shows the number of extents for individual files though. You may want to write a shell script to sample a number of files and calculate some number which will give an approximate indication of how the whole filesystem is fragmented.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.