User Tools

Site Tools


docu:csheet:sysadm:disks:grow_partition

This is an old revision of the document!


Resize partition to grow the filesystem (useful on Virtual Environment Disks)


There is some cases when you need to grow/enlarge a partition on a virtual disk (usually represented as /dev/vdX), here is how to do it rebooting once (yes, i would be better sysadmin if no reboot was needed :-( )

We use this /dev/vda setup in the example:

/dev/vda
--/dev/vda1 20GB ext4
--/dev/vda2 2GB  swap
# in my case, i had a non-used swap partition at the end of /dev/vda,
# so i deleted i swap it off and delete it using fdisk
swapoff -a
fdisk /dev/vda
> d
> 2
> w
 
# i announce the changes to the OS
partprobe /dev/vda
 
# i grow the first partition (defaults to the max size of the physical disk)
growpart /dev/vda 1
 
# need reboot i guess :-( (RIP uptime)
shutdown -r now
 
# resize2fs on the root ext4 partition, and done!
resize2fs /dev/vda1
docu/csheet/sysadm/disks/grow_partition.1591257836.txt.gz · Last modified: 2020/06/04 08:03 by admin