格式:fdisk [options] -l [disk]
-l 设备名称:查看磁盘信息
不加磁盘设备为查看当前系统所有磁盘设备信息
[root@localhost ~]# fdisk -l
Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 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 label type: dos
Disk identifier: 0x0009fae8
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 12130303 5859328 82 Linux swap / Solaris
/dev/sda3 12130304 104857599 46363648 83 Linux
Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 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
-l 设备名称:查看磁盘信息
[root@localhost ~]# fdisk -l /dev/sda
Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 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 label type: dos
Disk identifier: 0x0009fae8
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 12130303 5859328 82 Linux swap / Solaris
/dev/sda3 12130304 104857599 46363648 83 Linux
格式:fdisk [options] [disk]
子命令:管理功能
m:帮助菜单
o:创建一个新的空DOS(MBR)分区表;一般磁盘默认即为MBR模式
g:创建一个新的空GPT分区表
p:print, 显示已有分区;
n:new, 创建新分区(主分区“p”、扩展分区“e”)
d:delete, 删除分区(删分区规则是从后往前删除)
w:write, 写入磁盘保存并退出
q:quit, 放弃更新并退出
l:列出所有分区id
t:调整分区id
IT运维网 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明Linux磁盘分区管理命令-fdisk!