[Solved] How to make a virtual disk bigger?

Discussions related to using VirtualBox on Linux hosts.
gushy
Posts: 7
Joined: 11. Jul 2007, 13:30

Post by gushy »

oh yeah so you can! I'll amend the instructions. :oops:
--
Gushy
chamstar
Posts: 21
Joined: 20. Jun 2007, 18:09

Post by chamstar »

For some reason when I boot in to the new disk I get "A disk read error occured Press Ctrl+Alt+Del to restart". In gparted the new disk looks identical to the original (except its size), I even tried formatting as ntfs before doing the copy (prob. not needed but...) and I made sure to set the flag to boot.

Any ideas?

If I boot using the original disk and have the new disk as the secondary drive i can see it has copied okay, all the files are there and it is readable...
gushy
Posts: 7
Joined: 11. Jul 2007, 13:30

Post by gushy »

I'm not sure what the problem could be to be honest; I didn't run across that error.

Is that a bios / virtualbox message or does it come up during windows boot?

You wouldn't have needed to format ntfs first as you are copying the partition, not just the contents, gparted takes care of it.
--
Gushy
chamstar
Posts: 21
Joined: 20. Jun 2007, 18:09

Post by chamstar »

No worries, thanks for you instructions anyway :)
The error is before Windows boots...
gushy
Posts: 7
Joined: 11. Jul 2007, 13:30

Post by gushy »

So it's definitely an issue with the disk and not the windows copy.

I guess in your shoes my next step would be trying installing a fresh copy of windows / linux on the disk you've created to make sure the disk created ok.

If that works you know the problem is during the partition copy. I'd then re-copy the partition over but without resizing and try then, you can then resize it later.

If none of that works, try a new disk either using virtual disk manager or vditool.
--
Gushy
JusTiCe8
Posts: 37
Joined: 13. May 2007, 10:19
Location: Paris
Contact:

Post by JusTiCe8 »

Hi,

it coulkd be linked to the disk MBR ("fdisk /mbr" with a win98 system disk for example, it may be have others way to do so). As I guess by reading your posts, copy have been done at a filesystem point of view (copy files one by one from A to B), so disk structure has not been copied too.

Regards.
chamstar
Posts: 21
Joined: 20. Jun 2007, 18:09

Post by chamstar »

Okay so I did I a fresh install of Windows on the new (big) partition and this worked fine. Secondly as suggested I tried to copy my orignal (small) copy of Windows over the new installed one... The first time I tried the VM aborted! I tried again and it copied, but on reboot to the big drive I got the exact same error: "A disk read error occured". Not sure what to make of it... At least I kept a backup of the big VDI with a fresh Windows. I'll just have to re-install the programs I need on that and ditch the original Windows!
darose
Posts: 12
Joined: 23. Oct 2007, 23:08

Post by darose »

chamstar wrote:For some reason when I boot in to the new disk I get "A disk read error occured Press Ctrl+Alt+Del to restart". In gparted the new disk looks identical to the original (except its size), I even tried formatting as ntfs before doing the copy (prob. not needed but...) and I made sure to set the flag to boot.

Any ideas?

If I boot using the original disk and have the new disk as the secondary drive i can see it has copied okay, all the files are there and it is readable...
I'm having the exact same problem when I try to copy to a larger .vdi. Does anyone have any idea why that might be happening?
darose
Posts: 12
Joined: 23. Oct 2007, 23:08

Post by darose »

darose wrote:
chamstar wrote:For some reason when I boot in to the new disk I get "A disk read error occured Press Ctrl+Alt+Del to restart". In gparted the new disk looks identical to the original (except its size), I even tried formatting as ntfs before doing the copy (prob. not needed but...) and I made sure to set the flag to boot.

Any ideas?

If I boot using the original disk and have the new disk as the secondary drive i can see it has copied okay, all the files are there and it is readable...
I'm having the exact same problem when I try to copy to a larger .vdi. Does anyone have any idea why that might be happening?
Woo hoo! Actually I just did get it to work. Problem seems to be that I was trying to increase the disk size too much. I tried increasing a 2GB first to 10GB and then to 5GB, but it kept getting the disk read error. Finally I tried 3GB, and that seemed to work.

Hope this helps someone.
Ingo
Volunteer
Posts: 731
Joined: 22. Aug 2007, 10:13
Location: Germany

Post by Ingo »

I don't read the whole thread but if you only want to make a virtual disk bigger I have made some suggestions here:
http://forums.virtualbox.org/viewtopic.php?t=1966
litemotiv
Posts: 4
Joined: 29. Jun 2007, 16:29

Post by litemotiv »

here is another working way to copy your VM to any arbitrary size:

1. create a new empty disk of the desired size, attach it as secondary drive to your VM
2. download HDClone (freeware 4mb), mount the ISO as cd-rom and boot up
3. follow the steps on screen to clone your original drive to the new one
4. when finished, shutdown the VM, mount the rescueCD (or any disk with gparted) mentioned earlier in this topic
5. in gparted, resize the partition to the full harddisk size
6. shutdown again, unmount cd-rom, boot into windows

