Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Azure icon
Labs

Attaching an Azure Managed Disk to a Linux VM

Azure Managed Disks provide a way to manage disk-based data storage and access the data in your VMs. Azure Disks provide the main operating system storage for virtual machines, but additional disks can be attached to VMs to provide storage as well. This allows you to use storage that is optimized for the needs of different parts of your infrastructure. In this lab, you will be able to work with Azure Data Disks hands-on. You will create a disk, attach it to a Linux VM, and mount it from within the VM so that it is ready for use.

Azure icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 21, 2025
Duration
30m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Create the Managed Disk.
    1. Log in to the Azure Portal.

    2. Click + Add and add search for/select Managed Disks. Select Create.

    3. Configure the Disk:

    • Ensure that Resource Group is set to your resource group (not empty).
    • Enter inventory-processing-output for the Disk name.
    • Select West US for the Region.
    • Click Change size. For Account type, select Standard SSD. Select 512 GiB.
    1. Review and create the disk. After a short time, your disk will be created.
  2. Challenge

    Attach the Disk to the VM.
    1. Return to the resource group main page by clicking Home, then the resource group.

    2. Click the Virtual machine resource called lab-VM.

    3. Select Disks from the menu.

    4. Click + Add data disk.

    5. Click the Name dropdown and select inventory-processing-output.

    6. Click Save.

    After a few moments, the disk will be attached to the VM.

  3. Challenge

    Mount the Disk to the VM file system.
    1. Log in to the VM in a terminal.

    2. Verify that the disk has been attached to the VM.

    dmesg | grep SCSI
    

    You should see a line that reads:

    [sdc] Attached SCSI disk
    

    This means the managed disk is called sdc.

    1. Format the new disk:
    sudo fdisk /dev/sdc
    
    1. Respond to the prompts like so:
    Command (m for help): n
    Partition type
       p   primary (0 primary, 0 extended, 4 free)
       e   extended (container for logical partitions)
    Select (default p): p
    Partition number (1-4, default 1):
    First sector (2048-1073741823, default 2048):
    Last sector, +sectors or +size{K,M,G,T,P} (2048-1073741823, default 1073741823):
    
    Created a new partition 1 of type 'Linux' and of size 512 GiB.
    
    Command (m for help): w
    The partition table has been altered.
    Calling ioctl() to re-read partition table.
    Syncing disks.
    
    1. Create a file system on the new partition. Note that it will take a few moments to finish building the file system:
    sudo mkfs -t ext4 /dev/sdc1
    
    1. Create the output directory:
    sudo mkdir /output
    
    1. Get the Disk's UUID. Copy the UUID value from the output:
    sudo -i blkid | grep sdc1
    
    1. Add the new disk to fstab so that it will be automatically mounted whenever the VM restarts:
    sudo vi /etc/fstab
    
    1. Add a new line to the file. Be sure to replace <your disk UUID> with the Disk UUID that was printed by the blkid command earlier:
    UUID=<your disk UUID>   /output   ext4   defaults,nofail   1   2
    
    1. Mount the new Disk immediately by reloading fstab:
    sudo mount -a
    
    1. Write some data to the disk to verify that it is working:
    echo "Hello, world!" | sudo tee -a /output/test.txt
    
    1. Read the data back from the disk:
    cat /output/test.txt
    
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight