FAQ:Gestionespacedisque : Différence entre versions

De WikiFr_dbSQWare
Aller à : navigation, rechercher
Ligne 8 : Ligne 8 :
  
 
=== 1.  Identifier les LV (Volumes Logiques) et VG (Groupes de Volumes) ===
 
=== 1.  Identifier les LV (Volumes Logiques) et VG (Groupes de Volumes) ===
 +
Ici on recupere le nom du lv final qu'on veut augmenter
 +
root@srvdbsqware01:/root # lvdisplay
 +
--- Logical volume ---
 +
  LV Path                /dev/data_vg/data
 +
  LV Name                data
 +
  VG Name                data_vg
 +
  LV UUID                KlBNRO-KrQA-SIq6-v4Hv-VgU8-4KMQ-o3PhGe
 +
  LV Write Access        read/write
 +
  LV Creation host, time localhost.localdomain, 2025-02-12 19:10:05 +0100
 +
  LV Status              available
 +
  # open                1
 +
  LV Size                15.00 GiB
 +
  Current LE            3840
 +
  Segments              1
 +
  Allocation            inherit
 +
  Read ahead sectors    auto
 +
  - currently set to    256
 +
  Block device          253:5
  
 +
On a bien notre data_vg avec 15 GiB de libre
 
  root@srvdbsqware01:/root # vgdisplay  
 
  root@srvdbsqware01:/root # vgdisplay  
 
  --- Volume group ---
 
  --- Volume group ---
Ligne 30 : Ligne 49 :
 
   Free  PE / Size      3840 / 15.00 GiB
 
   Free  PE / Size      3840 / 15.00 GiB
 
   VG UUID              2yhlSM-sJ4x-lR2S-dqAD-uW68-atEp-ruPNFr
 
   VG UUID              2yhlSM-sJ4x-lR2S-dqAD-uW68-atEp-ruPNFr
 
root@srvdbsqware01:/root # lvdisplay
 
--- Logical volume ---
 
  LV Path                /dev/data_vg/data
 
  LV Name                data
 
  VG Name                data_vg
 
  LV UUID                KlBNRO-KrQA-SIq6-v4Hv-VgU8-4KMQ-o3PhGe
 
  LV Write Access        read/write
 
  LV Creation host, time localhost.localdomain, 2025-02-12 19:10:05 +0100
 
  LV Status              available
 
  # open                1
 
  LV Size                15.00 GiB
 
  Current LE            3840
 
  Segments              1
 
  Allocation            inherit
 
  Read ahead sectors    auto
 
  - currently set to    256
 
  Block device          253:5
 
  
  

Version du 19 février 2025 à 11:49

Tuto : Redimensionner une VM sous Linux

Prérequis

- Accès root ou utilisateur avec des privilèges sudo.
- Vous avez déjà une partition ou un disque supplémentaire à ajouter ou redimensionner.

Étapes pour redimensionner une VM

1. Identifier les LV (Volumes Logiques) et VG (Groupes de Volumes)

Ici on recupere le nom du lv final qu'on veut augmenter

root@srvdbsqware01:/root # lvdisplay
--- Logical volume ---
 LV Path                /dev/data_vg/data
 LV Name                data
 VG Name                data_vg
 LV UUID                KlBNRO-KrQA-SIq6-v4Hv-VgU8-4KMQ-o3PhGe
 LV Write Access        read/write
 LV Creation host, time localhost.localdomain, 2025-02-12 19:10:05 +0100
 LV Status              available
 # open                 1
 LV Size                15.00 GiB
 Current LE             3840
 Segments               1
 Allocation             inherit
 Read ahead sectors     auto
 - currently set to     256
 Block device           253:5

On a bien notre data_vg avec 15 GiB de libre

root@srvdbsqware01:/root # vgdisplay 
--- Volume group ---
 VG Name               data_vg
 System ID
 Format                lvm2
 Metadata Areas        2
 Metadata Sequence No  7
 VG Access             read/write
 VG Status             resizable
 MAX LV                0
 Cur LV                4
 Open LV               4
 Max PV                0
 Cur PV                2
 Act PV                2
 VG Size               60.00 GiB
 PE Size               4.00 MiB
 Total PE              15360
 Alloc PE / Size       11520 / 45.00 GiB
 Free  PE / Size       3840 / 15.00 GiB
 VG UUID               2yhlSM-sJ4x-lR2S-dqAD-uW68-atEp-ruPNFr


Redimensionnement des volumes

1. Aggrandir le volume groupe (VG)

vgextend [options] <volume_groupe> <disque_ou_partition>
ex : vgextend vg_name /dev/sda1  # Remplacez vg_name par le nom de votre VG et /dev/sda1 par la partition modifiée


Vérifier que l'espace a bien été ajouté au volume groupe (VG)

vgdisplay vg_name

2. Redimensionner le volume logique (LV)

lvextend [options] <taille> <volume_logique>
ex : lvextend -l +100%FREE /dev/vg_name/lv_name  # Utilise tout l'espace libre dans le volume groupe (VG)
ex : lvextend -L12G /vg_name/lv_name   # Étend le disque jusqu'à 12GB
ex : lvextend -L+1G /vg_name/lv_name   # Ajoute 1GB


Ajuster la taille du système de fichiers selon le type de système de fichiers utilisé

ex : resize2fs /dev/vg_name/lv_name  # ext4
ex : xfs_growfs /dev/vg_name/lv_name  # XFS


Vérifier l'espace disque

df -h