为了获取磁盘空间统计信息,您可以使用df命令。该命令可以显示每个挂载的磁盘的可用空间量。需要注意的是,df报告的可用磁盘空间只反映总容量的90%,因为留出了10%以上的空间作为头空间,以提高性能。实际上,df命令报告的磁盘空间百分比是已用空间除以可用空间。如果文件系统超过90%的容量,您可以使用cp命令将文件转移到具有可用空间的磁盘上。另外,您还可以使用tar或cpio命令将文件转移到磁带上,或者删除文件。
$ df -k Filesystem 1024-blocks Used Available Capacity Mounted on rpool/ROOT/solaris-161 191987712 6004395 140577816 5% / /devices 0 0 0 0% /devices /dev 0 0 0 0% /dev ctfs 0 0 0 0% /system/contract proc 0 0 0 0% /proc mnttab 0 0 0 0% /etc/mnttab swap 4184236 496 4183740 1% /system/volatile objfs 0 0 0 0% /system/object sharefs 0 0 0 0% /etc/dfs/sharetab /usr/lib/libc/libc_hwcap1.so.1 146582211 6004395 140577816 5% /lib/libc.so.1 fd 0 0 0 0% /dev/fd swap 4183784 60 4183724 1% /tmp rpool/export 191987712 35 140577816 1% /export rpool/export/home 191987712 32 140577816 1% /export/home rpool/export/home/123 191987712 13108813 140577816 9% /export/home/123 rpool/export/repo 191987712 11187204 140577816 8% /export/repo rpool/export/repo2010_11 191987712 31 140577816 1% /export/repo2010_11 rpool 191987712 5238974 140577816 4% /rpool /export/home/123 153686630 13108813 140577816 9% /home/123
有关df命令的详细说明,请参阅相关手册页。如果您想要显示磁盘空间信息,可以使用df -k命令。下面是一个示例,展示了df -k命令的输出。表格中解释了df -k命令输出的各个字段的含义,包括kbytes(文件系统中可用空间的总大小)、used(已用空间量)、avail(可用空间量)、capacity(已用空间量,表示为总容量的百分比)和mounted on(挂载点)。
$ df / (rpool/ROOT/solaris):100715496 blocks 100715496 files /devices (/devices ): 0 blocks 0 files /dev (/dev ): 0 blocks 0 files /system/contract (ctfs ): 0 blocks 2147483601 files /proc (proc ): 0 blocks 29946 files /etc/mnttab (mnttab ): 0 blocks 0 files /system/volatile (swap ):42257568 blocks 2276112 files /system/object (objfs ): 0 blocks 2147483441 files /etc/dfs/sharetab (sharefs ): 0 blocks 2147483646 files /dev/fd (fd ): 0 blocks 0 files /tmp (swap ):42257568 blocks 2276112 files /export (rpool/export ):100715496 blocks 100715496 files /export/home (rpool/export/home ):100715496 blocks 100715496 files /export/home/admin (rpool/export/home/admin):100715496 blocks 100715496 files /rpool (rpool ):100715496 blocks 100715496 files /export/repo2010_11(rpool/export/repo2010_11):281155639 blocks 281155639 files /rpool (rpool ):281155639 blocks 281155639 files