df - 报告文件系统磁盘空间的使用情况 

总览

df [OPTION]... [FILE]... POSIX 选项: [-kP]

GNU 选项 (最短方式): [-ahHiklmPv] [-t fstype] [-x fstype] [--block-size=size] [--print-type] [--no-sync] [--sync] [--help] [--version] [--]

描述

此手册页文档是df的GNU版本. df命令列出指定的每一个文件名所在的文件系统上可用磁盘空间的数量。 如果没有指定文件名,则显示当前所有使用中的文件系统.缺省设置时, 磁盘空间以1K为一块显示,如果环境变量POSIXLY_CORRECT已设 置,则采用512字节为一块显示. 如果参数是一个包含已使用文件系统的磁盘设备名, df命令显示出的是该文件系统的可用空间,而非包含设备结点的文件系 统(只能是根文件系统).此版本的df不能显示未使用文件系统的可用空 间,这是由于大多数系统在响应这样的请求时必须很清楚该文件系统的 结构.

GNU 参数说明

-a, --all
    列出包括BLOCK为0的文件系统 
--block-size=SIZE use SIZE-byte blocks
    指定块的大小 
-h,--huma-readable
    用常见的格式显示出大小(例如:1K 234M 2G) 
-H,--si
    同上,但是这里的1k等于1000字节而不是1024字节 
-i, --inodes
    用信息索引点代替块表示使用状况 
-k, --kilobytes
    指定块大小等于1024字节来显示使用状况 
-l, --local
    只显示本地文件系统使用状况 
-m, --megabytes
    以指定块大小等于1048576字节(1M)来显示使用状况 
--no-sync
    在取得使用信息前禁止调用同步 (default) 
-P, --portability
    使用POSIX格式输出 
--sync
    在取得使用信息前调用同步 
-t, --type=TYPE
    只显示指定类型(TYPE)的文件系统 
-T, --print-type
    输出每个文件系统的类型 
-x, --exclude-type=TYPE
    只显示指定类型(TYPE)之外的文件系统. 
-v (忽略)
--help
    输出该命令的帮助信息并退出 
--version
    输出版本信息并退出

例:

[root@localhost ~]# df #列出各文件系统的磁盘空间使用情况</p> <p>[root@localhost ~]# df -ia #列出各文件系统的i节点使用情况</p> <p>[root@localhost ~]# df -T #列出文件系统的类型</p> <p>[root@localhost ~]# df -h #目前磁盘空间和使用情况 以更易读的方式显示</p> <p>[root@localhost ~]# df -k #以单位显示磁盘的使用情况

fdisk磁盘分区命令

-v
    打印 fdisk 的版本信息并退出.
-l
    列出指定设备的分区表信息并退出。 如果没有给出设备,那么使用那些在 /proc/partitions (如果存在)提到的.
-u
    以扇区数而不是以柱面数的形式显示分区表中各分区的信息. -s 分区 将分区的 大小 (单位为块)信息输出到标准输出

例a,查看所有分区

[root@localhost ~]# fdisk -l </p> <p>Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes</p> <p> Device Boot Start End Blocks Id System
/dev/sda1 * 1 17 136552 83 Linux
/dev/sda2 18 279 2104515 82 Linux swap / Solaris
/dev/sda3 280 60801 486142965 5 Extended
/dev/sda5 280 60801 486142964+ 83 Linux

例b,fdisk分区

[root@localhost ~]# fdisk /dev/hdc #分区时,不要加上数字
The number of cylinders for this disk is set to 5005.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)</p> <p>Command (m for help): m #可以查看帮助</p> <p>Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition #删除分区
l list known partition types #列举已知分区
m print this menu
n add a new partition #增加分区
o create a new empty DOS partition table
p print the partition table #显示分区表
q quit without saving changes #不保存退出分区
s create a new empty Sun disklabel
t change a partition's system id #改变分区ID
u change display/entry units
v verify the partition table
w write table to disk and exit #保存分区操作
x extra functionality (experts only)

Command (m for help): p </p> <p>Disk /dev/hdc: 41.1 GB, 41174138880 bytes #磁盘名称和大小
255 heads, 63 sectors/track, 5005 cylinders #磁头、磁区与磁柱数量,多少
Units = cylinders of 16065 * 512 = 8225280 bytes #每个磁柱的大小</p> <p> Device Boot Start End Blocks Id System
/dev/hdc1 * 1 13 104391 83 Linux
/dev/hdc2 14 1288 10241437+ 83 Linux
/dev/hdc3 1289 1925 5116702+ 83 Linux
/dev/hdc4 1926 5005 24740100 5 Extended
/dev/hdc5 1926 2052 1020096 82 Linux swap / Solaris</p> <p>Command (m for help): q # q是不保存退出,w不要随便输入

例c,-c 以柱面显示

[root@server7 ~]# fdisk -cl /dev/vdb</p> <p>Disk /dev/vdb: 8589 MB, 8589934592 bytes
16 heads, 63 sectors/track, 16644 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xce720981</p> <p> Device Boot Start End Blocks Id System
/dev/vdb1 3 206 102400 83 Linux
/dev/vdb2 206 409 102400 83 Linux
/dev/vdb3 409 612 102400 83 Linux
[root@server7 ~]# fdisk -ul /dev/vdb</p> <p>Disk /dev/vdb: 8589 MB, 8589934592 bytes
16 heads, 63 sectors/track, 16644 cylinders, total 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xce720981</p> <p> Device Boot Start End Blocks Id System
/dev/vdb1 2048 206847 102400 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vdb2 206848 411647 102400 83 Linux
Partition 2 does not end on cylinder boundary.
/dev/vdb3 411648 616447 102400 83 Linux
Partition 3 does not end on cylinder boundary.

