Home > Back-end >  Expand virtual hard disks on a Linux VM with the Azure CLI
Expand virtual hard disks on a Linux VM with the Azure CLI

Time:12-01

I am trying to extend a disk in my vm (azure). I used to do it like this:

sudo umount /dev/sdc1 

(sdc1 as an example)

sudo parted /dev/sdc

after typing print, I should see something like this:

GNU Parted 3.2
Using /dev/sdc1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Unknown Msft Virtual Disk (scsi)
Disk /dev/sdc1: 215GB
Sector size (logical/physical): 512B/4096B
Partition Table: loop
Disk Flags:

Number  Start  End    Size   File system  Flags
    1      0.00B  107GB  107GB  ext4

I can't go any further because in my case after typing this command I see:

GNU Parted 3.3
Using /dev/sdc
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print                                                            
Model: Msft Virtual Disk (scsi)
Disk /dev/sdc: 550GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 

As you can see, there are no partitions, so I can't use resizepart command.

lsblk -o NAME,HCTL,SIZE,MOUNTPOINT | grep -i "sd"

sda     1:0:1:0      16G 
└─sda1               16G /mnt
sdb     0:0:0:0      30G 
├─sdb1             29.9G /
├─sdb14               4M 
└─sdb15             106M /boot/efi
sdc     3:0:0:0     512G 

CodePudding user response:

As you can see, there are no partitions, so I can't use resizepart command.

You Need to format the disk sdc to create partitions using either xfs or ext4 file system & to procced further resize/enter image description here

enter image description here

In the above image, post running the above mentioned disk format & file partition cmdlets you can see a new partition with sdc1 got created.

  • Related