0
votes

Ubuntu machines on azure got ephemeral disk that is being automatically mounted on /mnt

I don't want to have this ephemeral drive on /mnt but rather disable it or just move it to another location.

I'm using packer to create my base image on azure.

I've tried to achieve that with cloud-init like so:

mounts:
  - [/dev/sdb, null]

and also as with AWS:

mounts:
  - [ephemeral0, null]

but that didn't help, so I tried to edit waagent.conf and reboot the machine like so: sed -i '/s/ResourceDisk.MountPoint=.*/ResourceDisk.MountPoint=\/ephemeral/' /etc/waagent.conf but that didn't solve the issue either...

Ultimately I would like to solve it with cloud-init as I would like to mount another drive (persist data) on /mnt instead but any solution goes.

Thanks

2
why dont you mount the disk to any other path on the system? - 4c74356b41

2 Answers

1
votes

In order to completely override Azure's default mounts you have to override both ephemeral0 and ephemeral0.1.

This is working perfectly for Azure:

#cloud-config
mounts:
  - [ ephemeral0 ]
  - [ ephemeral0.1 ]

AWS uses configuration modules in a different order, and I was unable to define mount points for its' ephemeral NVME disks. If you're using non-NVME disks, maybe BlockDeviceMapping for ephemerals will help you.

EDIT: In my experience, if you're using cloud-init you should disable waagent in order to avoid weird misconfigurations.

0
votes

Ubuntu machines on azure support cloud-init, hence it's very easy to create a simple file under /etc/cloud/cloud.cfg.d/xyz.cfg with some cloud-init commands.

In this case, mount the ephemeral drive to a null point (or in other words - don't mount it).

cat << 'EOF' > /etc/cloud/cloud.cfg.d/01-mounts.cfg
mounts:
  - [ ephemeral0, null ]
EOF