How to attach a new disk to azure Linux VM

This will guide you how to attach a new drive to linux VM once it is created through Azure Portal

Connect to server via SSH and run one of the commands and this will tell you the the new disk name
grep SCSI /var/log/messages
grep SCSI /var/log/syslog

#Assume my drive is sdc
Now create parson using any tools such as fdisk
sudo fdisk /dev/sdc
When prompted, type n to create a new partition and make it partition the primary partition by pressing ‘p’. Set the Partition number as 1,  accept default values if you want to use the whole size as single portion. Finally save the changes by typing ‘w’

Format the new partition
mkfs -t ext4 /dev/sdc1

Create a mount point
mkdir /data

Mount the new partion
mount /dev/sdc1 /data

Add to fstab to make it automount. Get the UUID  using blkid
sudo -i blkid

Get the ID and add below line to /etc/fstab
UUID=ee1a8759-f2e2-4924-a2a3-505c432325bc  /datadrive   ext4   defaults   1   2

facebooktwittergoogle_plusredditpinterestlinkedinmail

LEAVE A COMMENT