Differenze tra le versioni di "Extend a Volume Group"

Da WikiSitech.
Vai alla navigazioneVai alla ricerca
 
(4 versioni intermedie di 2 utenti non mostrate)
Riga 9: Riga 9:
 
==Aggiungere un disco fisico ad un VolumeGroup==
 
==Aggiungere un disco fisico ad un VolumeGroup==
 
  vgextend <volume-group-name> /dev/sdX
 
  vgextend <volume-group-name> /dev/sdX
 +
Nota: Se è necessario aggiungere alla vm un disco fisico seguire questa guida: [[Sitech:Progetti/vmWare#Aggiungere_un_disco_virtuale|Aggiungere_un_disco_virtuale]]
  
 
==Creare un Logical Volume==
 
==Creare un Logical Volume==
Riga 26: Riga 27:
  
 
==Shrinking a logical volume==
 
==Shrinking a logical volume==
 +
Before shrinking the volume must be unmounted.
 +
 
  umount /dev/mapper/volume_lv
 
  umount /dev/mapper/volume_lv
 
  lvresize --resizefs -L<NEWSIZE> /dev/mapper/volume_lv
 
  lvresize --resizefs -L<NEWSIZE> /dev/mapper/volume_lv
 
  mount /dev/mapper/volume_lv
 
  mount /dev/mapper/volume_lv
 +
==Extending a logical volume (and corresponding filesystem)==
 +
lvresize --resizefs -L<NEWSIZE> /dev/mapper/volume_lv
 +
Example (extend vgData-lvdocker_volumes by 4GB):
 +
lvresize --resizefs -L+4G /dev/mapper/vgData-lvdocker_volumes
 +
oppure
 +
lvextend --resizefs -L+4G /dev/mapper/vgData-lvdocker_volumes
  
 
==Extending a logical volume in a virtual machine running Red Hat, Cent OS or OpenSUSe==
 
==Extending a logical volume in a virtual machine running Red Hat, Cent OS or OpenSUSe==

Versione attuale delle 17:10, 22 nov 2023

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

Nota: Se è necessario aggiungere alla vm un disco fisico seguire questa guida: Aggiungere_un_disco_virtuale

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

Shrinking a logical volume

Before shrinking the volume must be unmounted.

umount /dev/mapper/volume_lv
lvresize --resizefs -L<NEWSIZE> /dev/mapper/volume_lv
mount /dev/mapper/volume_lv

Extending a logical volume (and corresponding filesystem)

lvresize --resizefs -L<NEWSIZE> /dev/mapper/volume_lv

Example (extend vgData-lvdocker_volumes by 4GB):

lvresize --resizefs -L+4G /dev/mapper/vgData-lvdocker_volumes

oppure

lvextend --resizefs -L+4G /dev/mapper/vgData-lvdocker_volumes

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.