< Day Day Up > |
One of the first activities you would perform when interested in file systems is to see what file systems are currently mounted on your system and their characteristics. The df command produces a listing of mounted file systems and some space-related information on each. The following is an example shows issuing the df command with the --help option, then just df, and finally df -h: # df --help Usage: df [OPTION]... [FILE]... Show information about the filesystem on which each FILE resides, or all filesystems by default. Mandatory arguments to long options are mandatory for short options too. -a, --all include filesystems having 0 blocks -B, --block-size=SIZE use SIZE-byte blocks -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G) -H, --si likewise, but use powers of 1000 not 1024 -i, --inodes list inode information instead of block usage -k like --block-size=1K -l, --local limit listing to local filesystems --no-sync do not invoke sync before getting usage info (default) -P, --portability use the POSIX output format --sync invoke sync before getting usage info -t, --type=TYPE limit l isting to filesystems of type TYPE -T, --print-type print filesystem type -x, --exclude-type=TYPE limit listing to filesystems not of type TYPE -v (ignored) --help display this help and exit --version output version information and exit SIZE may be (or may be an integer optionally followed by) one of following: kB 1000, K 1024, MB 1,000,000, M 1,048,576, and so on for G, T, P, E, Z, Y. Report bugs to <bug-fileutils@gnu.org>. [root@linuxdev root]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/hda5 381139 179034 182427 50% / /dev/hda1 46636 14547 29681 33% /boot /dev/hda3 1423096 265596 1085208 20% /home none 46928 0 46928 0% /dev/shm /dev/hda2 3889924 2800228 892100 76% /usr /dev/hda6 256667 70926 172489 30% /var /dev/hdb1 38464340 29211248 7299188 81% /home/linuxconnect/backup # df -h Filesystem Size Used Avail Use% Mounted on /dev/hda5 372M 175M 178M 50% / /dev/hda1 45M 15M 28M 33% /boot /dev/hda3 1.4G 260M 1.0G 20% /home none 46M 0 45M 0% /dev/shm /dev/hda2 3.7G 2.7G 871M 76% /usr /dev/hda6 251M 70M 168M 30% /var /dev/hdb1 37G 28G 6.9G 81% /home/linuxconnect/backup The first option produces a listing of all options to the df command. The second time you issued the df command with no options. Finally, you produced an output with the -h option that shows the output in an easy-to-read format. Another important topic related to file systems is swap space. You can view swap information on most Linux variants using the parted command, as shown in the following example: # parted GNU Parted 1.4.24 Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software, covered by the GNU General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR- POSE. See the GNU General Public License for more details. Using /dev/hda Information: The operating system thinks the geometry on /dev/hda is 784/255/63. (parted) help check MINOR do a simple check on the filesystem cp [FROM-DEVICE] FROM-MINOR TO-MINOR copy filesystem to another partition help [COMMAND] prints general help, or help on COMMAND mklabel LABEL-TYPE create a new disklabel (partition table) mkfs MINOR FS-TYPE make a filesystem FS-TYPE on partititon MINOR mkpart PART-TYPE [FS-TYPE] START END make a partition mkpartfs PART-TYPE FS-TYPE START END make a partition with a filesystem move MINOR START [END] move partition MINOR name MINOR NAME name partition MINOR NAME print display the partition table quit exit program resize MINOR START END resize filesystem on partition MINOR rm MINOR delete partition MINOR select DEVICE choose the device to edit set MINOR FLAG STATE change a flag on partition MINOR (parted) print Disk geometry for /dev/hda: 0.000-6149.882 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 0.031 47.065 primary ext3 boot 2 47.065 3906.430 primary ext3 3 3906.431 5318.393 primary ext3 4 5318.394 6149.882 extended 5 5318.424 5702.761 logical ext3 6 5702.792 5961.621 logical ext3 7 5961.652 6149.882 logical linux-swap (parted) quit [root@linuxdev root]# In this example, you issued parted, then the help option, then the print option, and finally the quit option. As you can see, the output from parted has to be interpreted. The boot partition, for instance, has a Start and End in MB. This partition is shown in the df -h output as being 45M. The next partition, which is 2, corresponds to / on the df -h output that shows a size of 372M. Because the parted output has a Start and End entry you have to perform a little arithmetic in order to determine the size of the partition. When you get to linux-swap, you have to subtract the Start from End to see the size of this partition. The partitions are not listed in the same order in the two outputs. You can also use fdisk to view all the partitions including swap space, as shown in the following listing: # fdisk /dev/hda -l Disk /dev/hda: 255 heads, 63 sectors, 784 cylinders Units = cylinders of 16065 * 512 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 6 48163+ 83 Linux /dev/hda2 7 498 3951990 83 Linux /dev/hda3 499 678 1445850 83 Linux /dev/hda4 679 784 851445 5 Extended /dev/hda5 679 727 393561 83 Linux /dev/hda6 728 760 265041 83 Linux /dev/hda7 761 784 192748+ 82 Linux swap # This output is different than parted and has the added column of Blocks, which makes it easier to determine the size of swap on this disk. You can also use parted and fdisk to manipulate the partitions. |
< Day Day Up > |