GPT partitioning with 'parted' utility

GPT is the new developed partitioning scheme as opposed to MBR. GPT allows us to create up to 128 partitions. It does not  divide partitions in primary, extended and logical like we have seen in our previous post.

I would strongly recommend to go through my previous post before you proceed further. In previous post I have thoroughly explained about parted utility.

Continuing with previous post, our goal here is to,
  • Create a GPT on USB disk
  • Create partitions
Create a GPT on USB disk
  • On terminal, run parted /dev/sdb which takes you into parted mode showing parted version number and welcome message
  • Run print or p in parted mode which shows disk information on which all your operations will be performed. This is to make sure that you are not doing any unwanted or unexpected with your desired disk. So, I would say check print command to avoid any future undesired circumstances.
  • Now create a partitioning scheme or label(in other terms) with mklabel, it asks for label type since we want GPT, we'll give gpt, it warns you saying your data will be destroyed... just verify once your disk(/dev/sdb) and then type Yes. 
That's it !! parted has created GPT on /dev/sdb. Check this with print command, Partition Table now shows as gpt which was msdos before.

NOTE: After typing msdos if you get this message Warning: Partition(s) on /dev/sdb are being useddon't worry just unmount your disk with umount /dev/sdb and you are ready to go because parted doesn't allow to perform operation on mounted disk.

All above commands are shown here,





















If you observe, we have created partition table but there is no actual partition in the partition table which means it is empty. We will create partitions now.

Create partitions
  • On parted mode, run mkpart which is used to create a new partition
  • It asks for partition name, file system, start size and end size. Give appropriate parameters as shown below. Choose default FIle system type by pressing ENTER key as we are not creating any file systems now.
  • You can see from last print command, we have successfully create partitions in /dev/sdb.
  • Run quit command to exit from parted mode
















Notes:
  • MB is considered as default unit if we do not wish to specify while giving size (see the creation of extended partition)
  • You could 0% for staring address of disk and 100% of ending address of disk (I have used 100% while creating extended partition)
  • Unlike MBR, GPT allows us to create up to 128 partitions and there is nothing like extended/logical partitions
  • While creating a partition, parted asks for partition name instead of partition type(in case of MBR) since there are no different partitions here. See partition which we have created has name of "raxesh"

Comments

Popular posts from this blog

MBR partitioning with 'parted' utility

Disk Partitioning: MBR vs GPT

Replace default splash screen in Yocto