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/attach-disk-portal.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Use the portal to attach new or existing data disk to a Linux VM.
4
4
author: roygara
5
5
ms.service: storage
6
6
ms.topic: how-to
7
-
ms.date: 08/13/2021
7
+
ms.date: 01/06/2023
8
8
ms.author: rogarana
9
9
ms.subservice: disks
10
10
ms.collection: linux
@@ -103,7 +103,7 @@ From the output of `lsblk` you can see that the 4GB disk at LUN 0 is `sdc`, the
103
103
104
104
> [!IMPORTANT]
105
105
> If you are using an existing disk that contains data, skip to [mounting the disk](#mount-the-disk).
106
-
> The following instuctions will delete data on the disk.
106
+
> The following instructions will delete data on the disk.
107
107
108
108
If you are attaching a new disk, you need to partition the disk.
109
109
@@ -153,12 +153,12 @@ The output looks similar to the following example:
153
153
```
154
154
155
155
> [!NOTE]
156
-
> Improperly editing the **/etc/fstab** file could result in an unbootable system. If unsure, refer to the distribution's documentation for information on how to properly edit this file. It is also recommended that a backup of the /etc/fstab file is created before editing.
156
+
> Improperly editing the **/etc/fstab** file could result in an unbootable system. If unsure, refer to the distribution's documentation for information on how to properly edit this file. You should create a backup of the **/etc/fstab** file is created before editing.
157
157
158
-
Next, open the */etc/fstab* file in a text editor as follows:
158
+
Next, open the **/etc/fstab** file in a text editor as follows:
159
159
160
160
```bash
161
-
sudo nano /etc/fstab
161
+
sudo vi /etc/fstab
162
162
```
163
163
164
164
In this example, use the UUID value for the `/dev/sdc1` device that was created in the previous steps, and the mountpoint of `/datadrive`. Add the following line to the end of the `/etc/fstab` file:
@@ -167,7 +167,7 @@ In this example, use the UUID value for the `/dev/sdc1` device that was created
We used the nano editor, so when you are done editing the file, use `Ctrl+O` to write the file and `Ctrl+X` to exit the editor.
170
+
We used the vi editor, so when you are done editing the file, press `Esc` to enter command mode and `wq` to save and close the editor.
171
171
172
172
> [!NOTE]
173
173
> Later removing a data disk without editing fstab could cause the VM to fail to boot. Most distributions provide either the *nofail* and/or *nobootwait* fstab options. These options allow a system to boot even if the disk fails to mount at boot time. Consult your distribution's documentation for more information on these parameters.
@@ -200,7 +200,7 @@ You can see that `sdc` is now mounted at `/datadrive`.
200
200
201
201
### TRIM/UNMAP support for Linux in Azure
202
202
203
-
Some Linux kernels support TRIM/UNMAP operations to discard unused blocks on the disk. This feature is primarily useful in standard storage to inform Azure that deleted pages are no longer valid and can be discarded, and can save money if you create large files and then delete them.
203
+
Some Linux kernels support TRIM/UNMAP operations to discard unused blocks on the disk. This feature is primarily useful to inform Azure that deleted pages are no longer valid and can be discarded. This feature can save money on disks that are billed based on the amount of consumed storage, such as unmanaged standard disks and disk snapshots.
204
204
205
205
There are two ways to enable TRIM support in your Linux VM. As usual, consult your distribution for the recommended approach:
206
206
@@ -225,6 +225,12 @@ There are two ways to enable TRIM support in your Linux VM. As usual, consult yo
225
225
sudo fstrim /datadrive
226
226
```
227
227
228
+
**SLSE**
229
+
230
+
```bash
231
+
sudo fstrim /datadrive
232
+
```
233
+
228
234
## Next steps
229
235
230
236
For more information, and to help troubleshoot disk issues, see [Troubleshoot Linux VM device name changes](/troubleshoot/azure/virtual-machines/troubleshoot-device-names-problems).
To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15, and SUSE SLES 15 for SAP:
208
208
@@ -211,13 +211,13 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
211
211
1. Access your VM as the **root** user by using the ```sudo``` command after logging in as another user:
212
212
213
213
```
214
-
linux:~ # sudo -i
214
+
sudo -i
215
215
```
216
216
217
217
1. Use the following command to install the **growpart** package, which will be used to resize the partition, if it is not already present:
218
218
219
219
```
220
-
linux:~ # zypper install growpart
220
+
zypper install growpart
221
221
```
222
222
223
223
1. Use the `lsblk` command to find the partition mounted on the root of the file system (**/**). In this case, we see that partition 4 of device **sda** is mounted on **/**:
@@ -237,7 +237,7 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
237
237
1. Resize the required partition by using the `growpart` command and the partition number determined in the preceding step:
@@ -299,19 +299,19 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
299
299
For **ext4**, use this command:
300
300
301
301
```
302
-
linux:~ #resize2fs /dev/sda4
302
+
resize2fs /dev/sda4
303
303
```
304
304
305
305
1. Verify the increased file system size for **df -Th** by using this command:
306
306
307
307
```
308
-
linux:~ #df -Thl
308
+
df -Thl
309
309
```
310
310
311
311
Example output:
312
312
313
313
```
314
-
linux:~ # df -Thl
314
+
df -Thl
315
315
Filesystem Type Size Used Avail Use% Mounted on
316
316
devtmpfs devtmpfs 445M 4.0K 445M 1% /dev
317
317
tmpfs tmpfs 458M 0 458M 0% /dev/shm
@@ -334,13 +334,13 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
334
334
1. Access your VM as the **root** user by using the ```sudo``` command after logging in as another user:
335
335
336
336
```bash
337
-
[root@rhel-lvm ~]# sudo -i
337
+
sudo -i
338
338
```
339
339
340
340
1. Use the `lsblk` command to determine which logical volume (LV) is mounted on the root of the file system (**/**). In this case, we see that **rootvg-rootlv** is mounted on **/**. If a different filesystem is in need of resizing, substitute the LV and mount point throughout this section.
341
341
342
342
```shell
343
-
[root@rhel-lvm ~]#lsblk -f
343
+
lsblk -f
344
344
NAME FSTYPE LABEL UUID MOUNTPOINT
345
345
fd0
346
346
sda
@@ -359,7 +359,7 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
359
359
1. Check whether there is free space in the LVM volume group (VG) containing the root partition. If there is free space, skip to step 12.
360
360
361
361
```bash
362
-
[root@rhel-lvm ~]#vgdisplay rootvg
362
+
vgdisplay rootvg
363
363
--- Volume group ---
364
364
VG Name rootvg
365
365
System ID
@@ -387,20 +387,20 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
387
387
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. 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 **]**).
1. Verify the size of the partition by using `lsblk`.
401
401
402
402
```bash
403
-
[root@rhel-lvm ~]#lsblk /dev/sda4
403
+
lsblk /dev/sda4
404
404
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
405
405
sda4 8:4 0 63G 0 part
406
406
├─rootvg-tmplv 253:1 0 2G 0 lvm /tmp
@@ -414,14 +414,14 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
414
414
1. Expand the partition containing this PV using *growpart*, the device name, and partition number. Doing so will expand the specified partition to use all the free contiguous space on the device.
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.
422
422
423
423
```bash
424
-
[root@rhel-lvm ~]#lsblk /dev/sda4
424
+
lsblk /dev/sda4
425
425
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
426
426
sda4 8:4 0 95G 0 part
427
427
├─rootvg-tmplv 253:1 0 2G 0 lvm /tmp
@@ -435,28 +435,28 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
435
435
1. Expand the PV to use the rest of the newly expanded partition
436
436
437
437
```bash
438
-
[root@rhel-lvm ~]#pvresize /dev/sda4
438
+
pvresize /dev/sda4
439
439
Physical volume "/dev/sda4" changed
440
440
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
441
441
```
442
442
443
443
1. Verify the new size of the PV is the expected size, comparing to original **[size / free]** values.
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.
@@ -476,10 +476,9 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
476
476
Example output:
477
477
478
478
```shell
479
-
[root@rhel-lvm ~]#df -Th /
479
+
df -Th /
480
480
Filesystem Type Size Used Avail Use% Mounted on
481
481
/dev/mapper/rootvg-rootlv xfs 12G 71M 12G 1% /
482
-
[root@rhel-lvm ~]#
483
482
```
484
483
485
484
> [!NOTE]
@@ -492,21 +491,21 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
492
491
1. Access your VM as the **root** user by using the ```sudo``` command after logging in as another user:
493
492
494
493
```bash
495
-
[root@rhel-raw ~]#sudo -i
494
+
sudo -i
496
495
```
497
496
498
497
1. When the VM has restarted, perform the following steps:
499
498
500
499
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
@@ -520,7 +519,7 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
520
519
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.
521
520
522
521
```bash
523
-
[root@rhel-raw ~]#gdisk -l /dev/sda
522
+
gdisk -l /dev/sda
524
523
GPT fdisk (gdisk) version 0.8.10
525
524
526
525
Partition table scan:
@@ -548,14 +547,14 @@ To increase the OS disk size in SUSE 12 SP4, SUSE SLES 12 for SAP, SUSE SLES 15,
548
547
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.
0 commit comments