Which of the following commands can only be used to create partitions on a GPT hard disk

To get help on how to make a new partition, type: help mkpart.

(parted) help mkpart
  mkpart PART-TYPE [FS-TYPE] START END     make a partition

        PART-TYPE is one of: primary, logical, extended
        FS-TYPE is one of: udf, btrfs, nilfs2, ext4, ext3, ext2, fat32, fat16, hfsx, hfs+, hfs, jfs, swsusp,
        linux-swap(v1), linux-swap(v0), ntfs, reiserfs, hp-ufs, sun-ufs, xfs, apfs2, apfs1, asfs, amufs5,
        amufs4, amufs3, amufs2, amufs1, amufs0, amufs, affs7, affs6, affs5, affs4, affs3, affs2, affs1,
        affs0, linux-swap, linux-swap(new), linux-swap(old)
        START and END are disk locations, such as 4GB or 10%.  Negative values count from the end of the
        disk.  For example, -1s specifies exactly the last sector.

        'mkpart' makes a partition without creating a new file system on the partition.  FS-TYPE may be
        specified to set an appropriate partition ID.

  • Setting filesystem type (FS-TYPE) will not create an ext4 filesystem on /dev/vdc1. You still have to create the ext4 filesystem with mkfs.ext4.

  • A DOS partition table’s partition types are primary, logical, and extended.

  • Providing a partition name under GPT is a must. In a GPT partition table, the partition type is used as the partition name.

Skip to navigation Skip to main content

Utilities

  • Subscriptions
  • Downloads
  • Containers
  • Support Cases

Infrastructure and Management

  • Red Hat Enterprise Linux
  • Red Hat Virtualization
  • Red Hat Identity Management
  • Red Hat Directory Server
  • Red Hat Certificate System
  • Red Hat Satellite
  • Red Hat Subscription Management
  • Red Hat Update Infrastructure
  • Red Hat Insights
  • Red Hat Ansible Automation Platform

Cloud Computing

  • Red Hat OpenShift
  • Red Hat CloudForms
  • Red Hat OpenStack Platform
  • Red Hat OpenShift Container Platform
  • Red Hat OpenShift Data Science
  • Red Hat OpenShift Online
  • Red Hat OpenShift Dedicated
  • Red Hat Advanced Cluster Security for Kubernetes
  • Red Hat Advanced Cluster Management for Kubernetes
  • Red Hat Quay
  • Red Hat CodeReady Workspaces
  • Red Hat OpenShift Service on AWS

Storage

  • Red Hat Gluster Storage
  • Red Hat Hyperconverged Infrastructure
  • Red Hat Ceph Storage
  • Red Hat OpenShift Data Foundation

Runtimes

  • Red Hat Runtimes
  • Red Hat JBoss Enterprise Application Platform
  • Red Hat Data Grid
  • Red Hat JBoss Web Server
  • Red Hat Single Sign On
  • Red Hat support for Spring Boot
  • Red Hat build of Node.js
  • Red Hat build of Thorntail
  • Red Hat build of Eclipse Vert.x
  • Red Hat build of OpenJDK
  • Red Hat build of Quarkus

Integration and Automation

  • Red Hat Process Automation
  • Red Hat Process Automation Manager
  • Red Hat Decision Manager

All Products

Do not attempt to create a partition on a device that is in use.

