Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: How to resize Hard drive in Virtualbox

  1. #1
    Join Date
    Apr 2007
    Location
    Pensacola, FL
    Beans
    418
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    How to resize Hard drive in Virtualbox

    How do I make my virtual Hard disk bigger?

    It is very new, but I do not want to reinstall because then I might have to call microsoft for activation, and that is annoying.

    So back to my question. I did try to use gparted like other threads have suggested, but it doesn't allow me to make it any bigger.

    Thanks,

    Joshua
    "Well, now that we have seen each other," said the Unicorn, "if you'll believe in me, I'll believe in you. Is that a bargain?" --Alice in Wonderland

    If someone asks you to sudo rm -rf anything don't do it.

  2. #2
    Join Date
    Mar 2007
    Beans
    4

    Re: How to resize Hard drive in Virtualbox

    use these instructions at your own risk, they worked for me but you have to be careful when working with partitions. i recommend backing up all your data before you start.

    start by making a new drive through the virtualbox drive manager. i chose to make mine 30GB. set this drive to be the primary slave for the system you want to upgrade.

    next download the clonezilla livecd iso from sourceforge http://clonezilla.sourceforge.net/download/sourceforge/

    and the gparted livecd
    http://sourceforge.net/projects/gparted/
    note: i could not get the latest version (3.4.11) to boot in my virtualbox. it hung during boot at mounting usbfs. i tried version 3.3.7 and this version booted correctly.

    once you have these iso files, set your virtual machine to boot from the clonezilla iso. boot it (default options should be fine) and choose a disk to disk clone. set your old virtual drive (probably /dev/hda) as the source and your newly created virtual drive (probably /dev/hdb) as the target. for the options, i think i chose do NOT install grub bootloader and left everything else at the default. let it make a copy of your disk (can take a long time) then poweroff your virtual machine.

    now you have (hopefully) an identical copy of your virtual machine but on a bigger disk. to let your guest operating system see the new drive space, you have to expand both the partition table and the file system.

    at this point you could release your old virtual drive and set your newer, bigger virtual drive as the primary hard disk. set your virtual machine to boot from the gparted iso and run
    Code:
    cfdisk
    once its booted up. if you have your new virtual disk set as the primary, cfdisk should automatically load its partition table. you should see something like /dev/hda1 with a size given by whatever your original virtual drive was, and then free space. go ahead and delete the partition, then create a new partition which takes up the entire available space. set this new partition to be bootable and change its type to ntfs (07 in cfdisk).

    at this point, you should reboot to update the partition table changes. now the only thing left to do is expand the ntfs filesystem. this can be done with ntfsresize (program on the gparted live iso). to be safe, boot into windows now and run chkdsk /f in the terminal and then reboot into windows again. this will force windows to check its ntfs filesystem so there should be no errors that ntfsresize will complain about. after this is done, boot into gparted again. run
    Code:
    ntfsresize -i /dev/hda1
    (or whatever your drive letter is). ntfsresize will tell you the size in MB of your virtual drive, so to be safe, resize to 1 MB less than this size.

    for my drive, ntfsresize told me it was 32113MB so I chose to resize to 32112MB. to do this run
    Code:
    ntfsresize --no-action --size 32112M /dev/hda1
    if this command returns without errors, take out the --no-action flag and run it for real. once this is done reboot into windows. it will run a checkdisk again, reboot, and now you should see your bigger drive available.
    Last edited by los santos; March 6th, 2008 at 12:41 AM.

  3. #3
    Join Date
    Sep 2006
    Location
    Austin, TX
    Beans
    Hidden!

    Re: How to resize Hard drive in Virtualbox

    Thanks for this howto. Using the newest version of clonezilla (clonezilla-live-1.0.9-19.iso) you might not have to use gparted to resize the partition. Clonezilla had the option:
    -e "Resize the filesystem to fit partition size in target partition."
    which I selected and it tried to resize the copied partition to the size of the new disk. It failed for me because the FAT32 partition I was using had windows log files that weren't the expected size.

    Some other notes:
    • Use space bar to select the target and destination disks. An asterisk will appear. Pressing enter when the desired drive is highlighted just exits the process, and gives you the option to start over, powerdown, restart, etc.
    • Unselect option -g-auto (write grub). This is in the same menu as -e above.
    • After starting the copy it will give a couple of warnings about all data being lost on the destination drive.
    • Select yes when it asks "Do you want to clone the bootloader?"
    • On a 7200 rpm disk it copied at a rate of ~300 MB / minute.

  4. #4
    Join Date
    Apr 2008
    Location
    Madison, WI
    Beans
    73
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: How to resize Hard drive in Virtualbox

    I just confirmed that the "Resize the filesystem to fit partition size in target partition." option with Clonezilla does the trick. I ran clonezilla on my 10Gb vdi and cloned it to a 30Gb vdi using this option with no problem. Worked very well.

  5. #5
    Join Date
    Nov 2008
    Location
    Chennai
    Beans
    13
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to resize Hard drive in Virtualbox

    paraplegicpanda,

    I tried the same but, it only transfers to target partition with same size of the source partition.

    Could you please provide me the procedure you followed to Clone with resized partition size ?

    Thanks

  6. #6
    Join Date
    Nov 2008
    Location
    Chennai
    Beans
    13
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to resize Hard drive in Virtualbox

    Hi,

    Please ignore the request.
    I used CloneZilla to copy the partition and GParted to resize, i got the free space as required.

  7. #7
    Join Date
    Mar 2006
    Location
    Stockholm, Sweden
    Beans
    694
    Distro
    Ubuntu Development Release

    Re: How to resize Hard drive in Virtualbox

    There is a great guide on the subject here: http://www.my-guides.net/en/content/view/122/26/

  8. #8
    Join Date
    Oct 2006
    Location
    uk
    Beans
    65
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to resize Hard drive in Virtualbox

    Quote Originally Posted by los santos View Post
    use these instructions at your own risk, they worked for me but you have to be careful when working with partitions. i recommend backing up all your data before you start.

    ..
    i had made this fatal mistake of setting up a 8gig virtaul box partition for ubuntu 10.04 32bit (windows 7 64bit as host), primary reason was to fully equip that vm with the android dev kit, with all bells and whistles - had no idea the andoid dev kit would be so huge - well after installing everything i needed i was only left with about 80 mega bytes of free space

    thanks for the cloning steps, now i have replaced the 8gb with a 30gb virtual hard drive

  9. #9
    Join Date
    Aug 2010
    Beans
    1

    Re: How to resize Hard drive in Virtualbox

    the steps:
    1. start Virtual Box and log on windows.
    2. download free partition utility at: http://download.cnet.com/Partition-A...-75118871.html
    3. use partition tool to extend your partition.
    if you need to create, delete or format, read how to partition a hard drive.
    Last edited by jacksonam; August 30th, 2010 at 10:15 AM.

  10. #10
    Join Date
    May 2009
    Beans
    14

    Re: How to resize Hard drive in Virtualbox

    Quote Originally Posted by jacksonam View Post
    the steps:
    1. start Virtual Box and log on windows.
    2. download free partition utility at: http://download.cnet.com/Partition-A...-75118871.html
    3. use partition tool to extend your partition.
    if you need to create, delete or format, read how to partition a hard drive.
    The above suggestion by "jacksonam" doesn't work. Just tried it. Perhaps the professional edition has this functionality, but the home edition (which is free) doesn't see that there is additional space, so it can't expand your partition beyond the maximum specified when it was created.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •