Esse blog é pra postar dicas sobre IT. Coisas que eu estou estudando. Coisas que não devo esquecer.
sexta-feira, 4 de julho de 2025
Expadir LVM em maquina virtual
Para expandir o disco precisamos:
Com fdisk
- apagar a partição
- Recriar a partição com o mesmo setor de inicio
IMPORTANTE: Nâo apagar a "LVM2_member signature"
# fdisk /dev/vdb
Command (m for help): p
Disk /dev/vdb: 30 GiB, 32212254720 bytes, 62914560 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: 0x986b9785
Device Boot Start End Sectors Size Id Type
/dev/vdb1 2048 20971519 20969472 10G 8e Linux LVM
Command (m for help): d 1
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-62914559, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-62914559, default 62914559):
Created a new partition 1 of type 'Linux' and of size 30 GiB.
Partition #1 contains a LVM2_member signature.
Do you want to remove the signature? [Y]es/[N]o: n
Command (m for help): w
The partition table has been altered.
Syncing disks.
Atualizar o PV:
# pvresize /dev/vdb1
Physical volume "/dev/vdb1" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
Expandir a LV:
# lvextend -l +100%FREE /dev/mediaVG/media
Size of logical volume mediaVG/media changed from <10.00 GiB (2559 extents) to <30.00 GiB (7679 extents).
Logical volume mediaVG/media successfully resized.
Redimencionar o sistema de arquivos no meu caso o ext4
# resize2fs /dev/mediaVG/media
resize2fs 1.47.0 (5-Feb-2023)
Filesystem at /dev/mediaVG/media is mounted on /var/spool/asterisk/monitor; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 4
The filesystem on /dev/mediaVG/media is now 7863296 (4k) blocks long.
Assinar:
Postagens (Atom)