that's it. ;)

in case you run into boot problems after completing the steps above, start windows in safe mode and let windows detect the new drive. your installation should run fine after that.
RichTJ99
Posts: 13
Joined: 3. Nov 2007, 06:13

Post by RichTJ99 »

gushy wrote:JusTiCe8 is right, I've just done this by creating a bigger disk and then copying the contents.
  • Create a new disk using Virtual Disk Manager (in VirtualBox goto File -> Virtual Disk Manager)
  • download System Rescue CD
  • set your current VM to have the new disk image as it's second hard disk and the System Rescue CD iso file as it's CD
  • boot the vm from the CD
  • at the command prompt type startx
  • when X Windows starts, type gparted in the terminal that is open on screen
  • in gparted select the windows partition and choose copy
  • select the second hard disk
  • right click on the representation of the disk and click paste
  • gparted will prompt you for the size of the disk, drag the slider to the max size
  • click apply
  • wait .......
  • when it's done right click on the disk and choose Manage Flags, and select Boot
  • exit gparted and power off the VM
  • change the VM settings to only have one disk (the new bigger disk) and deselect the iso as the CD.
  • boot the VM into your windows install on it's new bigger disk!
I don't think I've missed any steps out....
Can you simply delete the old virtual drive when finished? Is there an easy way to do that (or just navigate to the directory?


Thanks for the step by step instructions, that looks pretty good. I have to say with something like Virtual box running XP (for MS exchange + outlook), I might dump Windows completely (as a primary OS).
spirospirov
Posts: 1
Joined: 14. Nov 2007, 14:14

How to make a virtual disk bigger/smaller

Post by spirospirov »

Nice thread!

Today I realized I need to make my VDI smaller. The procedure follows:

1. Make new VDI

2. Attach it as primary slave HDD

3. Boot the virtual machine

4. Create and format the new HDD using windows "Disk management"
NOTE: Do NOT assign drive letter to the new drive!!!

5. Shut-down the virtual machine

6. Mount Slax live CD ISO-image.
NOTE: I suppose any kind of live-CD will be ok. I used Slax because I have it.

7. Boot from that CD-image

8. Copy all files from existing windows VDI to the empty VDI (/mnt/hda1 to /mnt/hdb1 in my case)

9. Shut-down the virtual machine

10. Unmount the live CD image

11. Set the new VDI as primary master HDD

12. Boot and enjoy :)

------
P.S.
(a) The only disadvantage I saw was that all the copied files were with cleared "hidden" attributes and all "desktop.ini"-s appeared to be visible everywhere. Personally, this doesn't bother me much, but probably using one of Windows-Rescueing-Live-CDs will copy the files better than a regular Linux distribution.

(b) If you boot but Windows doesn't show you your user to logon => most likely you've assigned a drive letter to the new partition after formatting it (read 4. again). In such a case - run your VM with the original VDI as primary and the new VDI as slave, remove that drive letter and copy the files again (I have no idea where exactly Windows keeps assigned letters).

EDIT:
Sorry, forgot to mention that I made the new partition bootable. In the slax shell:
1. cfdisk /dev/hdb
2. mark the "Bootable", then "Write", then "Quit"
Ingo
Volunteer
Posts: 731
Joined: 22. Aug 2007, 10:13
Location: Germany

Re: How to make a virtual disk bigger/smaller

Post by Ingo »

spirospirov wrote:Today I realized I need to make my VDI smaller.
There is an easier way to only make it smaler:
http://forums.virtualbox.org/viewtopic.php?t=2507
bwh1969
Posts: 26
Joined: 12. Jan 2008, 07:50

Post by bwh1969 »

gushy wrote:JusTiCe8 is right, I've just done this by creating a bigger disk and then copying the contents.
  • Create a new disk using Virtual Disk Manager (in VirtualBox goto File -> Virtual Disk Manager)
  • download System Rescue CD
  • set your current VM to have the new disk image as it's second hard disk and the System Rescue CD iso file as it's CD
  • boot the vm from the CD
  • at the command prompt type startx
  • when X Windows starts, type gparted in the terminal that is open on screen
  • in gparted select the windows partition and choose copy
  • select the second hard disk
  • right click on the representation of the disk and click paste
  • gparted will prompt you for the size of the disk, drag the slider to the max size
  • click apply
  • wait .......
  • when it's done right click on the disk and choose Manage Flags, and select Boot
  • exit gparted and power off the VM
  • change the VM settings to only have one disk (the new bigger disk) and deselect the iso as the CD.
  • boot the VM into your windows install on it's new bigger disk!
I don't think I've missed any steps out....
Might be easier to use gparted-live cd. It is a bit more automated with "booting." Nice job though!
Post Reply