COHERENT manpages
This page displays the COHERENT manpage for fmap [Measure fragmentation of the free list].
List of available manpages
Index
fmap -- Command Measure fragmentation of the free list fmap device Command fmap tests how fragmented the free list is on COHERENT file system device. It briefly displays its results and returns an exit status that is equivalent to the percent of fragmentation found on device. You can use the amount of fragmentation of the free list to decide whether to de-fragment device. When the freelist is fragmented, writing a file creates a file that is not physically contiguous; and this, in turn, slows disk I/O. device must be a partition on your hard disk or a floppy disk rather than an entire hard drive. It can be either the raw or the ``cooked'' (block) device. For example, the command fmap /dev/rat0a tells fmap to map the free list on the first partition on the first drive. Because fmap returns an exit status equal to the integer portion of the percentage of fragmentation found, you can use it in a shell script to alert the system administrator when the file system needs attention. For example, the following shell script tests the level of fragmentation on the device given as an argument; if the fragmentation exceeds 5%, it sends mail to the superuser root: fmap /dev/$1 a=$? if expr $a gt; 5 then echo -n "fmap of " >/tmp/rootmail echo -n $1 >>/tmp/rootmail echo -n " shows " >>/tmp/rootmail echo -n $a >>/tmp/rootmail echo " percent fragmentaion" >>/tmp/rootmail echo -n $a >>/tmp/rootmail echo " is greater than 5" >>/tmp/rootmail echo -n "therefore, it is time to defrag " >>/tmp/rootmail echo $1 >>/tmp/rootmail echo "bye" >>/tmp/rootmail mail root </tmp/rootmail rm /tmp/rootmail fi exit 0 See Also commands, dpac, fsck, qpac, upac Notes fmap was written by Randy Wright (rw@rwsys.wimsey.bc.ca).