• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

partx Command Examples in Linux

by Deepika

“partx” is a Linux command line tool used for adding and deleting partition information from the Linux kernel’s representation of a block device (such as a hard drive). The tool reads partition table information from a block device and informs the kernel of the partitions that exist on the device, allowing the kernel to access and use the partitions.

When a partition is created or deleted, the kernel’s representation of the block device is not immediately updated. The “partx” tool must be run to notify the kernel of the change. This is important because the kernel is responsible for accessing the block device and its partitions, and if it is not aware of the partitions, they will not be accessible to the system.

“partx” can be used with a variety of different partition table formats, including the traditional Master Boot Record (MBR) format and the newer GUID Partition Table (GPT) format. The tool can be used to add and remove partitions one by one, or it can be used to update the kernel’s representation of an entire block device, which is useful when working with devices that have multiple partitions.

partx Command Examples

1. List the partitions on a block device or disk image:

# sudo partx --list path/to/device_or_disk_image

2. Add all the partitions found in a given block device to the kernel:

# sudo partx --add --verbose path/to/device_or_disk_image

3. Delete all the partitions found from the kernel (does not alter partitions on disk):

# sudo partx --delete path/to/device_or_disk_image

Filed Under: Linux

Some more articles you might also be interested in …

  1. After Reboot RAID1 Disk Gets Removed/Out of Sync (CentOS/RHEL)
  2. How to check change log of RPM packages on CentOS/RHEL
  3. Linux OS Service ‘named’
  4. Intel I219-LM Centos 6 network failed to start
  5. cgcreate: command not found
  6. How to configure kdump in Oracle Enterprise Linux (OEL 5,6)
  7. How to Re-generate initramfs and vmlinuz for Rescue Kernel with Current Kernel in CentOS/RHEL 7
  8. ipcmk: command not found
  9. Understanding /etc/profile Configuration File in Linux
  10. How to change the number of commands stored in Bash History

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright