SYS: List, create, delete, and set partition type for primary, extended, and logical partitions.

Share this link

To list all the partitions, type:

# fdisk -l

To create a primary partition on a disk (here /dev/vda), type:

# fdisk /dev/vda

Press ‘c‘, ‘u‘, then ‘p‘ to print the partition table.
Then press ‘n‘ (for new), type the partition number (between 1 and 4), the first sector and the size.
Finally, press ‘w‘ to save the partition table.

To delete a primary partition on a disk (here /dev/vda), type:

# fdisk /dev/vda

Press ‘c‘, ‘u‘, then ‘p‘ to print the partition table.
Then press ‘d‘ (for delete) and type the partition number (between 1 and 4).
Finally, press ‘w‘ to save the partition table.

To set the type of a primary partition (here /dev/vda3), type:

# fdisk /dev/vda

Press ‘c‘, ‘u‘, then ‘p‘ to print the partition table.
Then press ‘t‘ (for tag), type the partition number (here ‘3‘) and the partition type (83 for linux, 8e for Linux LVM, 82 for swap).
Finally, press ‘w‘ to save the partition table.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
2 comments on “SYS: List, create, delete, and set partition type for primary, extended, and logical partitions.
  1. alexh says:

    the youtube link for disk partitioning is no longer valid 🙁

Leave a Reply

Upcoming Events (Local Time)

There are no events.

RHCSA7: Task of the day

Allowed time: 10 minutes.
Create an EXT4 file system mounted under /vol based on a logical volume of 100MB.
Reduce the size to 60MB.

RHCE7: Task of the day

Allowed time: 8 minutes.
Set up an iScsi target based on a block backstore of 100MB called lv_iscsi with basic authentication, ext4 filesystem and standard firewall configuration.

Follow me on Twitter

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...