Extender la partición en el servidor virtual

Extender la partición en el servidor virtual

Solicité ampliar el tamaño del disco de mi servidor virtual de 20 GB -> 80 GB.

Después de eso, el tamaño del disco /dev/sdase aumentó a 80 GiB. Pero el tamaño /dev/sda2se mantuvo sin cambios, en 19,5 GiB:

root@localhost:/home/worker# fdisk -l
Disk /dev/sda: 80 GiB, 85899345920 bytes, 167772160 sectors
Disk model: Virtual disk    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x520f1760

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sda1  *      2048   999423   997376  487M 83 Linux
/dev/sda2       999424 41943039 40943616 19.5G 8e Linux LVM


Disk /dev/mapper/vg00-lv00: 1.93 GiB, 2046820352 bytes, 3997696 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/vg00-lv01: 17.63 GiB, 18912116736 bytes, 36937728 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Podría solucionar esto usando el growpartcomando:

root@localhost:# growpart /dev/sda 2
CHANGED: partition=2 start=999424 old: size=40943616 end=41943040 new: size=166772703 end=167772127
root@localhost:/home/worker# fdisk -l
Disk /dev/sda: 80 GiB, 85899345920 bytes, 167772160 sectors
Disk model: Virtual disk    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x520f1760

Device     Boot  Start       End   Sectors  Size Id Type
/dev/sda1  *      2048    999423    997376  487M 83 Linux
/dev/sda2       999424 167772126 166772703 79.5G 8e Linux LVM

Sin embargo, todavía no hay suficiente espacio en mi sistema de archivos.

root@localhost:# df -h
Filesystem             Size  Used Avail Use% Mounted on
udev                   947M     0  947M   0% /dev
tmpfs                  196M  928K  195M   1% /run
/dev/mapper/vg00-lv01   18G   17G  180M  99% /
tmpfs                  977M   20K  977M   1% /dev/shm
tmpfs                  5.0M     0  5.0M   0% /run/lock
tmpfs                  977M     0  977M   0% /sys/fs/cgroup
/dev/sda1              456M  147M  276M  35% /boot
tmpfs                  196M     0  196M   0% /run/user/1000

De Google entiendo que también tengo que aumentar la partición de alguna manera. Sin embargo, en la web encontré información sobre cómo hacer esto en ´ext4´ u otros tipos. En mi caso el tipo se especifica como LVM2_member. No sé cómo lidiar con eso.

root@localhost:# blkid
/dev/mapper/vg00-lv00: UUID="d236bafc-c18c-49aa-816d-85f0c7afc810" TYPE="swap"
/dev/mapper/vg00-lv01: UUID="77ae49d6-38e3-44c5-a20b-e10972c8ee21" TYPE="ext4"
/dev/sda1: UUID="de2cb53e-6086-4fd5-99a9-1c22674a4f91" TYPE="ext4" PARTUUID="520f1760-01"
/dev/sda2: UUID="R5VWXg-jamB-5dWM-PpwY-7a49-LRz7-Vrvdl2" TYPE="LVM2_member" PARTUUID="520f1760-02"

Lo he probado lvextendsin resultado:

root@localhost:/home/worker#df
Filesystem            1K-blocks     Used Available Use% Mounted on
udev                     969104        0    969104   0% /dev
tmpfs                    199936      928    199008   1% /run
/dev/mapper/vg00-lv01  18114384 17097768    183380  99% /
tmpfs                    999668       20    999648   1% /dev/shm
tmpfs                      5120        0      5120   0% /run/lock
tmpfs                    999668        0    999668   0% /sys/fs/cgroup
/dev/sda1                466664   149872    281888  35% /boot
tmpfs                    199932        0    199932   0% /run/user/1000

root@localhost:/home/worker# lvextend -l +100%FREE /dev/mapper/vg00-lv01
  New size (4509 extents) matches existing size (4509 extents).

root@localhost:/home/worker# df
Filesystem            1K-blocks     Used Available Use% Mounted on
udev                     969104        0    969104   0% /dev
tmpfs                    199936      928    199008   1% /run
/dev/mapper/vg00-lv01  18114384 17097788    183360  99% /
tmpfs                    999668       20    999648   1% /dev/shm
tmpfs                      5120        0      5120   0% /run/lock
tmpfs                    999668        0    999668   0% /sys/fs/cgroup
/dev/sda1                466664   149872    281888  35% /boot
tmpfs                    199932        0    199932   0% /run/user/1000

más información

root@localhost:# vgdisplay -v vg00
  --- Volume group ---
  VG Name               vg00
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <19.52 GiB
  PE Size               4.00 MiB
  Total PE              4997
  Alloc PE / Size       4997 / <19.52 GiB
  Free  PE / Size       0 / 0   
  VG UUID               ZRC0sL-qOeU-Uyfp-Qbo4-m06c-CwEt-xpFTsO
   
  --- Logical volume ---
  LV Path                /dev/vg00/lv00
  LV Name                lv00
  VG Name                vg00
  LV UUID                fQt2D5-OofH-m0yQ-jRP8-MJog-gcKp-3GhTa4
  LV Write Access        read/write
  LV Creation host, time somehost, 2021-05-20 11:12:52 +0000
  LV Status              available
  # open                 2
  LV Size                <1.91 GiB
  Current LE             488
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
   
  --- Logical volume ---
  LV Path                /dev/vg00/lv01
  LV Name                lv01
  VG Name                vg00
  LV UUID                e3zugo-eu0a-gWgm-ULmN-LstF-tdNg-3uMPWZ
  LV Write Access        read/write
  LV Creation host, time somehost, 2021-05-20 11:12:52 +0000
  LV Status              available
  # open                 1
  LV Size                17.61 GiB
  Current LE             4509
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
   
  --- Physical volumes ---
  PV Name               /dev/sda2     
  PV UUID               R5VWXg-jamB-5dWM-PpwY-7a49-LRz7-Vrvdl2
  PV Status             allocatable
  Total PE / Free PE    4997 / 0

y

root@localhost:#lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:    20.04
Codename:   focal

Gracias por su ayuda.

Respuesta1

Solución encontrada, después de contactar al soporte. https://www.ionos.de/hilfe/index.php?id=4315

Básicamente pvresize /dev/sda2faltaba el paso antes de presentar la solicitud lvextend.

SOLUCIONADO ahora.

información relacionada