If you would like to find out file fragmentation information for specific file, use filefrag command that report on file fragmentation.
filefrag reports on how badly fragmented a particular file might be. It makes allowances for indirect blocks for ext2 and ext3 filesystems, but can be used on files for any filesystem.
For example see file fragmentation for /var/log/message file:
# filefrag -v /var/log/messages
Output:
Checking /var/log/messages Filesystem type is: ef53 Filesystem cylinder groups is approximately 9448 Blocksize of file /var/log/messages is 4096 File size of /var/log/messages is 72 (1 blocks) First block: 1841075 Last block: 1841075 /var/log/messages: 1 extent found
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop













{ 2 comments… read them below or add one }
Nice tip. Is there also a command to defrag a file?
Use defrag (ext2, minix and xiafs filesystem defragmenter ) command. Read man page of defrag for more info.
Ext3 file system donot need defrag as it is optimized and do not suffer from fragmentation problem in general.