Linux中df命令查询磁盘信息和fdisk命令分区的用法的更多相关文章

  1. Linux中挂载新的磁盘到指定目录或分区

    新增磁盘的设备文件名为 /dev/vdb 大小为100GB. #fdisk -l  查看新增的的磁盘 1.对新增磁盘进行分区 #fdisk /dev/vdb 按提示操作 p打印  n新增 d 删除 w ...

  2. Linux目录和文件——查询目录和文件的命令

    Linux目录和文件——查询目录和文件的命令 摘要:本文主要学习了在Linux系统中是如何查询目录和文件的. which命令 which命令是根据PATH环境变量设置的路径,去搜索执行文件. 基本语法 ...

  3. bat命令查询硬件信息

    bat命令查询硬件信息 50 需求是这样的写一个bat命令,当命令执行的时候,先请用户输入姓名,然后继续执行查询出以下信息并写入一个文件,文件名称随便,文件可以放在与当前命令同一个文件夹下.最终文件中 ...

  4. Linux 中 &、jobs、fg、bg 等命令

    参考  Unix 或 Linux 中 &.jobs.fg.bg 等命令的使用方法 对之前文章的一个补充: linux 命令后台运行 这篇还是比较简单的,稍微一带而过 fg.bg.jobs.&a ...

  5. [转]Linux中set,env和export这三个命令的区别

    转自:http://www.2cto.com/os/201306/223758.html Linux中set,env和export这三个命令的区别   set命令显示当前shell的变量,包括当前用户 ...

  6. linux中df和du查看磁盘大小不一致解决方法

    挂了一块50G到/data目录下#  df -h Filesystem Size Used Avail Use% Mounted on /dev/xvdb1 50G 46G 1.2G 98% /dat ...

  7. Linux系统中CPU使用率查询常用的5个命令

    在程序开发中,我们一般都是在Linux系统上进行开发,因此对Linux系统的维护工作很重要.在Linux系统维护中,我们需要经常查看的就是cpu的使用率,分析系统的整体运行情况.那CPU使用率怎么查询 ...

  8. linux中创建和解压文档的 tar 命令教程

    linux & zip & tar https://www.cnblogs.com/xgqfrms/p/9714161.html 1 linux中的tar命令 tar(磁带归档)命令是 ...

  9. linux命令之磁盘与文件系统管理命令(上)

    1.fdisk:磁盘分区工具 该命令是linux下常用的磁盘分区工具,但是只能给小于2TB的磁盘划分分区. 常用参数为-l,显示所有磁盘分区的信息. 示例: 1)显示磁盘分区列表 [root@boxi ...

随机推荐

  1. laragon 使用(php版本升级切换)

    php版本升级切换 1.下载对应不带 nts 的php版本(http://windows.php.net/download/),然后解压放到\laragon\bin\php目录下 2.记得改环境变量下 ...

  2. PhoneGap 获得设备属性Demo

    <!DOCTYPE html> <html> <head> <title>设备属性Demo</title> <script type= ...

  3. hiho一下第109周《Tower Defense Game》

    题目链接:传送门 题目大意:给你一棵树,根节点为1,树上每一个节点都有一个花费值和收入值(花费值>=收入值),要访问一个节点需先支付花费值,访问该节点结束后得到收入值 同时访问树时要求是有序的, ...

  4. SAFEARRAY的使用(转载)

    以下就是SAFEARRAY的Win32定义: typedef struct tagSAFEARRAY { unsigned short cDims; unsigned short fFeatures; ...

  5. 【MarkDown】使用Html样式和折叠语法

    MarkDown很方便,但基本语法有些不足:比如无法使用折叠语法,无法让文字有不同的颜色. 这些功能可以实现,不过需要使用Html语法进行扩展.这篇文章主要是整理一下这些技巧,方便更好的使用. 一.折 ...

  6. MySQL主从不一致修复

    场景: 线上正在服务的库由于紧急主从切换导致主从不一致,报错信息如下: Last_Error: Coordinator stopped because there were error(s) in t ...

  7. c# WinForm软件启动拦截(通过更改文件关联实现)

    前几天想做一个软件启动之前拦截的程序,找了下网上的资料没有找到合适的,突然看到电脑软件某看图软件,找到个思路就是跟他一样的,通过修改文件关联进行启动拦截. 原理是这样的,更改.exe默认的启动方式为我 ...

  8. 2.2 - ATM+购物商城程序

    要求:模拟实现一个ATM + 购物商城程序1.额度 15000或自定义2.实现购物商城,买东西加入 购物车,调用信用卡接口结账3.可以提现,手续费5%4.支持多账户登录5.支持账户间转账6.记录每月日 ...

  9. shell判断文件/目录是否存在

    https://www.cnblogs.com/37yan/p/6962563.html caution!!! if should be end with fi caution!!! there sh ...

  10. oracle Dba之路

    如何快速的成为一个合格的 DBA? 2010年11月03日 11:25:00 阅读数:584 原文来自:http://topic.csdn.net/u/20101031/21/A78B2EA1-6F2 ...