Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running Ubuntu as a guest on an iMac with VirtualBox version 4.1.8.

What is the easiest way to resize the virtual drive?

Please provide as much detail as possible including the correct format for any commands.

share|improve this question
    
I would do it piping tar -cf across disks, but I'm sure there's a better way to do it. –  hbdgaf Feb 5 '12 at 21:42
    
I had the same question, running Ubuntu as a guest on a Windows 7 host. @Joni's answer was a great help, with the addition of askubuntu.com/questions/154921/… to get the swap working again. –  Luke Mills Oct 22 '12 at 11:02

2 Answers 2

This link helped me with my 'fixed' image issues:

https://forums.virtualbox.org/viewtopic.php?f=35&t=50661

share|improve this answer

If you are making the disk bigger, you would

  1. first enlarge the disk from VirtualBox, and then
  2. enlarge the partition, and
  3. the filesystem it contains.

To enlarge a disk you can use the VBoxManage modifyhd command. Suppose you want to resize the disk to 20,000 megabytes (~20GB). First locate the disk file that you want to expand. Then, in terminal, give this command to resize the disk:

VBoxManage modifyhd "path-of-disk-file" --resize 20000

To enlarge the partition and file system, probably it's easiest to boot the virtual machine using a Ubuntu livecd and do the job with GParted, as it does both at the same time and gives you a graphical user interface for it.

Attach a livecd ISO image to the virtual machine and change the boot order to first boot from CD. If you don't have a Ubuntu livecd at hand you can use any livecd that comes with the appropriate tools. SliTAZ for example is only 35MB to download. Open GParted and choose the disk you want to resize. Then right-click on the partition that you want to expand and choose the option "resize-move." In the dialog box that opens, in the graphic that represents the partition, drag the triangle at the end of the partition all the way to the right to maximize it. Then close the dialog and choose "Apply" on the toolbar. Since no data has to be moved this should be a quick operation.

When done, don't forget to detach the livecd from the virtual machine and change the boot order.

You'll find a pretty good tutorial of the whole process with screenshots included here: http://trivialproof.blogspot.com/2011/01/resizing-virtualbox-virtual-hard-disk.html

share|improve this answer
1  
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. While some info is given here, a bit more info would be good, in case the blog you linked to is down. –  hexafraction Jul 18 '12 at 17:55
    
What information would you add? –  Joni Jul 19 '12 at 13:20
1  
I recommend the main steps from the instructions so that if the blog were taken down, anyone viewing this answer would be able to fix their issue. This helps avoid linkrot –  hexafraction Jul 19 '12 at 13:21
    
@ObsessiveFOSS Better now? –  Joni Jul 22 '12 at 12:50
    
+1 It looks much better now. –  hexafraction Jul 22 '12 at 17:13

Your Answer

 
discard

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.