Skip to content

Instantly share code, notes, and snippets.

@GaNiziolek
Created October 17, 2022 16:19
Show Gist options
  • Save GaNiziolek/4cc5e29408e5fe1d23835d09424a3ac1 to your computer and use it in GitHub Desktop.
Save GaNiziolek/4cc5e29408e5fe1d23835d09424a3ac1 to your computer and use it in GitHub Desktop.
Alterar tamanho da partição do Ubuntu Server 20.04

Fonte: https://askubuntu.com/questions/116351/increase-partition-size-on-which-ubuntu-is-installed

Para ver as partições utilize

sudo cfdisk

image

Selecione a partição que deseja extender e escolha a opção "Resize"

Digite o novo tamanho

image

Pressione Enter, aparecerá uma mensagem dizendo "Partition (algum número) resized"

image

Selecione "Write" para salvar as alterações

image

Digite "yes" para confirmar

image

Saia do cfdisk selecionando "Quit". Você deve ver uma mensagem "syncing disks".

Reinicie a máquina

sudo reboot

Utilize lsblk para obter o nome da partição (Ex.: xvda3)

image

Execute sudo pvresize /dev/xvda3

Execute sudo lvextend -L +19G /dev/mapper/ubuntu--vg-ubuntu--lv substituindo o tamanho à incrementar e o nome correspondentemente

Execute sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv isso deve gerar uma saída parecida com

resize2fs 1.42.13 (17-May-2015)
 Filesystem at /dev/mapper/linuxetc1--vg-root is mounted on /; on-line resizing required
 old_desc_blocks = 1, new_desc_blocks = 2
 The filesystem on /dev/mapper/linuxetc1--vg-root is now 4854784 (4k) blocks long.

Utilize df -h para verificar se tudo deu certo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment