question

MaZheng-2253 avatar image
0 Votes"
MaZheng-2253 asked ·

Resizing not reflected in VM

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-storage
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JMod-5649 avatar image
0 Votes"
JMod-5649 answered ·

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"

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.