This comprehensive Linux guide expects that you run the following commands as root user but if you decide to run the commands as a different user then ensure that the user has
sudoaccess and that you precede each of the privileged commands withsudo
Given a device or disk-image, partx tries to parse the partition table and list its contents. It optionally adds or removes partitions. The disk argument is optional when a partition argument is provided.
It is a very useful utility to tell the Linux kernel about the presence and numbering of on-disk partitions. In this tutorial, we will show you multiple ways to use the partx command with examples. 
Displaying Partition Table Of A Disk
You can run the following command to display the partition table of a disk.
root@codesposts:~$ partx --show /dev/sda10You can replace the sda10 with the specific node you want. 
Displaying All Sub-Partitons on /dev/sda  
If you want to display all the sub-partitions on /dev/sda, you can run the command like below 
root@codesposts:~$ partx --show /dev/sdaSpecifying The Range Of Partitions
If you want to specify the range of the partitions to be displayed in the output, you can use the option --nr. And you can also use the option -o to define the output columns. 
Example:
root@codesposts:~$ partx -o START, END --nr 10 /dev/sdaReading The Disk And Adding All Partitions To The System
If you want to read a disk and add all the partitions to the system, you can run the command like below:
root@codesposts:~$ partx -v -a /dev/sdb Displaying The Length In Sectors
If you want to display the length of partition 3 on /dev/sdb in sectors, run the command like below:
root@codesposts:~$ partx -o SECTORS,SIZE  /dev/sdb3 /dev/sdb Adding The Specified Partitions
If you want to add the specified partitions, you can run the command like below:
root@codesposts:~$ partx -a --nr 2:6 /dev/sdbThis will add the partitions 4-6 inclusive on /dev/sdb
Removing A Partition
To remove a partition from the system, you can run the following command:
root@codesposts~:$ partx -d --nr :-1 /dev/sddThis will remove the last partition on /dev/sdd
Disabling The Header In The Output
To disable the header in the output, run the command like below:
root@codesposts:~$ partx -o START -g --nr 8 /dev/sdb
 
					 
								 
								 
								 
								 
								