1,fdisk -l

fdisk -l 只能列出硬盘的分区表、容量大小以及分区类型,但是查看不到文件系统的类型。

[root@AY140716161543837722Z ~]# fdisk -l
Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00073f45
Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *      1           2611    20970496   83  Linux
[root@AY140716161543837722Z ~]# fdisk -help
Usage:
fdisk [options]     change partition table
fdisk [options] -l list partition table(s)
fdisk -s       give partition size(s) in blocks
Options:
-b             sector size (512, 1024, 2048 or 4096)
-c                        switch off DOS-compatible mode
-h                        print help
-u             give sizes in sectors instead of cylinders
-v                        print version
-C                specify the number of cylinders
-H                specify the number of heads
-S                specify the number of sectors per track
2,df -h

df 命令是用来查看文件系统磁盘空间使用量的。但df 命令只会列出已挂载的文件系统信息,对于没有挂载的文件系统是查看不到的。使用这个命令可以很方便的查看已挂载的文件系统的空间使用量、剩余空间大小等信息。

[root@AY140716161543837722Z ~]# df --help
Usage: df [OPTION]... [FILE]...
Show information about the file system on which each FILE resides,or all file systems by default.

显示每个文件所在的文件系统的信息,或者默认插件所有的文件系统。

[root@AY140716161543837722Z ~]# df
Filesystem           1K-blocks      Used        Available     Use% Mounted on
/dev/xvda1         20641404     7531560  12061320  39%    /
tmpfs                 960472         0            960472      0%     /dev/shm
[root@AY140716161543837722Z ~]# df -hT
Filesystem    Type    Size    Used   Avail     Use%     Mounted on
/dev/xvda1   ext4     20G   7.2G   12G      39%       /
tmpfs           tmpfs    938M     0  938M      0%        /dev/shm
Mandatory arguments to long options are mandatory for short options too.
-a, --all             include dummy file systems
-B, --block-size=SIZE  use SIZE-byte blocks
--direct          show statistics for a file instead of mount point
--total           produce a grand total
-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 file systems
--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 listing to file systems of type TYPE
-T, --print-type      print file system type
-x, --exclude-type=TYPE   limit listing to file systems not of type TYPE
-v                    (ignored)
--help     display this help and exit
--version  output version information and exit
Display values are in units of the first available SIZE from --block-size,
and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).
SIZE may be (or may be an integer optionally followed by) one of following:
KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.
Report df bugs to bug-coreutils@gnu.org
GNU coreutils home page: 
General help using GNU software: 
For complete documentation, run: info coreutils 'df invocation'

功能:检查文件系统的磁盘空间占用情况。可以用该命令来获取:硬盘被占用了多少空间,目前还剩下多少空间等信息。

语法:df [选项]

说明:df命令可显示所有文件系统对i节点和磁盘块的使用情况。该命令各个选项的含义如下:

-a 显示所有文件系统的磁盘使用情况,包括0块(block)的文件系统,如/proc文件系统。

-k 以k字节为单位显示。

-i 显示i节点信息,而不是磁盘块。

-t 显示各指定类型的文件系统的磁盘空间使用情况。

-x 列出不是某一指定类型文件系统的磁盘空间使用情况(与t选项相反)。

-T 显示文件系统类型。

例1:列出各文件系统的磁盘空间使用情况。

$ df
Filesystem     1 K-blocks  Used     Available Use% Mounted on
/dev/hda2     1361587      1246406 44823     97%     /

df命令的输出清单的第1列是代表文件系统对应的设备文件的路径名(一般是硬盘上的分区);第2列给出分区包含的数据块(1024字节)的数目;第3,4列分别表示已用的和可用的数据块数目。用户也许会感到奇怪的是,第3,4列块数之和不等于第2列中的块数。这是因为缺省的每个分区都留了少量空间供系统管理员使用。即使遇到普通用户空间已满的情况,管理员仍能登录和留有解决问题所需的工作空间。清单中Use% 列表示普通用户空间使用的百分比,即使这一数字达到100%,分区仍然留有系统管理员使用的空间。最后,Mounted on列表示文件系统的安装点。

例2:列出各文件系统的i节点使用情况。

$ df -ia
Filesystem Inodes IUsed IFree Iused% Mounted on
/dev/ hda2 352256 75043 277213 21% /
none 0 0 0 0% /proc
localhost:(pid221) 0 0 0 0% /net

例3:列出文件系统的类型。

$ df -T
Filesystem Type 1K-blocks Used Available use% Mounted on
/dev/hda2 ext2 1361587 1246405 44824 97% /