语法:
fdisk [-l] 装置名称
选项与参数:
- -l :输出后面接的装置所有的分区内容。若仅有 fdisk -l 时, 则系统将会把整个系统内能够搜寻到的装置的分区均列出来。
实例
列出所有分区信息
[root@AY120919111755c246621 tmp]# fdisk -l Disk /dev/xvda: 21.5 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x00000000 Device Boot Start End Blocks Id System
/dev/xvda1 * Linux
/dev/xvda2 Linux swap / Solaris Disk /dev/xvdb: 21.5 GB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x56f40944 Device Boot Start End Blocks Id System
/dev/xvdb2 + Linux
找出你系统中的根目录所在磁盘,并查阅该硬盘内的相关信息
[root@www ~]# df / <==注意:重点在找出磁盘文件名而已
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hdc2 % / [root@www ~]# fdisk /dev/hdc <==仔细看,不要加上数字喔!
The number of cylinders for this disk is set to .
There is nothing wrong with that, but this is larger than ,
and could in certain setups cause problems with:
) software that runs at boot time (e.g., old versions of LILO)
) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/ FDISK) Command (m for help): <==等待你的输入!
输入 m 后,就会看到底下这些命令介绍
Command (m for help): m <== 输入 m 后,就会看到底下这些命令介绍
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition <==删除一个partition
l list known partition types 列出分区信息
m print this menu 打印分区
n add a new partition <==新增一个partition
o create a new empty DOS partition table
p print the partition table <==在屏幕上显示分割表
q quit without saving changes <==不储存离开fdisk程序
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit <==将刚刚的动作写入分割表
x extra functionality (experts only)
离开 fdisk 时按下 q
,那么所有的动作都不会生效!相反的, 按下w
就是动作生效的意思。
Command (m for help): p <== 这里可以输出目前磁盘的状态 Disk /dev/hdc: 41.1 GB, bytes <==这个磁盘的文件名与容量
heads, sectors/track, cylinders <==磁头、扇区与磁柱大小
Units = cylinders of * = bytes <==每个磁柱的大小 Device Boot Start End Blocks Id System
/dev/hdc1 * Linux
/dev/hdc2 + Linux
/dev/hdc3 + Linux
/dev/hdc4 Extended
/dev/hdc5 Linux swap / Solaris
# 装置文件名 启动区否 开始磁柱 结束磁柱 1K大小容量 磁盘分区槽内的系统 Command (m for help): q
想要不储存离开吗?按下 q 就对了!不要随便按 w 啊!
使用 p
可以列出目前这颗磁盘的分割表信息,这个信息的上半部在显示整体磁盘的状态。