You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> This article references CentOS, a Linux distribution that is nearing End Of Life (EOL) status. Please consider your use and plan accordingly. For more information, see the [CentOS End Of Life guidance](~/articles/virtual-machines/workloads/centos/centos-end-of-life.md).
17
-
18
15
**Applies to:**:heavy_check_mark: Linux VMs :heavy_check_mark: Flexible scale sets
19
16
20
-
This article describes how to expand managed disks for a Linux virtual machine (VM). You can [add data disks](add-disk.md) to provide for additional storage space, and you can also expand an existing data disk. The default virtual hard disk size for the operating system (OS) is typically 30 GB on a Linux VM in Azure. This article covers expanding either OS disks or data disks. You can't expand the size of striped volumes.
17
+
This article describes how to expand managed disks for a Linux virtual machine (VM). You can [add data disks](add-disk.md) to provide for more storage space, and you can also expand an existing data disk. The default virtual hard disk size for the operating system (OS) is typically 30 GB on a Linux VM in Azure. This article covers expanding either OS disks or data disks. You can't expand the size of striped volumes.
21
18
22
-
An OS disk has a maximum capacity of 4,095 GiB. However, many operating systems are partitioned with [master boot record (MBR)](https://wikipedia.org/wiki/Master_boot_record) by default. MBR limits the usable size to 2 TiB. If you need more than 2 TiB, create and attach data disks and use them for data storage. If you need to store data on the OS disk and require the additional space, convert it to GUID Partition Table (GPT).
19
+
An OS disk has a maximum capacity of 4,095 GiB. However, many operating systems are partitioned with [master boot record (MBR)](https://wikipedia.org/wiki/Master_boot_record) by default. MBR limits the usable size to 2 TiB. If you need more than 2 TiB, consider attaching data disks for data storage. If you do need to store data on the OS disk and require extra space, convert it to GUID Partition Table (GPT).
23
20
24
21
> [!WARNING]
25
22
> Always make sure that your filesystem is in a healthy state, your disk partition table type (GPT or MBR) will support the new size, and ensure your data is backed up before you perform disk expansion operations. For more information, see the [Azure Backup quickstart](../../backup/quick-backup-vm-portal.md).
26
23
27
24
## <aid="identifyDisk"></a>Identify Azure data disk object within the operating system ##
28
25
29
-
In the case of expanding a data disk when there are several data disks present on the VM, it may be difficult to relate the Azure LUNs to the Linux devices. If the OS disk needs expansion, it is clearly labeled in the Azure portal as the OS disk.
26
+
When expanding a data disk, when there are several data disks present on the VM, it may be difficult to relate the Azure LUNs to the Linux devices. If the OS disk needs expansion, it is clearly labeled in the Azure portal as the OS disk.
30
27
31
28
Start by identifying the relationship between disk utilization, mount point, and device, with the ```df``` command.
32
29
@@ -42,9 +39,9 @@ Filesystem Type Size Used Avail Use% Mounted on
42
39
/dev/sde1 ext4 32G 49M 30G 1% /opt/db/log
43
40
```
44
41
45
-
Here we can see, for example, the `/opt/db/data` filesystem is nearly full, and is located on the `/dev/sdd1` partition. The output of `df` shows the device path regardless of whether the disk is mounted by device path or the (preferred) UUID in the fstab. Also take note of the Type column, indicating the format of the filesystem. This is important later.
42
+
Here we can see, for example, the `/opt/db/data` filesystem is nearly full, and is located on the `/dev/sdd1` partition. The output of `df` shows the device path whether the disk is mounted using the device path or the (preferred) UUID in the fstab. Also take note of the Type column, indicating the format of the filesystem. The format is important later.
46
43
47
-
Now locate the LUN that correlates to `/dev/sdd` by examining the contents of `/dev/disk/azure/scsi1`. The output of the following `ls` command shows that the device known as `/dev/sdd` within the Linux OS is located at LUN1 when looking in the Azure portal.
44
+
Now locate the LUN that correlates to `/dev/sdd` by examining the contents of `/dev/disk/azure/scsi1`. The output of the following `ls` command shows that the device known as `/dev/sdd` within the Linux OS is located at LUN1 when looking in the Azure portal.
48
45
49
46
```bash
50
47
sudo ls -alF /dev/disk/azure/scsi1/
@@ -120,11 +117,11 @@ In the following samples, replace example parameter names such as *myResourceGro
120
117
121
118
## Expand a disk partition and filesystem
122
119
> [!NOTE]
123
-
> While there are many tools that may be used for performing the partition resizing, the tools detailed in the remainder of this document are the same tools used by certain automated processes such as cloud-init. As described here, the `growpart` tool with the `gdisk` package provides universal compatibility with GUID Partition Table (GPT) disks, as older versions of some tools such as `fdisk` did not support GPT.
120
+
> While there are many tools that may be used for performing the partition resizing, the tools detailed in the remainder of this document are the same tools used by certain automated processes such as cloud-init. As described here, the `growpart` tool with the `gdisk` package provides universal compatibility with GUID Partition Table (GPT) disks, as older versions of some tools such as `fdisk` did not support GPT.
124
121
125
122
### Detecting a changed disk size
126
123
127
-
If a data disk was expanded without downtime using the procedure mentioned previously, the disk size won't be changed until the device is rescanned, which normally only happens during the boot process. This rescan can be called on-demand with the following procedure. In this example we have detected using the methods in this document that the data disk is currently `/dev/sda` and has been resized from 256 GiB to 512 GiB.
124
+
If a data disk was expanded without downtime using the procedure mentioned previously, the reported disk size doesn't change until the device is rescanned, which normally only happens during the boot process. This rescan can be called on-demand with the following procedure. In this example, we find using the methods in this document that the data disk is currently `/dev/sda` and was resized from 256 GiB to 512 GiB.
128
125
129
126
1. Identify the currently recognized size on the first line of output from `fdisk -l /dev/sda`
130
127
@@ -145,13 +142,13 @@ If a data disk was expanded without downtime using the procedure mentioned previ
145
142
/dev/sda1 2048 536870878 536868831 256G 83 Linux
146
143
```
147
144
148
-
1. Insert a `1` character into the rescan file for this device. Note the reference to sda, this would change if a different disk device was resized.
145
+
1. Insert a `1` character into the rescan file for this device. Note the reference to sda in the example. The disk identifier would change if a different disk device was resized.
149
146
150
147
```bash
151
148
echo 1 | sudo tee /sys/class/block/sda/device/rescan
152
149
```
153
150
154
-
1. Verify that the new disk size has been recognized
151
+
1. Verify that the new disk size is now recognized
155
152
156
153
```bash
157
154
sudo fdisk -l /dev/sda
@@ -170,9 +167,9 @@ If a data disk was expanded without downtime using the procedure mentioned previ
170
167
/dev/sda1 2048 536870878 536868831 256G 83 Linux
171
168
```
172
169
173
-
The remainder of this article uses the OS disk for the examples of the procedure for increasing the size of a volume at the OS level. If the expanded disk is a data disk, use the [previous guidance for identifying the data disk device](#identifyDisk), and follow these instructions as a guideline, substituting the data disk device (for example `/dev/sda`), partition numbers, volume names, mount points, and filesystem formats, as necessary.
170
+
The remainder of this article uses the OS disk for the examples of the procedure for increasing the size of a volume at the OS level. If the expanded disk is a data disk, use the [previous guidance for identifying the data disk device](#identifyDisk), and follow these instructions as a guideline, substituting the data disk device (for example `/dev/sda`), partition numbers, volume names, mount points, and filesystem formats, as necessary.
174
171
175
-
All Linux OS guidance should be viewed as generic and may apply on any distribution, but generally matches the conventions of the named marketplace publisher. Reference the Red Hat documents for the package requirements on any distribution claiming Red Hat compatibility, such as CentOS and Oracle.
172
+
All Linux OS guidance should be viewed as generic and may apply on any distribution, but generally matches the conventions of the named marketplace publisher. Reference the Red Hat documents for the package requirements on any distribution based on Red Hat or claiming Red Hat compatibility.
176
173
177
174
### Increase the size of the OS disk
178
175
@@ -183,13 +180,13 @@ The following instructions apply to endorsed Linux distributions.
183
180
184
181
# [Ubuntu](#tab/ubuntu)
185
182
186
-
On Ubuntu 16.x and newer, the root partition of the OS disk and filesystems will be automatically expanded to utilize all free contiguous space on the root disk by cloud-init, provided there's a small bit of free space for the resize operation. For this circumstance the sequence is simply
183
+
On Ubuntu 16.x and newer, the root partition of the OS disk and filesystems are automatically expanded to utilize all free contiguous space on the root disk by cloud-init, provided there's a small bit of free space for the resize operation. In this case, the sequence is simply
187
184
188
185
1. Increase the size of the OS disk as detailed previously
189
186
1. Restart the VM, and then access the VM using the **root** user account.
190
187
1. Verify that the OS disk now displays an increased file system size.
191
188
192
-
As shown in the following example, the OS disk has been resized from the portal to 100 GB. The **/dev/sda1** file system mounted on **/** now displays 97 GB.
189
+
As shown in the following example, the OS disk was resized from the portal to 100 GB. The **/dev/sda1** file system mounted on **/** now displays 97 GB.
193
190
194
191
```bash
195
192
df -Th
@@ -213,15 +210,15 @@ user@ubuntu:~#
213
210
214
211
To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15, and SUSE SLES 15 for SAP:
215
212
216
-
1. Follow the procedure above to expand the disk in the Azure infrastructure.
213
+
1. Follow the procedure previously described to expand the disk in the Azure infrastructure.
217
214
218
215
1. Access your VM as the **root** user by using the ```sudo``` command after logging in as another user:
219
216
220
217
```bash
221
218
sudo -i
222
219
```
223
220
224
-
1. Use the following command to install the **growpart** package, which will be used to resize the partition, if it isn't already present:
221
+
1. Use the following command to install the **growpart** package, which is used to resize the partition, if it isn't already present:
225
222
226
223
```bash
227
224
zypper install growpart
@@ -254,9 +251,9 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
1. Check whether there's free space in the LVM volume group (VG) containing the root partition. If there's free space, skip to step 12.
376
+
1. Check whether there's free space in the LVM volume group (VG) containing the root partition. If there's free space, skip to step 12.
380
377
381
378
```bash
382
379
vgdisplay rootvg
@@ -407,13 +404,13 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
407
404
408
405
In this example, the line **Free PE / Size** shows that there's 38.02 GB free in the volume group, as the disk has already been resized.
409
406
410
-
1. Install the **cloud-utils-growpart** package to provide the **growpart** command, which is required to increase the size of the OS disk and the gdisk handler for GPT disk layouts This package is preinstalled on most marketplace images
407
+
1. Install the **cloud-utils-growpart** package to provide the **growpart** command, which is required to increase the size of the OS disk and the gdisk handler for GPT disk layouts This package is preinstalled on most marketplace images
411
408
412
409
```bash
413
-
yum install cloud-utils-growpart gdisk
410
+
dnf install cloud-utils-growpart gdisk
414
411
```
415
412
416
-
In RHEL/CentOS 8.x VMs you can use `dnf` command instead of `yum`.
413
+
In Red Hat versions 7 and below you can use `yum` command instead of `dnf`.
417
414
418
415
1. Determine which disk and partition holds the LVM physical volume (PV) or volumes in the volume group named **rootvg** by using the **pvscan** command. Note the size and free space listed between the brackets (**[** and **]**).
419
416
@@ -452,7 +449,7 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
1. Verify that the partition has resized to the expected size by using the `lsblk` command again. Notice that in the example **sda4**has changed from 63G to 95G.
452
+
1. Verify that the partition has resized to the expected size by using the `lsblk` command again. Notice that in the example **sda4** changed from 63G to 95G.
456
453
457
454
```bash
458
455
lsblk /dev/sda4
@@ -490,7 +487,7 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
1. Expand the LV by the required amount, which doesn't need to be all the free space in the volume group. In the following example, **/dev/mapper/rootvg-rootlv** is resized from 2 GB to 12 GB (an increase of 10 GB) through the following command. This command will also resize the file system on the LV.
490
+
1. Expand the LV by the required amount, which doesn't need to be all the free space in the volume group. In the following example, **/dev/mapper/rootvg-rootlv** is resized from 2 GB to 12 GB (an increase of 10 GB) through the following command. This command also resizes the file system on the LV.
494
491
495
492
```bash
496
493
lvresize -r -L +10G /dev/mapper/rootvg-rootlv
@@ -529,26 +526,26 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
529
526
> [!NOTE]
530
527
> To use the same procedure to resize any other logical volume, change the **lv** name in step **12**.
531
528
532
-
# [Red Hat/CentOS without LVM](#tab/rhelraw)
529
+
# [Red Hat without LVM](#tab/rhelraw)
533
530
534
-
1. Follow the procedure above to expand the disk in the Azure infrastructure.
531
+
1. Follow the procedure previously described to expand the disk in the Azure infrastructure.
535
532
536
533
1. Access your VM as the **root** user by using the ```sudo``` command after logging in as another user:
537
534
538
535
```bash
539
536
sudo -i
540
537
```
541
538
542
-
1. When the VM has restarted, perform the following steps:
539
+
1. When the VM restarts completely, perform the following steps:
543
540
544
541
1. Install the **cloud-utils-growpart** package to provide the **growpart** command, which is required to increase the size of the OS disk and the gdisk handler for GPT disk layouts. This package is preinstalled on most marketplace images
545
542
546
543
```bash
547
-
yum install cloud-utils-growpart gdisk
544
+
dnf install cloud-utils-growpart gdisk
548
545
```
549
546
550
-
In RHEL/CentOS 8.x VMs you can use `dnf` command instead of `yum`.
551
-
547
+
In Red Hat versions 7 and below you can use `yum` command instead of `dnf`.
548
+
552
549
1. Use the **lsblk -f** command to verify the partition and filesystem type holding the root (**/**) partition
553
550
554
551
```bash
@@ -566,7 +563,7 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
1. For verification, start by listing the partition table of the sda disk with **gdisk**. In this example, we see a 48.0 GiB disk with partition #2 sized 29.0 GiB. The disk was expanded from 30 GB to 48 GB in the Azure portal.
566
+
1. For verification, start by listing the partition table of the sda disk with **gdisk**. In this example, we see a 48.0 GiB disk with partition #2 sized 29.0 GiB. The disk was expanded from 30 GB to 48 GB in the Azure portal.
570
567
571
568
```bash
572
569
gdisk -l /dev/sda
@@ -597,7 +594,7 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
597
594
15 10240 1024000 495.0 MiB EF00 EFI System Partition
598
595
```
599
596
600
-
1. Expand the partition for root, in this case sda2 by using the **growpart** command. Using this command expands the partition to use all of the contiguous space on the disk.
597
+
1. Expand the partition for root, in this case sda2 by using the **growpart** command. Using this command expands the partition to use all of the contiguous space on the disk.
601
598
602
599
```bash
603
600
growpart /dev/sda 2
@@ -607,7 +604,7 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
0 commit comments