How to prepare a new bare disk

A new disk often requires some dirty work to be useable, the following commands are helpful:

# list disk, check that /dev/sdb is available
sudo fdisk -l

# now make a partition, choose default options to use the whole disk for this partition
sudo gdisk /dev/sdb

# /dev/sdb1 should now be available, verify it
lsblk

# make a filesystem on the partition, here choosing ext4 as filesystem type
sudo mkfs -t ext4 /dev/sdb1

# mount, i.e make the partitions readable and writeable at a specified mount point
sudo mount /dev/sdb1 /var/data

# check if mounted
df -h


# Inform the OS of partition table changes
partprobe