Mudanças entre as edições de "Ubuntu:Disco virtual"

De BrapciWiki
Ir para navegação Ir para pesquisar
 
(Uma revisão intermediária pelo mesmo usuário não está sendo mostrada)
Linha 24: Linha 24:
 
= Expandir disco no Ubuntu =
 
= Expandir disco no Ubuntu =
 
  lvextend -L +10G -r /dev/mapper/vg0-root
 
  lvextend -L +10G -r /dev/mapper/vg0-root
 +
 +
= Mostrando discos lógicos =
 +
sudo vgdisplay
 +
 +
= Ativando discos lógicos =
 +
sudo vgchange -ay
 +
 +
= Montando =
 +
mount /dev/mapper/ubuntu--vg--os-ubuntu--lv /data/diskA/
 +
 +
= Montando um volume lógico =
 +
Visualizar os volumes lógicos
 +
lvdisplay
 +
Resposta
 +
  --- Logical volume ---
 +
  LV Path                /dev/ubuntu-vg/ubuntu-lv
 +
  LV Name                ubuntu-lv
 +
  VG Name                ubuntu-vg
 +
  LV UUID                RHGCgX-qC4c-mvd7-XrfU-tyCP-Li2Y-MvdQ94
 +
  LV Write Access        read/write
 +
  LV Creation host, time ubuntu-server, 2024-09-17 23:08:05 +0000
 +
  LV Status              available
 +
  # open                1
 +
  LV Size                100.00 GiB
 +
  Current LE            25600
 +
  Segments              1
 +
  Allocation            inherit
 +
  Read ahead sectors    auto
 +
  - currently set to    256
 +
  Block device          252:0
 +
 +
  --- Volume group ---
 +
  VG Name              ubuntu-vg-os
 +
  System ID
 +
  Format                lvm2
 +
  Metadata Areas        1
 +
  Metadata Sequence No  4
 +
  VG Access            read/write
 +
  VG Status            resizable
 +
  MAX LV                0
 +
  Cur LV                1
 +
  Open LV              0
 +
  Max PV                0
 +
  Cur PV                1
 +
  Act PV                1
 +
  VG Size              <928.46 GiB
 +
  PE Size              4.00 MiB
 +
  Total PE              237685
 +
  Alloc PE / Size      237685 / <928.46 GiB
 +
  Free  PE / Size      0 / 0
 +
  VG UUID              nfEt3a-ime3-1dJz-YO4N-1FQK-KnW5-5gfm0L

Edição atual tal como às 16h57min de 18 de setembro de 2024

Expandindo partição LVM no Ubuntu

Espaço alocado em disco

# lsblk -f
NAME                  FSTYPE        MOUNTPOINT
sda
├─sda1                ext2          /boot
└─sda5                LVM2_member 
  ├─ubuntu--vg-root   ext4          /
  └─ubuntu--vg-swap_1 swap          SWAP
sr0

Mostrar as partições

#df -h
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                 1.6G  1.3M  1.6G   1% /run
/dev/mapper/vg0-root   12G  4.2G  7.1G  37% /
tmpfs                 7.9G     0  7.9G   0% /dev/shm
tmpfs                 5.0M     0  5.0M   0% /run/lock
/dev/sda2             987M  500M  420M  55% /boot
/dev/mapper/vg0-home  974M  520K  906M   1% /home
/dev/mapper/vg0-var   3.9G  1.6G  2.1G  43% /var
/dev/mapper/vg0-tmp   974M   84K  907M   1% /tmp
tmpfs                 1.6G  4.0K  1.6G   1% /run/user/1015

Expandir disco no Ubuntu

lvextend -L +10G -r /dev/mapper/vg0-root

Mostrando discos lógicos

sudo vgdisplay

Ativando discos lógicos

sudo vgchange -ay

Montando

mount /dev/mapper/ubuntu--vg--os-ubuntu--lv /data/diskA/

Montando um volume lógico

Visualizar os volumes lógicos

lvdisplay

Resposta

 --- Logical volume ---
 LV Path                /dev/ubuntu-vg/ubuntu-lv
 LV Name                ubuntu-lv
 VG Name                ubuntu-vg
 LV UUID                RHGCgX-qC4c-mvd7-XrfU-tyCP-Li2Y-MvdQ94
 LV Write Access        read/write
 LV Creation host, time ubuntu-server, 2024-09-17 23:08:05 +0000
 LV Status              available
 # open                 1
 LV Size                100.00 GiB
 Current LE             25600
 Segments               1
 Allocation             inherit
 Read ahead sectors     auto
 - currently set to     256
 Block device           252:0

 --- Volume group ---
 VG Name               ubuntu-vg-os
 System ID
 Format                lvm2
 Metadata Areas        1
 Metadata Sequence No  4
 VG Access             read/write
 VG Status             resizable
 MAX LV                0
 Cur LV                1
 Open LV               0
 Max PV                0
 Cur PV                1
 Act PV                1
 VG Size               <928.46 GiB
 PE Size               4.00 MiB
 Total PE              237685
 Alloc PE / Size       237685 / <928.46 GiB
 Free  PE / Size       0 / 0
 VG UUID               nfEt3a-ime3-1dJz-YO4N-1FQK-KnW5-5gfm0L