Procedure 13.1. Creating a Partition

  1. Before creating a partition, boot into rescue mode, or unmount any partitions on the device and turn off any swap space on the device.

  2. Start parted:

    # parted /dev/sda

    Replace /dev/sda with the device name on which you want to create the partition.

  3. View the current partition table to determine if there is enough free space:

    (parted) print

    From the partition table, determine the start and end points of the new partition and what partition type it should be. You can only have four primary partitions, with no extended partition, on a device. If you need more than four partitions, you can have three primary partitions, one extended partition, and multiple logical partitions within the extended. For an overview of disk partitions, see the appendix An Introduction to Disk Partitions in the Red Hat Enterprise Linux 7 Installation Guide.

  4. To create partition:

    (parted) mkpart part-type name fs-type start end

    Replace part-type with with primary, logical, or extended as per your requirement.

    Replace name with partition-name; name is required for GPT partition tables.

    Replace fs-type with any one of btrfs, ext2, ext3, ext4, fat16, fat32, hfs, hfs+, linux-swap, ntfs, reiserfs, or xfs; fs-type is optional.

    Replace start end with the size in megabytes as per your requirement.

    For example, to create a primary partition with an ext3 file system from 1024 megabytes until 2048 megabytes on a hard drive, type the following command:

    (parted) mkpart primary 1024 2048

    If you use the mkpartfs command instead, the file system is created after the partition is created. However, parted does not support creating an ext3 file system. Thus, if you wish to create an ext3 file system, use mkpart and create the file system with the mkfs command as described later.

    The changes start taking place as soon as you press Enter, so review the command before executing to it.

  5. View the partition table to confirm that the created partition is in the partition table with the correct partition type, file system type, and size using the following command:

    (parted) print

    Also remember the minor number of the new partition so that you can label any file systems on it.

  6. Exit the parted shell:

    (parted) quit
  7. Use the following command after parted is closed to make sure the kernel recognizes the new partition:

    # cat /proc/partitions 

The maximum number of partitions parted can create is 128. While the GUID Partition Table (GPT) specification allows for more partitions by growing the area reserved for the partition table, common practice used by parted is to limit it to enough area for 128 partitions.

13.2.1. Formatting and Labeling the Partition

To format and label the partition use the following procedure:

Procedure 13.2. Format and Label the Partition

  1. The partition does not have a file system. To create the ext4 file system, use:

    # mkfs.ext4 /dev/sda6

    Formatting the partition permanently destroys any data that currently exists on the partition.

  2. Label the file system on the partition. For example, if the file system on the new partition is /dev/sda6 and you want to label it Work, use:

    # e2label /dev/sda6 "Work"

    By default, the installation program uses the mount point of the partition as the label to make sure the label is unique. You can use any label you want.

  3. Create a mount point (e.g. /work) as root.

13.2.2. Add the Partition to /etc/fstab

  1. As root, edit the /etc/fstab file to include the new partition using the partition's UUID.

    Use the command blkid -o list for a complete list of the partition's UUID, or blkid device for individual device details.

    In /etc/fstab:

    • The first column should contain UUID= followed by the file system's UUID.

    • The second column should contain the mount point for the new partition.

    • The third column should be the file system type: for example, ext4 or swap.

    • The fourth column lists mount options for the file system. The word defaults here means that the partition is mounted at boot time with default options.

    • The fifth and sixth field specify backup and check options. Example values for a non-root partition are 0 2.

  2. Regenerate mount units so that your system registers the new configuration:

    # systemctl daemon-reload
  3. Try mounting the file system to verify that the configuration works:

    # mount /work

Additional Information

  • If you need more information about the format of /etc/fstab, see the fstab(5) man page.

  1. Previous
  2. Next

Which of the following commands can be used to create partitions on a new disk in Linux?

-Use the fdisk command to create one or more partitions on each of the hard disk drives. -Format any partitions created with a valid filesystem recognized by Linux.

Which command is used to create and manage partitions on a hard disc?

The diskpart create command makes disk partitions, volumes on a single disk or multiple disks, and virtual hard disks. For this and all following commands, you need to open the command prompt before you run diskpart.

Which two commands can be used to create MBR partitions?

Use fdisk , gdisk , and parted to create and modify MBR and GPT partitions. Use mkfs commands to set up ext2, ext3, ext4, xfs, and vfat filesystems.

What does the command dumpe2fs H do?

The dumpe2fs command is used to print the super block and blocks group information for the filesystem present on device. Can be used with ext2/ext3/ext4 filesystem for information.