Search This Blog

Friday, November 25, 2022

Growing a ext4 disk on a cloud / VMware VM

Normal I use GParted CD boot a VM to growing a Linux ext4 disk partition. Or using LVM. It's way easier on Windows VM. I tried cloud-utils tool on a Debian 10 VM on VMware ESXi 7. Just a bare ext4 partition without LVM. It should works on any other Cloud plantform like: AWS, Oracle or Google. Install cloud-utils after increase the disk size from the Cloud Control Console:
sudo apt-get install -y cloud-utils
################### ### Before ########## ###################
df -h
	Filesystem      Size  Used Avail Use% Mounted on
	/dev/sda1        16G   11G  4.2G  72% /
	/dev/sdb1       295G  247G   33G  89% /data
################### ### grow /dev/sdb1 ### ###################
echo 1 > /sys/class/block/sdb/device/rescan
growpart /dev/sdb 1
	CHANGED: partition=1 start=2048 old: size=629143552 end=629145600 new: size=880801759,end=880803807

resize2fs /dev/sdb1
	resize2fs 1.44.5 (15-Dec-2018)
	Filesystem at /dev/sdb1 is mounted on /data; on-line resizing required
	old_desc_blocks = 38, new_desc_blocks = 53
	The filesystem on /dev/sdb1 is now 110100219 (4k) blocks long.
################### ### grow /dev/sda1 ### ###################
echo 1 > /sys/class/block/sda/device/rescan
growpart /dev/sda 1
	CHANGED: partition=1 start=2048 old: size=33550336 end=33552384 new: size=83883999,end=83886047

resize2fs /dev/sda1
	resize2fs 1.44.5 (15-Dec-2018)
	Filesystem at /dev/sda1 is mounted on /; on-line resizing required
	old_desc_blocks = 2, new_desc_blocks = 5
	The filesystem on /dev/sda1 is now 10485499 (4k) blocks long.
################### ### After ########### ###################
df -h
	Filesystem      Size  Used Avail Use% Mounted on
	/dev/sda1        40G   11G   27G  29% /
	/dev/sdb1       413G  247G  146G  63% /data

No comments:

Post a Comment