Expand partitions/fs in linux

Resizing partitions

Sometimes necessary so lets write this down so I won't forget next time.

This is easy for expanding. If you want to shrink the size it is going to be a bit harder, and I am not covering it in this note.

fdisk -l /dev/sda

growpart --dry-run /dev/sda 2
# ^ device and then the partition to grow
# The partition on the disk is now expanded.
# now to expand the filesystem it contains

df -h
resize2fs /dev/sda2
© Copyright 2019-2020 by Theocharis Ledakis.