Raphael Carvalho
Posted on April 11, 2022
Primeiramente, redimensione o espaço em disco do server no wmware, ou outro virtualizador;
Inicia o server;
Inicia o parted na vm:
root@srvubuntu02:~# parted /dev/sda
GNU Parted 3.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted)
- Comando print para ver o esquema de partição e o tamanho dos volumes atuais:
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sda: 26.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 2097kB 1049kB bios_grub
2 2097kB 21.5GB 21.5GB ext4
(parted)
4.1 Após perceber que o "End" é menor que o tamanho real do Disk sda, devemos inserir o comando resizepart 2 100%
:
(parted) resizepart 2 100%
Warning: Partition /dev/sda2 is being used. Are you sure you want to continue?
4.2. Ao ser questionado se deseja mesmo fazer as mudanças, digite Yes
:
Yes/No? `Yes`
4.3. Escreva o novo tamanho total com "GB" ao final:
End? [21.5GB]? 26.8GB
- Por fim, saia do parted com o comando quit
(parted) quit
Information: You may need to update /etc/fstab.
- Para ver as mudanças em disco:
root@srvubuntu02:~# fdisk -l /dev/sda | grep ^/dev
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 52343750 52339655 25G Linux filesystem
- Percebe que não houve alteração real:
root@srvubuntu02:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 933M 0 933M 0% /dev
tmpfs 196M 1.3M 195M 1% /run
/dev/sda2 20G 4.6G 14G 25% /
tmpfs 977M 0 977M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 977M 0 977M 0% /sys/fs/cgroup
/dev/loop0 55M 55M 0 100% /snap/core18/1880
/dev/loop1 30M 30M 0 100% /snap/snapd/8542
/dev/loop2 72M 72M 0 100% /snap/lxd/16099
tmpfs 196M 0 196M 0% /run/user/1000
- Por fim, aplica o comando para redimensionar o disco(sda2 neste caso):
root@srvubuntu02:~# `resize2fs /dev/sda2` _#Agora sim, redimensiona o disco_
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 4
The filesystem on /dev/sda2 is now 6542456 (4k) blocks long.
- Veja aplicado:
root@srvubuntu02:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 933M 0 933M 0% /dev
tmpfs 196M 1.3M 195M 1% /run
/dev/sda2 25G 4.6G 19G 20% /
tmpfs 977M 0 977M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 977M 0 977M 0% /sys/fs/cgroup
/dev/loop0 55M 55M 0 100% /snap/core18/1880
/dev/loop1 30M 30M 0 100% /snap/snapd/8542
/dev/loop2 72M 72M 0 100% /snap/lxd/16099
tmpfs 196M 0 196M 0% /run/user/1000
root@srvubuntu02:~#
💖 💪 🙅 🚩
Raphael Carvalho
Posted on April 11, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.