Extend a Volume Group

Da WikiSitech.
Vai alla navigazioneVai alla ricerca

Gestire i Volume Groups & Logical Volumes

  • Effettuare una scansione dei logical volumes e verificarne lo stato
lvscan -a
  • Riattivare un LV che risulti disattivo
lvchange -ay <pathToLV>
  • Disattivare un LV
lvchange -an <pathToLV>

Aggiungere un disco fisico ad un VolumeGroup

vgextend <volume-group-name> /dev/sdX

Creare un Logical Volume

  • Creazione di un LV utilizzando la dimensione massima disponibile nel VG
lvcreate -n <logical-volume-name> -l 100%FREE <volume-group-name>
  • Creazione di un LV indicando la dimensione iniziale del LV a 8Gb
lvcreate -n <logical-volume-name> -L8G <volume-group-name>

Creare un file-system in un LV esistente

mkfs -t ext4 /dev/mapper/lv-name

UUID di un volume e mount automatico

Per ottenere il UUID di un volume, utilizzare il seguente comando

blkid


Per attivare il mount automatico, editare il file

/etc/fstab

Extending a logical volume in a virtual machine running Red Hat, Cent OS or OpenSUSe

Purpose
This article provides steps for extending a volume group created with Logical Volume Manager (LVM) in a virtual machine running Red Hat/Cent OS/OpenSUSe.
Resolution
Create a new disk then rescan devices.

Run this command to convert the new disk to a physical volume:

Note: The number for the sda can change depending on system setup. Use the sda number that was created in step 5.

# pvcreate /dev/sda3

Run this command to extend the physical volume:

# vgextend VolGroup00 /dev/sda3

Note: To determine which volume group to extend, use the command vgdisplay.

Run this command to verify how many physical extents are available to the Volume Group:

# vgdisplay VolGroup00 | grep "Free"

Run the following command to extend the Logical Volume:

# lvextend -L+#G /dev/VolGroup00/LogVol00

Where # is the number of Free space in GB available as per the previous command. Use the full number output from Step 10 including any decimals. Or use:

# lvextend -l +100%FREE /dev/VolGroup00/LogVol00

to extend to max size available.

Note: to determine which logical volume to extend, use the command lvdisplay.

Run the following command to expand the ext3 filesystem online, inside of the Logical Volume:

# resize2fs /dev/VolGroup00/LogVol00

Note: Use ext2online instead of resize2fs if it is a Red Hat virtual machine.

Run the following command to verify that the / filesystem has the new space available:

# df -h /

Altre fonti di informazione

Puoi trovare altre informazioni utili e complete in questo articolo.