Unwanted formatting & mounting of temp drive

Travis Downs 40 Reputation points
2024-11-14T18:22:06.17+00:00

When creating a Linux Azure VM with "temp disk" (locally SSD) such as D2ds_v4, the disk is formatted ext4 and already mounted at /mnt via some mechanism.

This is annoying for me because I don't want it formatted ext4, and I certainly don't want it mounted at /mnt (which seems strange: drives should be mounted at a subdirectory of /mnt not at the directory itself).

How can I prevent this so I can format the disk myself?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,066 questions
0 comments No comments
{count} votes

Accepted answer
  1. TP 99,371 Reputation points
    2024-11-14T20:29:19.3633333+00:00

    Hi Travis,

    You can use cloud-init custom data to modify vm provisioning. For example, I just did quick test by using below on Advanced tab when creating VM in portal:

    #cloud-config
    device_aliases: {'ephemeral0': '/dev/sdb'}
    disk_setup:
      ephemeral0:
        table_type: mbr
        layout: True
        overwrite: False
    fs_setup:
      - label: ephemeral0
        filesystem: ext3
        device: ephemeral0.1
        replace_fs: ntfs
    mounts:
     - [ ephemeral0, /mnt/resource, auto, "defaults,nofail", "0", "2" ]
    

    Please see result in screenshot:User's image

    Configure partitions and filesystems

    https://cloudinit.readthedocs.io/en/latest/reference/yaml_examples/disk_setup.html#set-up-the-filesystem

    Cloud-init Overview

    https://learn.microsoft.com/en-us/azure/virtual-machines/linux/using-cloud-init

    Custom data and cloud-init on Azure Virtual Machines

    https://learn.microsoft.com/en-us/azure/virtual-machines/custom-data

    Please click Accept Answer and upvote if the above was helpful.

    Thanks.

    -TP


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.