`

fdisk命令详解

阅读更多

 

fdisk命令的常用格式是:


(1)# fdisk <硬盘设备名>
进入fdisk的交互操作方式,对指定的硬盘进行分区操作。


(2)# fdisk –l <硬盘设备名>
在命令行方式下显示指定硬盘的分区表信息。


在fdisk的交互操作方式下可以使用若干子命令说明

a   调整硬盘的启动分区
d   删除一个硬盘分区
l    列出所有支持的分区类型
m  列出所有命令
n   创建一个新的分区
p   列出硬盘分区表
q   退出fdisk,不保存更改
t    更改分区类型
u   切换所显示的分区大小的单位
w  把设置写入硬盘分区表,然后退出

 

—————————————————————————————
fdisk 命令使用举例


# fdisk /dev/sdb # 对系统中第二块SCSI接口的硬盘进行分区
Command (m for help): n # 创建新的分区
Command action
e extended
p primary partition (1-4)
p # 键入p 创建主分区
Partition number (1-4): 1 # 输入分区编号1
First cylinder (1-522, default 1): # 直接回车,从硬盘起始柱面创建分区
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-522, default 522):
# 直接回车,分区大小截至到最后一个柱面
Using default value 522
Command (m for help): p # 显示当前分区表
Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 522 4192933+ 83 Linux


Command (m for help): d # 删除已经存在的分区
Selected partition 1
# 由于当前只有一个分区,所以没有被删除分区的编号提示选择,直接将此分区删除
# 若当前存在多个分区,将出现分区的编号提示选择
Command (m for help): p # 显示当前分区表,分区已经被删除
Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): n # 创建大小为500M的1号主分区
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-522, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-522, default 522): +500M
Command (m for help): n # 对所有磁盘剩余空间创建编号为2的扩展分区
Command action
e extended
p primary partition (1-4)
e
Partition number (1-4): 2
First cylinder (63-522, default 63):
Using default value 63
Last cylinder or +size or +sizeM or +sizeK (63-522, default 522):
Using default value 522
Command (m for help): n # 创建大小为400M的逻辑分区
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (63-522, default 63):
Using default value 63
Last cylinder or +size or +sizeM or +sizeK (63-522, default 522): +400M
Command (m for help): n # 创建大小为256M的逻辑分区
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (113-522, default 113):
Using default value 113
Last cylinder or +size or +sizeM or +sizeK (113-522, default 522): +256M
Command (m for help): p # 显示当前分区表
Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 62 497983+ 83 Linux
/dev/sdb2 63 522 3694950 5 Extended
/dev/sdb5 63 112 401593+ 83 Linux
/dev/sdb6 113 144 257008+ 83 Linux
Command (m for help): t # 将5号分区更改为FAT32类型
Partition number (1-6): 5
Hex code (type L to list codes): C
Changed system type of partition 5 to c (Win95 FAT32 (LBA))
Command (m for help): t # 将6号分区更改为swap类型
Partition number (1-6): 6
Hex code (type L to list codes): 82
Changed system type of partition 6 to 82 (Linux swap)
Command (m for help): p # 显示当前分区表,类型已经更改
Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 62 497983+ 83 Linux
/dev/sdb2 63 522 3694950 5 Extended
/dev/sdb5 63 112 401593+ c Win95 FAT32 (LBA)
/dev/sdb6 113 144 257008+ 82 Linux swap
Command (m for help): w # 将当前的分区设置保存,并退出fdisk
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
# fdisk -l /dev/sdb # 在非交互状态下显示当前的分区表信息
Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 62 497983+ 83 Linux
/dev/sdb2 63 522 3694950 5 Extended
/dev/sdb5 63 112 401593+ c Win95 FAT32 (LBA)
/dev/sdb6 113 144 257008+ 82 Linux swap

分享到:
评论

相关推荐

    linux下fdisk命令详解.pdf

    linux下fdisk命令详解.pdflinux下fdisk命令详解.pdf

    linux_fdisk命令详解

    学习linux下fdisk命令

    分区命令FDISK图文详解

    分区命令FDISK图文详解

    Linux fdisk命令用法详解

    Linux fdisk命令 Linux fdisk是一个创建和维护分区表的程序,它兼容DOS类型的分区表、BSD或者SUN类型的磁盘列表。 语法 fdisk [必要参数][选择参数] 必要参数: -l 列出素所有分区表 -u 与”-l”搭配使用,显示...

    Linux fdisk 命令使用详解.docx

    Linux fdisk 命令使用详解.docx

    fdisk分区详解 硬盘的原始分区工具

    fdisk分区详解 硬盘的原始分区工具 Fdisk命令

    Linux之 fdisk 命令操作详解

    文件系统管理-3.1fdisk 命令分区过程 写在前面:自己写完检查可能会有所纰漏,读者们如若发现哪里有错误,可在下方留言或私信我,我会第一时间改正 1. 添加新硬盘 2. 查看新硬盘 fdisk -l 3. 使用 fdisk 命令分区 ...

    Linux下的fdisk命令用法详解

    Linux下的fdisk功能是极其强大的,用它可以划分出最复杂的分区,下面简要介绍一下它的用法: 对于IDE硬盘,每块盘有一个设备名:对应于主板的四个IDE接口,设备名依次为:/dev/hda,/dev/hdb,/dev/hdc,/dev/hdd等, ...

    DOS_常用命令命令详解

    DOS常用命令详解 dir 列文件名 deltree 删除目录树 cls 清屏 cd 改变当前目录 copy 拷贝文件 diskcopy 复制磁盘 del 删除文件 format 格式化磁盘 edit 文本编辑 mem 查看内存状况 md 建立子目录 move 移动文件、...

    DOS常用命令详解 dir 列文件名 deltree 删除目录树 cls 清屏 cd 改变当前目录

    DOS常用命令详解 dir 列文件名 deltree 删除目录树 cls 清屏 cd 改变当前目录 copy 拷贝文件 diskcopy 复制磁盘 del 删除文件 format 格式化磁盘 edit 文本编辑 mem 查看内存状况 md 建立子目录 move 移动文件、改...

    计算机DOS常用命令详解

    dir 列文件名 deltree 删除目录树 cls 清屏 cd 改变当前目录 copy 拷贝文件 diskcopy ...tree 列目录树 debug 随机调试程序 doskey 重新调用DOS命令 prempt 设置提示符 undelete恢复被删的文件 scandisk检测、修理磁盘

    DOS命令详解--高手之路,DOS起步

    一、DOS使用常识 二、DOS的内部命令 三、DOS的外部命令 四、FDISK使用介绍 五、DOS解决问题实战

    我的DOS学习.zip

    我的DOS学习手册大全(入门-进阶+软件) 本压缩包资料内容说明 文件列表与介绍: ... 本电子书用图形方式详细说明在DOS系统下使用Fdisk命令分区操作。 3.dos6.22帮助手册.exe 编批处理必备电子书,多达100多

    DISKGEN命令详解

    DISKGEN命令详解 现在可供选用的硬盘分区工具软件很多,但基本上都是“外国货”,只有被誉为分区小超人的DISKMAN是地地道道的国货。DISKMAN以其操作直观简便的特点为菜鸟级电脑用户所喜爱,但在近两年的时间里,...

    Dos学习笔记(2)

    一.FSUTIL命令详解 二.fixboot 、fixmbr与fdisk /mbr的区别 三.IPConfig命令详解 四. DNS和WINS 五. Telnet Ttlntsvr Tlntadmn 六.系统时间同步更新时提示“RPC服务器不可用”解决办法 七.RPC:远程过程调用...

    Linux常用命令大全.zip

    内含Linux常用必会60+个命令实例以及详解。 Linux提供了大量的命令,利用它可以有效地完成大量的工作, 如磁盘操作、文件存取、目录操作、进程管理、文件权限设定等。 所以,在Linux系统上工作离不开使用系统提供的...

    dos学习大全(dos完全掌握)

    学习大全包括6个部分,dos6.22帮助手册、DOS常用命令宝典、DOS程序员参考手册、fdisk分区详解、Windows XP 启动过程详解、Windows多重引导故障快速修复。

    Linux cfdisk命令用法详解

    cfdisk是用来磁盘分区的程序,它十分类似DOS的fdisk,具有互动式操作界面而非传统fdisk的问答式界面,您可以轻易地利用方向键来操控分区操作。 语法 cfdisk [-avz][-c -h -s ][-P ][外围设备代号] 参数说明: -a 在...

Global site tag (gtag.js) - Google Analytics