Article

  • 2 years

    2 years

    YetiShare / Core

    1830

How To Partition Drives On Ubuntu 20

The guidance below details the steps to parition a drive on a new Ubuntu 20 server.

List the available drives:

$ sudo fdisk -l

Unmounted paritions will be shown. To partition a drive: (replace /dev/sdb with the drive)

$ parted /dev/sdb
(parted) mklabel gpt
(parted) unit TB
(parted) mkpart primary 0 100%
(parted) print
(parted) quit

Mount the drive@

$ mkfs.ext4 /dev/sdb
$ mkdir /data
$ mkdir /data/sdb
$ mount /dev/sdb /data/sdb

Ensure it's mounted after a reboot:

$ sudo cp /etc/fstab /etc/fstab.old
$ sudo blkid
# note the id of the mount
sudo nano /etc/fstab
# copy the line to the end of the file and save
UUID=wdf9a2eb-3d13-4817-9647-b34bd297c51e /data/sdb auto nosuid,nodev,nofail,x-gvfs-show 0 0
# test with:
$ sudo mount -a
# reboot if the paritions mount ok
$ reboot