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
Copy file name to clipboardExpand all lines: articles/virtual-machines/linux/expand-disks.md
+51-19Lines changed: 51 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -128,7 +128,51 @@ In the following samples, replace example parameter names such as *myResourceGro
128
128
> [!NOTE]
129
129
> 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.
130
130
131
-
The remainder of this article describes uses the OS disk for the examples of the procedure for increasing the size of a volume at the OS level. If the disk which needs to be expanded 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 (for example `/dev/sda`), partition numbers, volume names, mount points, and filesystem formats, as necessary.
131
+
### Detecting a changed disk size
132
+
133
+
If a data disk was expanded without downtime using the procedure mentioned previously, the disk size will not 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 256GB to 512GB.
134
+
135
+
1. Identify the currently recognized size on the first line of output from `fdisk -l /dev/sda`
136
+
137
+
```
138
+
root@linux:~# fdisk -l /dev/sda
139
+
Disk /dev/sda: 256 GiB, 274877906944 bytes, 536870912 sectors
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
+
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.
132
176
133
177
### Increase the size of the OS disk
134
178
@@ -139,7 +183,7 @@ The following instructions apply to endorsed Linux distributions.
139
183
140
184
# [Ubuntu](#tab/ubuntu)
141
185
142
-
On Ubuntu 16.x and newer, the root partition and filesystems will be automatically expanded to utilize all free contiguous space on the root disk by cloud-init, provided there is a small bit of free space for the resize operation. For this circumstance the sequence is simply
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 is a small bit of free space for the resize operation. For this circumstance the sequence is simply
143
187
144
188
1. Increase the size of the OS disk as detailed previously
145
189
1. Restart the VM, and then access the VM using the **root** user account.
@@ -342,17 +386,9 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
342
386
VG UUID lPUfnV-3aYT-zDJJ-JaPX-L2d7-n8sL-A9AgJb
343
387
```
344
388
345
-
In this example, the line **Free PE / Size** shows that there is 38.02 GB free in the volume group. No disk resizing is required before adding space to the volume group
346
-
347
-
1. To increase the size of the OS disk in RHEL 7 and newer with LVM:
348
-
349
-
1. Stop the VM.
350
-
1. Increase the size of the OS disk from the portal.
351
-
1. Start the VM.
352
-
353
-
1. When the VM has restarted, complete the following steps:
354
-
355
-
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
389
+
In this example, the line **Free PE / Size** shows that there is 38.02 GB free in the volume group, as the disk has already been resized.
390
+
391
+
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
1. Expand the desired logical volume (lv) by the desired amount, which does not 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.
454
+
1. Expand the LV by the required amount, which does not 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.
@@ -439,11 +475,7 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
439
475
data blocks changed from 524288 to 3145728
440
476
```
441
477
442
-
1. The `lvresize` command automatically calls the appropriate resize command for the filesystem in the LV. Verify whether **/dev/mapper/rootvg-rootlv**, which is mounted on **/**, has an increased file system size by using this command:
443
-
444
-
```shell
445
-
[root@rhel-lvm ~]# df -Th /
446
-
```
478
+
1. The `lvresize` command automatically calls the appropriate resize command for the filesystem in the LV. Verify whether **/dev/mapper/rootvg-rootlv**, which is mounted on **/**, has an increased file system size by using the `df -Th` command:
0 commit comments