Skip to content

Instantly share code, notes, and snippets.

@csamsel
Created January 29, 2018 18:17
Show Gist options
  • Save csamsel/a0001e604035886a1839f307473e8bbd to your computer and use it in GitHub Desktop.
Save csamsel/a0001e604035886a1839f307473e8bbd to your computer and use it in GitHub Desktop.
Increase btrfs gpt partition after enlarging the virtual drive
oxygen-system-vm ~ # fdisk -l /dev/sda
GPT PMBR size mismatch (41943039 != 62914559) will be corrected by w(rite).
Disk /dev/sda: 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: gpt
Disk identifier: 10B93AE8-1045-434C-A36E-F7801B17CE32
Device Start End Sectors Size Type
/dev/sda1 2048 6143 4096 2M BIOS boot
/dev/sda2 6144 268287 262144 128M EFI System
/dev/sda3 268288 1316863 1048576 512M Linux swap
/dev/sda4 1316864 41940991 40624128 19.4G Linux filesystem
oxygen-system-vm ~ # parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 20971520 blocks) or continue
with the current setting?
Fix/Ignore? fix
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 3146kB 2097kB grub bios_grub
2 3146kB 137MB 134MB fat16 boot boot, esp
3 137MB 674MB 537MB linux-swap(v1) swap
4 674MB 21.5GB 20.8GB btrfs rootfs
(parted) resizepart
Partition number? 4
Warning: Partition /dev/sda4 is being used. Are you sure you want to continue?
Yes/No? y
End? [21.5GB]? 32GB
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 32.2GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 3146kB 2097kB grub bios_grub
2 3146kB 137MB 134MB fat16 boot boot, esp
3 137MB 674MB 537MB linux-swap(v1) swap
4 674MB 32.0GB 31.3GB btrfs rootfs
(parted) quit
Information: You may need to update /etc/fstab.
oxygen-system-vm ~ # btrfs filesystem resize max /
Resize '/' of 'max'
oxygen-system-vm ~ # df -h
Filesystem Size Used Avail Use% Mounted on
udev 10M 4.0K 10M 1% /dev
/dev/sda4 30G 17G 12G 59% /
tmpfs 201M 988K 200M 1% /run
shm 1002M 0 1002M 0% /dev/shm
cgroup_root 10M 0 10M 0% /sys/fs/cgroup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment