partx command examples

partx command examples

partx – tell the Linux kernel about the presence and numbering of on-disk partitions

#partx --show /dev/sdb3
#partx --show --nr 3 /dev/sdb
#partx --show /dev/sdb3 /dev/sdb

All three commands list partition 3 of /dev/sdb.

#partx --show - /dev/sdb3

Lists all subpartitions on /dev/sdb3 (the device is used as whole-disk).

#partx -o START -g --nr 5 /dev/sdb

Prints the start sector of partition 5 on /dev/sdb without header.

#partx -o SECTORS,SIZE /dev/sda5 /dev/sda

Lists the length in sectors and human-readable size of partition 5 on /dev/sda.

#partx --add --nr 3:5 /dev/sdd

Adds all available partitions from 3 to 5 (inclusive) on /dev/sdd.

#partx -d --nr :-1 /dev/sdd

Removes the last partition on /dev/sdd.


Leave a Reply

Your email address will not be published. Required fields are marked *