LinuxCommandLibrary

addpart

Add a new partition to a disk

TLDR

Tell the kernel about the existence of the specified partition

$ addpart [device] [partition] [start] [length]
copy

SYNOPSIS

addpart [device] [start] [size] (non-standard syntax)

PARAMETERS

-h or --help
    Display help (if implemented)

device
    Block device like /dev/sda

start
    Starting sector or position

size
    Partition size

DESCRIPTION

The addpart command is not part of standard Linux distributions' core utilities (e.g., util-linux, parted). It occasionally appears in custom scripts, embedded systems, rescue environments, or installers like Debian's partman partition editor, where it may dynamically inform the kernel of new partitions without rebooting. In general usage, equivalent functionality is provided by tools like partprobe(8), which rereads partition tables, or kpartx(8) for device-mapper partitions. Users seeking to add partitions typically use fdisk(8), parted(8), or gdisk(8) to create them, followed by partprobe to update the kernel's view.

Without a standard man page, exact behavior varies by implementation. It might take arguments like device, start sector, and size to register a partition entry in /proc/partitions. Caution is advised as improper use can lead to data corruption. Always verify with blockdev --rereadpt or partprobe post-modification.

CAVEATS

Not standard; may not exist on your system. Risk of kernel panic or data loss if misused. Prefer partprobe(8) or reboot after partitioning.

ALTERNATIVES

Use parted /dev/sda mkpart primary 1MiB 100MiB then partprobe /dev/sda for standard partition addition.

VERIFICATION

Check with cat /proc/partitions or lsblk after use.

HISTORY

No formal history; referenced in niche contexts like boot scripts since early 2000s. Superseded by standardized tools in util-linux.

SEE ALSO

partprobe(8), parted(8), fdisk(8), gdisk(8), kpartx(8), blockdev(8)

Copied to clipboard