1

(I'm quite new to disk management and partitions, so some terminology might be mixed and confused)

I'm attempting to increase the size of the OS disk on our Centos 7.3 VM on Azure in order to (hopefully) smoothly migrate an existing machine from a different provider, where the OS disk is larger than the 30GB which comes standard in Azure for Linux distros.

I have successfully upped the size of the disk itself from 30GB to 128GB using this guide from Microsoft, but am stumped on how to actually make use of this new storage space. Microsoft has this guide, but that only applies to GPT partitions.

From what I can tell from the below output, the disk itself shows up as the correct size in lsblk, but none of the partitions are making use of this. The parted output also shows an increase in disk size (137GB vs the 128GB I would expect, but that might not be relevant for this question).

My question is this: how can I make use of the newly added storage? I assume I will have to increase the partition size of MOUNTPOINT /, but I'm struggling to find out how. Will unmounting the root volume abruptly kill the machine?

Any help is greatly appreciated.

[user@machine ~]$ lsblk -o NAME,HCTL,SIZE,MOUNTPOINT,TYPE
NAME   HCTL        SIZE MOUNTPOINT    TYPE
fd0                  4K               disk
sda    2:0:0:0     128G               disk
├─sda1             500M /boot         part
└─sda2            29.5G /             part
sdb    3:0:1:0      16G               disk
└─sdb1              16G /mnt/resource part
sdc    5:0:0:0     128G               disk
└─sdc1             128G /datadisk     part

[user@machine ~]$ sudo parted -l /dev/sda
Model: Msft Virtual Disk (scsi)
Disk /dev/sda: 137GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  525MB   524MB   primary  xfs          boot
 2      525MB   32.2GB  31.7GB  primary  xfs
Kyrre
  • 111
  • 2

1 Answers1

1

Please make sure you have a backup first!

  1. Mount the disk using an Azure VM repair instance following this guide.
  2. Expand the partition following this
  3. Grow your file system by using xfs_growfs /dev/sda
Matthias Güntert
  • 2,358
  • 11
  • 38
  • 58
  • Thanks for your help. I ended up following [this answer](https://serverfault.com/a/953625/493724) in part (using ```fdisk``` and its in-memory editing), but the last few steps didn't work (```pvresize``` and onwards). Calling ```xfs_growfs /dev/sda2``` did the trick. – Kyrre Aug 27 '20 at 07:53