Unable to access VM after Recreating Partition to Expand Storage Size

Ahmad Ibrahim 0 Reputation points
2024-07-10T09:33:21.3466667+00:00

I increased the disk size on the platform and I used fdisk to implement on the VM. After recreating the partition, I restarted the VM before running " sudo resize2fs /dev/sda" code to allocate fullsize to the VM . The restart failed due to connection timeout and I have been unable to access since then.

Azure Disk Storage
Azure Disk Storage
A high-performance, durable block storage designed to be used with Azure Virtual Machines and Azure VMware Solution.
600 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Vinodh247 13,226 Reputation points
    2024-07-11T01:09:59.7133333+00:00

    Hi Ahmad Ibrahim,

    Thanks for reaching out to Microsoft Q&A.

    I suspect may be due to the partition table changes not being properly recognized, or a misconfiguration that occurred when you restarted your vm before resizing the filesystem. The easiest way is to attach the OS disk to another vm, resize it and then reattach to the original vm to check if you are able to boot.

    1. Azure provides a serial console that can help you troubleshoot VMs that are not accessible through SSH
    2. Go to the Azure portal
    3. Navigate to your vm and select Serial Console from the Support + Troubleshooting section
    4. If the VM boots, you can use the serial console to log in and complete the resize operation
    5. Stop the affected vm & detach the OS disk from the vm
    6. Attach the OS disk to another healthy Linux vm as a data disk
    7. SSH into the healthy vm & verify the disk is attached (e.g., /dev/sdc)
    8. Use fdisk -l to list the partitions and lsblk to confirm the new disk is attached
    9. Mount the partition to a directory & resize the filesystem
    10. Unmount the disk & detach the disk from the healthy VM
    11. Reattach the disk to the original vm as the OS disk
    12. Now start the original vm

    Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.

    0 comments No comments

  2. Nehruji R 4,526 Reputation points Microsoft Vendor
    2024-07-12T08:01:59.8433333+00:00

    Hello Ahmad Ibrahim,

    Greetings! Welcome to Microsoft Q&A Platform.

    I understand that you are encountering restart failure due to connection timeout, after recreating the partition and unable to access the VM.

    When you see connection timeout, you can check the boot diagnostics to see if the console is showing the login screen. If yes, then you will need to check your NSG to make sure SSH/RDP access to the VM is allowed.

    Here is the doc for your reference: https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/troubleshoot-rdp-connection

    The Remote Desktop Protocol (RDP) connection to your Azure VM can fail for various reasons. please try the following steps to troubleshoot the connect error,

    1. Reset Remote Desktop configuration.
    2. Check Network Security Group rules / Cloud Services endpoints.
    3. Review VM console logs.
    4. Reset the NIC for the VM.
    5. Check the VM Resource Health.
    6. Restart your VM.
    7. Redeploy your VM.

    https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/troubleshoot-rdp-connection

    refer troubleshooting steps here - https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/windows/restart-resize-error-troubleshooting.

    Hope this answer helpful! Please accept the answer else, please let us know if you have any further queries. I’m happy to assist you further.


    Please "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments