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...

Leave a Reply

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

Notify of
Sort by:   newest | oldest
alexh
Member
alexh

the youtube link for disk partitioning is no longer valid 🙁

wpDiscuz

RHCSA7: Task of the day

Allowed time: 10 minutes.
Create a XFS file system of 100MB. Mount it under /mnt. Then, increase its size by 50MB.

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.

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 ...