adaptive.run TECH BLOG

Cloud can be tricky sometimes. Find out what scenarios we've ran into that are worth being mentioned and explained.

Expanding Azure VM Storage: A Step-by-Step Guide

Level: 200
Publishing date: 27-Feb-2024
Author: Catalin Popa

Introduction

As your workloads grow in Azure, the need to expand storage capacity for your virtual machines becomes inevitable. In this article, we will walk through the process of adding a new disk to a virtual machine (VM) in the Azure portal. Additionally, we will cover the steps to SSH into the VM and perform disk mounting and partitioning using PowerShell commands.

Adding a New Disk to a Virtual Machine in Azure Portal

1. Navigate to the Azure Portal:
    • Go to https://portal.azure.com/ and sign in with your Azure account.
2. Locate Your Virtual Machine:
    • In the left navigation pane, select "Virtual machines."
3. Select Your Virtual Machine:
    • Choose the specific VM to which you want to add a new disk.


azure.microsoft.com
4. Access VM Settings:
    • In the VM pane, scroll down and click on "Disks" under the "Settings" section.
5. Add New Data Disk:
    • Click on the "Create and attach a new disk" button.


azure.microsoft.com

   • Specify the disk name, size (in GB), and choose other optional settings.

    • Click "OK" to confirm and add the new disk.

6. Save Configuration Changes:

    • After adding the disk, click "Save" at the top of the VM page to apply the changes.

RDP into the Virtual Machine and Mount the Disk

After successfully adding a new disk to your Azure virtual machine through the Azure portal, the next steps involve connecting to the VM using Remote Desktop Protocol (RDP) and configuring the newly attached disk. This section guides you through the process of RDPing into the VM and mounting the disk using PowerShell commands.


1. Open Remote Desktop Connection:
On your local machine, open the Remote Desktop Connection application.


azure.microsoft.com

2. Connect to the Virtual Machine:

Enter the password you’ve created for your VM.

Click "Connect" to establish an RDP session.

3. Login to the Virtual Machine:

Enter the username and password for your Azure VM to log in.

4. Open PowerShell:

• Once logged in, open PowerShell as an administrator on the remote machine.

5. List Available Disks:

• Use the Get-Disk cmdlet to list available disks on the VM.

Get-Disk

Identify the newly attached disk, typically represented with a size matching the one you added.

6. Initialize the New Disk:

Use the Initialize-Disk cmdlet to initialize the newly added disk.

Initialize-Disk -Number -PartitionStyle MBR

Replace <DiskNumber> with the disk number associated with the new disk.

7. Create a New Partition:
Use the New-Partition cmdlet to create a new partition on the initialized disk.

New-Partition -DiskNumber -UseMaximumSize

Replace <DiskNumber> with the disk number associated with the new disk.

8. Format the New Partition:
Use the Format-Volume cmdlet to format the newly created partition with the desired filesystem.

Format-Volume -DriveLetter D -FileSystem NTFS -NewFileSystemLabel "NewDisk"

Adjust the drive letter, filesystem, and label as needed.

9. Verify the Mount:
Confirm the successful formatting and mounting of the new disk by listing its contents using File Explorer or PowerShell.

These steps guide you through the process of connecting to your Azure VM using RDP, initializing, partitioning, and formatting the newly added disk, and then making it ready for use. This flexibility allows you to adapt the storage configuration of your Windows-based virtual machine to meet the specific requirements of your workloads.

adaptive.run

Transform your business.
Run adaptive.

Contact

Phone: +40 73 523 0005
Email: hello@adaptive.run

© Copyright  2019-2024 adaptive.run- All Rights Reserved