Ampliación de una partición LVM dentro de una Extendida

shape
shape
shape
shape
shape
shape
shape
shape

Veamos en el siguiente ejemplo cómo aumentar una partición LVM, que está dentro de una partición Extendida. En el ejemplo de abajo, recrearemos la partición LVM, que debería empezar desde el mismo sector antiguo, es decir, en nuestro ejemplo el sector inicial de nuestro LVM es 501760, por lo que la nueva partición redimensionada también debería empezar en el sector 501760.

root@masterdaweb:~# fdisk -l
Disk /dev/sda: 800 GiB, 858993459200 bytes, 1677721600 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
Disklabel type: dos
Disk identifier: 0xac7783f0

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sda1  *      2048   499711   497664  243M 83 Linux
/dev/sda2       501758 83884031 83382274 39,8G  5 Extended
/dev/sda5       501760 83884031 83382272 39,8G 8e Linux LVM


Disk /dev/mapper/debian--vg-root: 38,1 GiB, 40907046912 bytes, 79896576 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/debian--vg-swap_1: 1,7 GiB, 1782579200 bytes, 3481600 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
root@masterdaweb:~# fdisk /dev/sda

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d
Partition number (1,2,5, default 5): 2

Partition 2 has been deleted.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (2-4, default 2): 2
First sector (499712-1677721599, default 499712): 501760
Last sector, +sectors or +size{K,M,G,T,P} (501760-1677721599, default 1677721599): 

Created a new partition 2 of type 'Linux' and of size 799,8 GiB.
Partition #2 contains a LVM2_member signature.

Do you want to remove the signature? [Y]es/[N]o: N

Command (m for help): t
Partition number (1,2, default 2): 2
Partition type (type L to list all types): 8e

Changed type of partition 'Linux' to 'Linux LVM'.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

root@masterdaweb:~# fdisk -l
Disk /dev/sda: 800 GiB, 858993459200 bytes, 1677721600 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
Disklabel type: dos
Disk identifier: 0xac7783f0

Device     Boot  Start        End    Sectors   Size Id Type
/dev/sda1  *      2048     499711     497664   243M 83 Linux
/dev/sda2       501760 1677721599 1677219840 799,8G 8e Linux LVM


Disk /dev/mapper/debian--vg-root: 38,1 GiB, 40907046912 bytes, 79896576 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

Luego simplemente reinicie la máquina para que los cambios se apliquen, y luego vuelva a subir el Volumen Físico de nuestro LVM:

shutdown -r now
pvresize /dev/sda2
root@masterdaweb:~# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               debian-vg
  PV Size               799,76 GiB / not usable 2,00 MiB
  Allocatable           yes 
  PE Size               4,00 MiB
  Total PE              204738
  Free PE               194560
  Allocated PE          10178
  PV UUID               k7gcJz-tKRI-WZb2-Dmdo-BpMn-qANT-y7PMYY
root@masterdaweb:~# vgdisplay
  --- Volume group ---
  VG Name               debian-vg
  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               799,76 GiB
  PE Size               4,00 MiB
  Total PE              204738
  Alloc PE / Size       10178 / 39,76 GiB
  Free  PE / Size       194560 / 760,00 GiB
  VG UUID               kXiqf9-oqdT-szRX-fNd9-utWC-ZncD-DwDooI

 

 

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *