← 返回命令列表

Linux command

delpart 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Forget partition 1 of /dev/sda

sudo delpart [/dev/sda] [1]

Forget an NVMe partition

sudo delpart [/dev/nvme0n1] [3]

Show help

delpart --help

说明

delpart asks the Linux kernel to forget about the specified partition (by number) on the given block device. It is a thin wrapper around the `BLKPG_DEL_PARTITION` ioctl and updates only the kernel's in-memory view — the on-disk partition table is not touched. Typical use is after manually editing a partition table with fdisk or parted while other partitions on the same disk remain busy: delpart removes the kernel node for a single partition so it can be recreated with addpart, avoiding a full re-read of the table (as partprobe or `blockdev --rereadpt` would attempt).

参数

-h, --help
Display help and exit.
-V, --version
Display version information and exit.

FAQ

What is the delpart command used for?

delpart asks the Linux kernel to forget about the specified partition (by number) on the given block device. It is a thin wrapper around the `BLKPG_DEL_PARTITION` ioctl and updates only the kernel's in-memory view — the on-disk partition table is not touched. Typical use is after manually editing a partition table with fdisk or parted while other partitions on the same disk remain busy: delpart removes the kernel node for a single partition so it can be recreated with addpart, avoiding a full re-read of the table (as partprobe or `blockdev --rereadpt` would attempt).

How do I run a basic delpart example?

Run `sudo delpart [/dev/sda] [1]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -h, --help do in delpart?

Display help and exit.