Extend the root partition of your VM online – without LVM

One of the Major issue facing by Cloud User is, the root disk will be small even you are using a high flavor. Suppose your flavor disk is 160GB, but root disk on the VM is 8GB. So, how can I extend the root partition online without unmount, and LVM. Here is the solution. I have a centos6 based Virtual Machine with a root disk of 8GB. And my flavor disk space is 160GB.

  • The Current Partition Table with 8GB

[root@centos-resize ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 7.8G 644M 6.8G 9% /
tmpfs 3.9G 0 3.9G 0% /dev/shm

  • Install the EPEL repository

yum install -y http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

  • Update the System

yum -y distro-sync

  • Install Cloud-Init package and GIT

yum install -y cloud-utils cloud-init parted git

  • Install linux-rootfs-resize

cd /tmp
git clone https://github.com/flegmatik/linux-rootfs-resize.git
cd linux-rootfs-resize

  • Edit /etc/cloud/cloud.cfg and under cloud_init_modules add:

– resolv-conf


  • Updated Partition Table with 158GB

[root@centos-resize-root centos]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 158G 976M 149G 1% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
[root@centos-resize-root centos]#

Courtesy – RDO-Project Maxo

stacker has written 20 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Humans Only. * Time limit is exhausted. Please reload the CAPTCHA.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>