Mount data disks to VM

A short tutorial how to attached a data disk on an Ubuntu 20.04. LTS VM on Microsoft Azure (assuming you already created one in Azure’s Portal).

Finding the correct disk

dmesg | grep SCSI

Usually the first attached data disk is sdc (after OS disk which seems to be usually sdb and boot disk sda).

Personally I find lsblk more helpful since it is listing the disks and mountpoints.

$ lsblk

loop0     7:0    0 27.1M  1 loop /snap/snapd/7264
loop1     7:1    0   55M  1 loop /snap/core18/1754
loop2     7:2    0 69.3M  1 loop /snap/lxd/15138
sda       8:0    0   30G  0 disk 
├─sda1    8:1    0 29.9G  0 part /
├─sda14   8:14   0    4M  0 part 
└─sda15   8:15   0  106M  0 part /boot/efi
sdb       8:32   0    4G  0 disk 
└─sdb1    8:33   0    4G  0 part /mnt
sdc       8:16   0    8G  0 disk 
sr0      11:0    1  628K  0 rom 

Now, partitioning

$ sudo fdisk /dev/sdc

m (for help and listing commands)
d (if Azure created a partition already)
n (create new)
p (primary partition)
Enter (take the defaults a few times)

Create a filesystem if needed

sudo mkfs -t ext4 /dev/sdc1

Create target folder and mount it

sudo mkdir /target
sudo mount /dev/sdc1 /target