This guide assumes the disk is present and detectable in the system.

Given the infrequent nature of this tool for me, I run it in interactive mode.

# Launch parted
$ sudo parted

GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.

Finding Devices

The first we need to know is what device we are going to work with. The most basic way to see what devices are available is:

# List available devices
$ (parted) print devices

/dev/sda (42.9GB)
/dev/sdb (8590MB)

I have an 8GB volume attached for testing, which means I want to work with /dev/sdb. Using fdisk -l is also useful for determining what device to use. If you don't know what you are looking for in, print list will provide more detail about the devices.

# List available devices with more information.
(parted) print list

Disk /dev/sda: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  1075MB  1074MB  primary  ext4         boot
 2      1075MB  42.9GB  41.9GB  primary               lvm

Error: /dev/sdb: unrecognised disk label
Model: ATA VBOX HARDDISK (scsi)                                           
Disk /dev/sdb: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags: 

Again we can see /dev/sdb is 8GB, but does not have a label or partition table. A good sign this is the raw disk we want to work with.

Selecting the device.

Now we know what device we want to use, we need to select it. If you know the device details before starting, you can specify it on the cli when start parted

# Select the device from interactive mode
(parted) select /dev/sdb

Using /dev/sdb

# Select the disk from the bash prompt if you already know the device
$ sudo parted /dev/sdb

GNU Parted 3.2
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.

Create the Partition

Valid partition label types: "aix", "amiga", "bsd", "dvh", "gpt","loop", "mac", "msdos", "pc98", or "sun". If the volume is above 2TB, you will probably need to use gpt, as msdos doesn't support volumes above 2TB.

# Create the partition table
(parted) mklabel     

New disk label type? gpt

Once the label has been set, we need to make the partition. Here there are four questions:

Option Description
Name Name of partition; can be placed in double quotes.
File System Type Can be any of the following: "btrfs", "ext2", "ext3", "ext4", "fat16", "fat32", "hfs", "hfs+", "linux-swap", "ntfs", "reiserfs", "xfs"
Start The start of the partition. A starting point is defined as a storage unit. The unit used can be changed. In this example, I've it set to GB. The default is MB.
End The end of the partition in the storage unit as above. This is defining the size of the volume, depending on the start point.
# Make the partition
(parted) mkpart                                                           
Partition name?  []? NewPartition
File system type?  [ext2]? ext4                                           
Start? 0GB                                                                
End? 8.59GB 

# Confirm the process worked as expected.
(parted) print                  

Disk /dev/sdb: 8.59GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name          Flags
 1      0.00GB  8.59GB  8.59GB  ext4         NewPartition

# Quit
(parted) quit 

Note the number in the output above, as we need this to reference the correct partition to make a filesystem. In this instance, there is only one partition, but that won't always be the case.

Format the partition

Now that we have a partition, we need to format it.

# Note we are using sdb1.  This is because it is partition 1 (as above) on device sdb.
$ sudo mkfs /dev/sdb1 --type ext4

mke2fs 1.44.4 (18-Aug-2018)
Creating filesystem with 2096640 4k blocks and 524288 inodes
Filesystem UUID: fd243162-46bf-43bb-aa85-43e21521da88
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done 

Mount the partition

# Create a folder for the mount point
$ sudo mkdir /mnt/testvol

# Add the following line into /etc/fstab to ensure it mounts on boot.
/dev/sdb1    /mnt/testvol    ext4    defaults    0 0 

# Mount the volume
sudo mount /mnt/testvol/

# Check the volume successfully mounted.
$ df

Filesystem              1K-blocks    Used Available Use% Mounted on
devtmpfs                  2003696       0   2003696   0% /dev
tmpfs                     2018328       0   2018328   0% /dev/shm
tmpfs                     2018328    1360   2016968   1% /run
tmpfs                     2018328       0   2018328   0% /sys/fs/cgroup
/dev/mapper/fedora-root  35881596 7887684  26141496  24% /
tmpfs                     2018328      84   2018244   1% /tmp
/dev/sda1                  999320  184532    745976  20% /boot
tmpfs                      403664    4652    399012   2% /run/user/1000
/dev/sdb1                 8189368   36852   7716804   1% /mnt/testvol

I've deliberately glossed over fstab here. There is a multitude of options available when configuring mount points. What I've used is the basics to get the volume up and running, but that won't always be the optimal configuring depending on usage requirements. I highly recommend reading the man page for fstab to get a more complete understanding of what is possible.

Parted is also capable of a lot more than this has covered, but this remains my starting point most of the time.