question

ArmenGeo-8294 avatar image
0 Votes"
ArmenGeo-8294 asked DanielMartinez-5338 answered

Sudo Error When Resizing Azure VM Disk

Hi,

I upgraded my disk size from 30G to 2048G. Now I need to resize it from OS and am following this article. https://docs.microsoft.com/en-us/azure/virtual-machines/linux/expand-disks

The problem is when I try to unmount the partition I get error

umount: /: target is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))

If I try to unmount using umount -l, it unmounts but then I cant use sudo anymore. Getting error

sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?

I seem to be stuck here. Can somebody help? Thanks.

azure-disk-storage
· 4
5 |1600 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.

@ArmenGeo-8294
Can you let me know which Linux distribution and version you are using? It is possible to resize some OS disks without attaching to another VM, but it depends on layout of the disk and partitioning.

0 Votes 0 ·

Linux 3.10.0-1160.31.1.el7.x86_64 #1 SMP Thu Jun 10 13:32:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

0 Votes 0 ·

Can you share the filesystem and partition layout by running "df" and "lsblk"?

0 Votes 0 ·
Show more comments
ArmenGeo-8294 avatar image
0 Votes"
ArmenGeo-8294 answered

After paying for and contacting Azure support it seems there is no straight foreword way of increasing the root patricians disk size. The only way to do it is attaching it to another VM as a "secondary" drive and resize there and bring it back. Not sure why Azure doesn't have a more straight forward way of doing this.

5 |1600 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.

DanielMartinez-5338 avatar image
0 Votes"
DanielMartinez-5338 answered

Just in case somebody else runs through the same issue, the accepted answer claims the only way to do this is by attaching the disk as a secondary storage on another VM. Whereas that method will also work it goes to the hassle of setting up an entire machine and moving the entire disk.

This can also be achieved by replacing the entire 2nd partition using fdisk, keeping the same initial cylinder position and providing the updated end cylinder. That will expand the partition without any data loss. The system will not be able to use the new partition table on the fly and will show a warning "Error 16: device busy... the kernel still uses the old table". As soon as the system is rebooted it will be applied, no need to unmount the disk at all.

Then the file system can be adjusted with any of the following tools: resize2fs if it is an ext4 filesystem or xfs_growfs for xfs.



5 |1600 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.