How to use the command 'addpart' (with examples)

How to use the command 'addpart' (with examples)

The command ‘addpart’ is used to tell the Linux kernel about the existence of a specified partition. It is a simple wrapper around the ‘add partition’ ioctl. This command is helpful when you need to inform the Linux kernel about the presence of a new partition.

Use case 1: Tell the kernel about the existence of the specified partition

Code:

addpart /dev/sdb 1 0 100M

Motivation: The motivation for using this command is to inform the Linux kernel about the existence of a new partition on the ‘/dev/sdb’ device.

Explanation:

  • addpart is the command used to add a partition.
  • /dev/sdb is the device on which the partition needs to be added.
  • 1 is the partition number.
  • 0 is the starting sector of the partition.
  • 100M is the length of the partition in megabytes.

Example Output:

Adding partition 1 to /dev/sdb... Done!

In the above example, we use the ‘addpart’ command to add partition number 1 to the ‘/dev/sdb’ device, starting from sector 0 and with a length of 100 megabytes. The command successfully informs the kernel about the existence of the specified partition.

Conclusion:

The ‘addpart’ command is a straightforward way to inform the Linux kernel about the existence of a partition. By using this command, you can easily add partitions to devices and ensure that the kernel is aware of the new partitions.

Related Posts

How to use the command 'git log' (with examples)

How to use the command 'git log' (with examples)

Git log is a command that allows you to view the commit history of a Git repository.

Read More
How to use the command "vipw" (with examples)

How to use the command "vipw" (with examples)

Code: vipw Motivation: The vipw command is used to edit the password file in Unix-like operating systems, such as Linux.

Read More
How to use the command gitmoji (with examples)

How to use the command gitmoji (with examples)

The gitmoji command is an interactive command-line tool that allows users to use emojis on their git commits.

Read More