Extend Linux system partition

Aus TERRA CLOUD WIKI

Version vom 8. Januar 2024, 13:50 Uhr von Christian Toedtmann (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „== Create partition == Please first run the following command:<br> ''cfdisk''<br> <br> border|run cfdisk<br> <br> First, a new partition must be created. To do this, navigate to the empty memory and select “New” below. <br> The suggested size can be adopted. Next the type needs to be changed. To do this, select Type and select LVM (8e) as type. <br> <br> border|Select 8e Linux LVM <br> <br> Then complete t…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)

Sprachen:

Create partition

Please first run the following command:
cfdisk

run cfdisk

First, a new partition must be created. To do this, navigate to the empty memory and select “New” below.
The suggested size can be adopted. Next the type needs to be changed. To do this, select Type and select LVM (8e) as type.

Select 8e Linux LVM

Then complete the changes with Write and exit cfdisk with Quit.

Add partition to LVM

First perform a “rescan” with partprobe so that the previously created partition is found.
In this example sda3. This can of course vary.
In the next step we add the partition to the LVM with the following command:
vgextend ubuntu-vg /dev/sda3

Add partition

Using the pvs command you should now see the following:

Overview

Expand existing LVM volume

The existing volume is expanded to include the new free storage space:
lvextend –l+100%FREE /dev/ubuntu-vg/root

Expand Volume

Finally, the file system must be expanded in order to be able to use the new storage space:
df –h
resize2fs /dev/mapper/ubuntu—vg-root

resize