Resizing not reflected in VM

Ma, Zheng 1 Reputation point
2020-02-17T22:34:10.51+00:00

I recently did a re-sizing on the OS disk of my Ubuntu VM (increase from 30GB to 100GB). On the Azure portal everything looked fine but when I logged in the VM and did "df -h", the size of "/dev/sda1" is still 29GB. I have tried to deallocate and restart the instance many times but the resizing is still not reflected. I also tried "sudo fdisk" but it did not work and kept telling me I am out of range in terms of sectors. Also tried to umount the partition but could not do it because the "target is busy". Anyone experienced this problem before?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,125 questions
{count} votes

1 answer

Sort by: Most helpful
  1. J Mod 191 Reputation points
    2020-02-18T03:06:09.917+00:00

    You need to recreate the partition so that you can allocate the new space.

    1. List partition info with "sudo fdisk /dev/sda1"
    2. Use command "p" to list partition info. Take note of the partition number you want to modify and its starting unit/sector.
    3. Use command "d" to alter the partition table. Your data is not being deleted.
    4. Select the partition number you want to modify. Again, this is modifying the partition table info and not your data.
    5. Use command "p" to verify your partition is gone
    6. Use command "n" to create a new partition
    7. Select "p" for a primary partition
    8. Select the partition number you want to create. This should be the same number you removed.
    9. Set your starting unit/sector. The default should be good, but compare to the number from step 2.
    10. Set your end unit/sector. The default should be good.
    11. After entering the end unit/sector your new partition size should be displayed. Make sure this is correct.
    12. Use command "w" to write the changes back to the partition table
    13. Reboot and log back in
    14. Resize the partition with "sudo resize2fs /dev/sda1"
    15. Verify with "df -h"
    4 people found this answer helpful.