
Linux fdisk 工具
fdisk 是 Linux 系统中用于创建和管理分区表的实用程序,支持 DOS 类型的分区表、BSD 或 SUN 类型的磁盘列表。
语法格式
fdisk [必需参数][可选参数]
必需参数:
- -l 列出所有分区信息
- -u 搭配 -l 使用,显示分区数量
可选参数:
- -s 指定具体分区
- -v 显示版本信息
交互菜单功能说明
- m :查看菜单及帮助内容
- a :激活或取消引导分区
- d :删除已有分区
- l :列出可用的分区类型
- n :新建一个分区
- p :打印当前分区详情
- q :退出且不保存更改
- t :修改分区标识
- v :验证分区表完整性
- w :保存并写入更改
- x :扩展功能选项,适用于高级操作
示例演示
查看当前系统分区状态:
# fdisk -lDisk /dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1305 10377990 8e Linux LVM
Disk /dev/sdb: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table
展示 SCSI 磁盘各分区详细信息:
# fdisk -luDisk /dev/sda: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 63 208844 104391 83 Linux /dev/sda2 208845 20964824 10377990 8e Linux LVM
Disk /dev/sdb: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders, total 10485760 sectors Units = sectors of 1 * 512 = 512 bytes
Disk /dev/sdb doesn't contain a valid partition table










