Share via

How to deploy RedHat VM with EXT4 filesystem?

Luca 0 Reputation points
2026-02-07T14:12:05.41+00:00

I need to deploy a RedHat VM with an EXT4 filesystem. I'm installing some software that requires all disks use EXT4. how can i do this? i don't see any options in the UI to adjust the filesystem and the default seems to be XFS

Azure Virtual Machines
Azure Virtual Machines

An Azure service that is used to provision Windows and Linux virtual machines.

{count} votes

1 answer

Sort by: Most helpful
  1. Marcin Policht 82,760 Reputation points MVP Volunteer Moderator
    2026-02-07T14:34:27.12+00:00

    On Azure marketplace RHEL images the OS disk is prebuilt with XFS and you cannot change that from the Azure VM creation UI because the filesystem already exists inside the image. If your requirement truly means every disk including the root OS disk must be EXT4, you need to deploy from a custom image where the OS was installed with EXT4 instead of XFS. The usual approach is to create a temporary VM from a RHEL ISO or a generic RHEL image in another environment, run a manual installation using the RHEL installer or a kickstart file where you explicitly select EXT4 for all mount points, then generalize the VM and capture it as an Azure Managed Image or Shared Image Gallery image and deploy new VMs from that image.

    If the requirement applies only to data disks, you can attach managed disks after deployment and format them as EXT4 inside the VM because Azure does not enforce filesystem type on data disks. After attaching a disk you identify it and create an EXT4 filesystem and mount it with commands like:

    lsblk
    sudo parted /dev/sdc --script mklabel gpt mkpart primary ext4 0% 100%
    sudo mkfs.ext4 /dev/sdc1
    sudo mkdir /data
    sudo mount /dev/sdc1 /data
    echo '/dev/sdc1 /data ext4 defaults,nofail 0 2' | sudo tee -a /etc/fstab
    

    If you want automated provisioning you can use cloud-init or a custom script extension to format all non-OS disks as EXT4 during first boot. A simple cloud-init snippet would look like:

    #cloud-config
    disk_setup:
      /dev/sdc:
        table_type: gpt
        layout: true
        overwrite: true
    fs_setup:
      - label: data1
        filesystem: ext4
        device: /dev/sdc1
    mounts:
      - ["/dev/sdc1", "/data", "ext4", "defaults,nofail", "0", "2"]
    

    If you confirm the software requires EXT4 even for the root filesystem, the only viable Azure-native solution is building a custom RHEL image with EXT4 during OS installation using kickstart such as:

    part /boot --fstype=ext4 --size=1024
    part / --fstype=ext4 --grow --size=10240
    part swap --recommended
    

    Then deprovision and capture the VM:

    sudo waagent -deprovision+user -force
    

    Create an Azure image from the stopped VM and deploy future VMs from that image so every disk starts as EXT4.

    For more details, refer to https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/8/html/deploying_rhel_8_on_microsoft_azure/assembly_deploying-a-rhel-image-as-a-virtual-machine-on-microsoft-azure_cloud-content-azure


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    0 comments No comments

Your answer

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