Aumentando uma partição LVM dentro de uma Extended

shape
shape
shape
shape
shape
shape
shape
shape

Vejamos no exemplo abaixo como aumentar uma partição LVM, que está dentro de uma partição Extended. No exemplo abaixo, recriaremos a partição da LVM, que deve iniciar a partir do mesmo setor antigo, ou seja, em nosso exemplo o setor inicial da nossa LVM é o 501760, sendo assim a nova partição redimensionada deve-se iniciar também no setor 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

Em seguida basta reiniciar a máquina para que as alterações sejam aplicadas, e então redimensionar o Physical Volume de nossa 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

 

 

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *