Ask Your Question

How to resize VM root partition

asked 2019-03-05 01:05:29 -0500

Girish L gravatar image

I'm running a ubuntu VM with the X-large flavour (160GB disk size). But, when I run df-h command on my VM, it is showing only 15GB on /dev/vda1. I am running one application on this VM, now I am running out of disk space. Kindly suggest me the solution for this issue.

edit retag flag offensive close merge delete


What do you get when running lsblk on the instance?

I expect that your /dev/vda is 160 GB. I also believe that it is the image, not OpenStack, which decides how the disk is partitioned.

Bernd Bausch gravatar imageBernd Bausch ( 2019-03-05 02:09:39 -0500 )edit

See for suggestions how to change partitioning. E.g. cloud-init's growpart module.

Bernd Bausch gravatar imageBernd Bausch ( 2019-03-05 02:09:56 -0500 )edit

Thanks for your reply. Yes, when I run lsblk on the instance it is showing the following: 1. /dev/vda is showing 160GB 2. /dev/vda1 is showing 15.5GB

Now, I want to allocate complete 160GB to /dev/vda1.

How to make use of complete disk for VM.

Girish L gravatar imageGirish L ( 2019-03-05 03:04:28 -0500 )edit

Was eblock’s answer your solution?

Instead of fdisk, you can also use parted. It is, however, always risky to resize partitions manually.

Bernd Bausch gravatar imageBernd Bausch ( 2019-03-05 04:31:43 -0500 )edit

2 answers

Sort by » oldest newest most voted

answered 2019-03-05 01:56:29 -0500

eblock gravatar image

updated 2019-03-05 09:44:05 -0500

You have to extend the respective partition(s) to your needs with tools like fdisk or parted etc. If you run fdisk -l /dev/vda you'll see that you have plenty of space but your partition table does not reflect that. To edit the partition table you can use fdisk /dev/vda without the -l.

But before you do anything, please make a backup of your instance so you can roll back. Also make sure you edit the partition table correctly, here's one example of how to do it. You can extend a partition without unmounting it, but you'll have to reboot after the resize2fs command.

Some images are able to recognize the actual disk size and resize their partitions during first boot, but that's not relevant right now. So please be careful what you're doing, and if you're not sure, ask someone to help you. And again: make a backup before changing the partition table!

edit flag offensive delete link more

answered 2019-03-05 01:08:22 -0500

novainfinite gravatar image

i search a lot i can not find a way at last i use ceph and ceph storage do it for me

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2019-03-05 01:05:29 -0500

Seen: 106 times

Last updated: Mar 05