共计 1628 个字符,预计需要花费 5 分钟才能阅读完成。
fdisk 命令来自于英文词组“Partition table manipulator for Linux”的缩写,其性能是用于治理磁盘的分区信息。如果一套几百平米的房子外部没有墙壁,尽管看起来会很敞亮,然而各种声音、气息、物品会随便充斥在整个房子内,让人极不舒服,因而须要用墙壁依照性能进行划分,例如卧室、厕所、厨房、阳台等等。
fdisk 命令能够用于对磁盘进行分区操作,用户能够依据理论状况进行正当划分,这样前期挂载和应用时会不便很多。
语法格局: fdisk [参数] [设施]
罕用参数:
-b | 指定每个分区的大小 |
---|---|
-l | 列出指定的外围设备的分区表情况 |
-s | 将指定的分区大小输入到规范输入上,单位为区块 |
-u | 搭配”-l”参数列表,会用分区数目取代柱面数目,来示意每个分区的起始地址 |
-v | 显示版本信息 |
参考实例
查看以后零碎的分区状况:
[root@linuxcool ~]# fdisk -l
Disk /dev/sda: 20 GiB, 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
Disklabel type: dos
Disk identifier: 0x5f1d8ee5
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 41943039 39843840 19G 8e Linux LVM
………………省略局部输入信息………………
治理指定硬盘的分区(过程省略 ):
[root@linuxcool ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
All space for primary partitions is in use.
Command (m for help): m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
………………省略局部输入信息………………
正文完