Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a ubuntu system as a virtual system on Virtual Box. It uses VHD as its hard disk. I manged to change the size of VHD using VHD resizer, now I want to expand the partition on vhd so it uses the expanded size. How can I do this?

share|improve this question

Expanding a partition and filesystem size is fairly straightforward, but it will need to be done from inside a live environment, unless it's on LVM. LVM supports online resizing of partition.

From inside a live cd, you can uses parted or a parted front-end such as gparted. The partition that you are trying to resize must be at the end of the disk. Here is an example for a single partition setup that spans an entire disk:

parted /dev/sda1 resize 0 -1

Once the partition is extended, you still need to extend the filesystem. If it is ext2/3/4, you can use resize2fs. Here is an example:

resize2fs /dev/sda1

Without any options, resize2fs will extend a filesystem to use all available space on the partition.

share|improve this answer
I can not change the size of partion as it says that it is locked. Its type is ext4. what that means? – user654019 Oct 31 '12 at 16:11
@user654019 - Is the VM booted into a liveCD? Are you root? What says it's "locked"? What is the exact error message? – jordanm Oct 31 '12 at 17:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.