1

I am not able to access an ubuntu vm on azure after restart.

This is happening several times.

Basically I created an ubuntu 18.04 LTS VM on azure and after creation I can access the machine using ssh and the correspondent keys.

When the machine is shut down by the next start I got a connection refused:

ssh: connect to host myserver.westeurope.cloudapp.azure.com port 22: Connection refused

I created the VM using an ARM template and a cloud-init file, where docker is downloaded, installed and used to start a container.

I activated the serial console and was able to see that an external data disk cannot be mounted:

enter image description here

I mounted the data disk using a script embedded in cloud-init

Here the relevant part of the script:

  # create a partition table for the disk
  parted -s /dev/sdc mklabel msdos
  # create a single large partition
  parted -s /dev/sdc mkpart primary ext4 0\% 100\%
  # install the file system
  mkfs.ext4 /dev/sdc1
  # create the mount point
  mkdir /datadisk
  # mount the disk
  sudo mount /dev/sdc1 /datadisk/
  # add mount to /etc/fstab to persist across reboots
  echo "/dev/sdc1    /datadisk/    ext4    defaults 0 0" >> /etc/fstab

Here is the content of fstab: enter image description here

Why is this damaged after shutting down and starting the vm again?

  • Researching why the datadrive is not mounting is a whole separate issue, it includes questions like; What type of drive mount? How was it mounted using UUID or drive path? – Hannel Jan 19 '21 at 09:18

1 Answers1

1

You can use the serial console to either fix issue with datdrive mount or comment it out in the fstab and the VM boots up.

Hannel
  • 651
  • 4
  • 9
  • Hi, I will try the solution, but this does not explain what this is recurrent happening. I will check how I mounted the disk. – Playing With BI Jan 19 '21 at 16:01
  • I left a comment on the main question, you will need to review how datadrive was created and mount. – Hannel Jan 19 '21 at 21:54
  • I added the code I used to mount the disk to the original question. Can someone detect any pitfall or possible problem when restarting the VM? – Playing With BI Jan 20 '21 at 10:49
  • Try redoing you script to mount drive using UUID. https://help.ubuntu.com/community/UsingUUID – Hannel Jan 21 '21 at 21:53