2192

11 分钟

#Bash 的 addpart 命令

addpart device partition start length

功能

通知内核添加硬盘分区(不会实际创建分区)。

类型

可执行文件(/usr/bin/addpart),属于 util-linux

参数

  • device - 硬盘设备
  • partition - 分区号
  • start - 分区的开始位置(以 512 字节扇区为单位)
  • length - 分区的长度(以 512 字节扇区为单位)

#示例

sudo addpart /dev/sda 3 2097152 1048576

#相关命令

命令说明
delpart移除硬盘分区

#推荐阅读

#手册

ADDPART(8) System Administration ADDPART(8) NAME addpart - tell the kernel about the existence of a partition SYNOPSIS addpart device partition start length DESCRIPTION addpart tells the Linux kernel about the existence of the specified partition. The command is a simple wrapper around the "add partition" ioctl. This command doesn’t manipulate partitions on a block device. PARAMETERS device The disk device. partition The partition number. start The beginning of the partition (in 512-byte sectors). length The length of the partition (in 512-byte sectors). -h, --help Display help text and exit. -V, --version Print version and exit. SEE ALSO delpart(8), fdisk(8), parted(8), partprobe(8), partx(8) REPORTING BUGS For bug reports, use the issue tracker at https://github.com/util-linux/util-linux/issues. AVAILABILITY The addpart command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>. util-linux 2.39.3 2023-10-23 ADDPART(8)

更新: 2026/1/5

作者: PlanC

创建: 2026/1/5