Bootstrap FreeKB - Linux Commands - gdisk (format disk partition)
Linux Commands - gdisk (format disk partition)

Updated:   |  Linux Commands articles

Formatting a storage device typically involves the following steps. This article includes the directions for steps 1 and 2.

  1. Create one or more partitions
  2. Assign a type to the partition
  3. Format each partition to use a certain type of file system

The fdisk command partitions a drive as MBR (master boot record). The gdisk command partitions a drive as GPT (GUID partition table). The parted command can partition a drive as either MBR or GPT. MBR is typically needed for systems with old hardware or software, because GPT is not backwards compatible with old hardware or software. gdisk or parted can be used if the system is using modern hardware and software. GPT is typically used if you need a create a partition greater than 2 TB.

In this example, we will create a new primary partition on the third storage device /dev/sdc.

  1. In Terminal, type gdisk /dev/sdc if this disk is new and has never been formatted, or gdisk /dev/sdc1 if the disk has been used and formatted before, and press enter
  2. Type and press enter to create a new partition
  3. Type and press enter to create a primary partition
  4. When prompted Partition number, press enter to use the default partition number
  5. When prompted First sector, press enter to use the default first sector
  6. When prompted Last sector, press enter to use the default last sector
  7. Type t and press enter to set the partition type
  8. Type the code for the type you wish to use and press enter. For example, type 8e00 and press enter to use Linux LVM (Logical Volume Group) or fd00 to use Linux RAID auto.

Note: Type L and press enter to view all of the available codes

  1. Type and press enter to write the changes

 

Use the partprobe command to update the system to recongize the new partition.

~]# partprobe

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 4db617 in the box below so that we can be sure you are a human.