1 # Usage: fragment_collect dev mount_dir test_path output_file
3 # On linux system, this script collects the fragmentation status of a
4 # particular directory. The objects under this directory SHOULD NOT be
5 # used as mount point. If they do, please umount them first, but there
6 # is no danger even if you forget. The "output_file" is the one that I
7 # need, please gzip it and send it back to nzhu@cs.sunysb.edu
9 # The program needs to be run as ROOT, but it is SAFE and KEEPS PRIVACY.
10 # The pathname information on your system is completely filtered out
11 # from the final output. This program ONLY READ and DOES NOT WRITE any
12 # files EXCEPT "output_file*"
15 # dev :the device of the directory to be measured
16 # mount_dir :the the mount point of the device
17 # test_path :the relative path of the directory under mount_dir
18 # output_file :where the result is stored.
20 # Example: fragment_collect /dev/hda7 /home ningning /tmp/home-ningning.frag
22 # This gives the fragmentation information (saved in "/tmp/home-ningning.frag")
23 # of the file system objects under the directory of "/home/ningning" on the
24 # disk partition of "/dev/hda7" mounted to "/home".
31 echo "find $3 -print >$4.1"
33 echo "sed -d s/^/show_inode_info / $4.1"
34 sed -e "s/^/show_inode_info /" $4.1 >$4.2
37 echo "debugfs -f $4.3"
38 debugfs -f $4.3 > $4.4
39 grep -v debugfs $4.4 > $4