New Ubuntu disk partition with Parted

The follow process has been tested on Ubuntu versions 18.04 and 20.04 but may also work on newer versions.

Run the following command to determine the new path assigned to your new disk:

sudo lshw -C disk | grep 'logical name\|size'

 

This should produce an output similar to this:

  logical name: /dev/sda
      size: 60GiB
  logical name: /dev/sdb
      size: 100GiB

I’ll be partitioning /dev/sdb and using the full available space.

Start parted as follows:

sudo parted /dev/sdb

 

Create a new GPT disklabel:

(parted) mklabel gpt

 

Set the default unit to GB or TB (i’ll be using GB as it’s only 100GB):

(parted) unit GB

 

Create one partition occupying all the space:

(parted) mkpart
Partition name?  []? primary
File system type?  [ext2]? ext4
Start? 0
End? 100

 

Verify with:

(parted) print

 

Quit “parted”:

(parted) quit

 

Format the new partition (use one of these commands to format to fat32 or ext4):

sudo mkfs -t ext4 /dev/sdb1
sudo mkfs -t fat32 /dev/sdb1

 

Leave a Comment

Your email address will not be published. Required fields are marked *