Author Topic: [Solved] Error - trying to use virtual box - booting from an existing partition.  (Read 6309 times)

Offline Socratea

  • Full Member
  • ***
  • Posts: 156
  • Noob is as noob does
Hi Experts,

I'm trying to boot an existing partition with windows XP installed on it.

I tried to do this:

sudo VBoxManage internalcommands createrawvmdk -filename /home/usrnm/Documents/WindowsXP2.vmdk -rawdisk /dev/sda8 -register

But I get this error when I select this file through 'use existing hard diskĀ“   :

Failed to open the hard disk /home/usrnm/Documents/WindowsXP1.vmdk.
Could not open the medium '/home/usrnm/Documents/WindowsXP1.vmdk'.
VD: error VERR_ACCESS_DENIED opening image file '/home/usrnm/Documents/WindowsXP1.vmdk' (VERR_ACCESS_DENIED).

What am I doing wrong or is there an easier way to reach my goal?

Thanks for considering my question,
« Last Edit: October 22, 2010, 10:25:25 AM by Writhen »

Only those that choose a different path from
the others become great and infinite.

.

Offline 7272andy

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1627
  • UK MLU
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #1 on: October 21, 2010, 05:46:00 AM »
it looks like you've mixed the commands for whole disk and partition access i think the command string should have been

VBoxManage internalcommands createrawvmdk -filename /home/usrnm/Documents/WindowsXP2.vmdk -rawdisk /dev/sda -partitions 8 -register

why sudo as opposed to su ing to root? or have you set it up on your system?


Bare Metal 1         Bare Metal 2
Intel Celeron 420M   Intel i5 540M
2GB Ram              4GB Ram
Intel 943GM          Radeon HD 5650 PCI Express
RT2573               RT2790
32bit KDE            32&64bit KDE

Offline parnote

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 4438
  • The truth is out there ... PCLinuxOS!
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #2 on: October 21, 2010, 05:49:18 AM »
Writhen,

PCLinuxOS does NOT use sudo.

parnote
PCLinuxOS Magazine Chief Editor

Linux Registered User #485009

In a world without walls, who needs Windows?

PCLinuxOS Wiki: Contribute tips/tricks/how-to's!

Offline Socratea

  • Full Member
  • ***
  • Posts: 156
  • Noob is as noob does
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #3 on: October 21, 2010, 05:56:56 AM »
it looks like you've mixed the commands for whole disk and partition access i think the command string should have been

VBoxManage internalcommands createrawvmdk -filename /home/usrnm/Documents/WindowsXP2.vmdk -rawdisk /dev/sda -partitions 8 -register



I oke that seems to make more sense indeed but it still gives the same error.

why sudo as opposed to su ing to root? or have you set it up on your system?

You mean if I have set up my sudoers list?

Thanks for your help!

However once I figured out I should use the search term 'booting from a raw partition'. I found this promising guide.

http://mesbalivernes.blogspot.com/2008/01/virtual-box-booting-from-existing.html

But I cant figure out (yet) how to get the create a Master Boot Record manager in a file.

Do you know if this will work? If it worth the effort anyway?
 

Only those that choose a different path from
the others become great and infinite.

.

Offline Socratea

  • Full Member
  • ***
  • Posts: 156
  • Noob is as noob does
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #4 on: October 21, 2010, 05:58:39 AM »
Writhen,

PCLinuxOS does NOT use sudo.

parnote

But I have been using either su or sudo interchangeably after I set up my sudoers list.
Should I not have? Better to just su to root?

Only those that choose a different path from
the others become great and infinite.

.

Offline 7272andy

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1627
  • UK MLU
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #5 on: October 21, 2010, 06:05:38 AM »
the choice (as ever) is yours, there are perceived security issues with sudo but that's for others to argue over.

I'll get back re the mbr shortly (just going to set one up myself)


Bare Metal 1         Bare Metal 2
Intel Celeron 420M   Intel i5 540M
2GB Ram              4GB Ram
Intel 943GM          Radeon HD 5650 PCI Express
RT2573               RT2790
32bit KDE            32&64bit KDE

Offline Socratea

  • Full Member
  • ***
  • Posts: 156
  • Noob is as noob does
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #6 on: October 21, 2010, 06:08:16 AM »
the choice (as ever) is yours, there are perceived security issues with sudo but that's for others to argue over.

I'll get back re the mbr shortly (just going to set one up myself)

Oke, I see. Thanks a million!

Only those that choose a different path from
the others become great and infinite.

.

Offline 14four

  • Jr. Member
  • **
  • Posts: 20
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #7 on: October 21, 2010, 06:15:55 AM »

But I get this error when I select this file through 'use existing hard diskĀ“   :

Failed to open the hard disk /home/usrnm/Documents/WindowsXP1.vmdk.
Could not open the medium '/home/usrnm/Documents/WindowsXP1.vmdk'.
VD: error VERR_ACCESS_DENIED opening image file '/home/usrnm/Documents/WindowsXP1.vmdk' (VERR_ACCESS_DENIED).

What am I doing wrong or is there an easier way to reach my goal?

Thanks for considering my question,


Just a thought . . . I got a very similar message to this when trying to launch an existing vm following the latest update to VB 3.2.10. After a reboot all was working correctly again.
Dell Inspiron 1300 laptop
Processor: Intel Celeron M 1.5GHz; 2GB memory; Intel Mobile 915GM/910GML Express Graphics Controller running 15in widescreen LCD; ICH6 Sound; Wireless: BCM4318 (Airforce One 54g); Ethernet: BCM4401-B0 10Base-TX

Offline Socratea

  • Full Member
  • ***
  • Posts: 156
  • Noob is as noob does
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #8 on: October 21, 2010, 06:23:46 AM »

Oke, I try a reboot... but I'm still worried about the mbr.

I'll get back re the mbr shortly (just going to set one up myself)

The mbr is crucial as I dont want VB to launch the host OS (PCLINUXOS) while I'm running in PCLINUX.

Or doesnt it matter that much because VB will also boot my grub loader?

Or doesnt it matter because here I've only selected the windows partition?


Only those that choose a different path from
the others become great and infinite.

.

Offline Socratea

  • Full Member
  • ***
  • Posts: 156
  • Noob is as noob does
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #9 on: October 21, 2010, 06:57:45 AM »

Oke, I try a reboot...

Reboot changed nothing for me sadly.

Only those that choose a different path from
the others become great and infinite.

.

Offline 7272andy

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1627
  • UK MLU
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #10 on: October 21, 2010, 08:33:20 AM »
Getting there, I'm passed your initial errors and just have a grub error to sort out, as soon as I have a good fix I'll post back the steps I've taken


Bare Metal 1         Bare Metal 2
Intel Celeron 420M   Intel i5 540M
2GB Ram              4GB Ram
Intel 943GM          Radeon HD 5650 PCI Express
RT2573               RT2790
32bit KDE            32&64bit KDE

Offline Socratea

  • Full Member
  • ***
  • Posts: 156
  • Noob is as noob does
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #11 on: October 21, 2010, 08:39:17 AM »
Getting there, I'm passed your initial errors and just have a grub error to sort out, as soon as I have a good fix I'll post back the steps I've taken

 ;D wow, thats great! I hope you get a fix but even if you don't thanks a million for the effort.
« Last Edit: October 21, 2010, 09:16:22 AM by Writhen »

Only those that choose a different path from
the others become great and infinite.

.

Offline 7272andy

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1627
  • UK MLU
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #12 on: October 21, 2010, 09:22:15 AM »
OK, make a good backup of your system (I'd hate to trash it for you)

First you need to put your user in the group 'disk', if you don't do this the vmdk you create will only be useable by root.
As root enter
     usermod -a -G disk <your user name>
log out and then back in
as your normal user you now have some options

Assuming your grub is written to to /dev/sda1 create your new vmdk using
     VBoxManage internalcommands createrawvmdk -filename /mnt/data/VBOX/HardDisks/WindowsXP.vmdk -rawdisk /dev/sda -partitions 1,8 -relative -register

your new machine will use the current grub menu for your system and you will have to select your Windows installation from the list. be very careful with this as the chances of corrupting your system by selecting PCLinuxOS by mistake are pretty high


You could also use
     VBoxManage internalcommands createrawvmdk -filename /mnt/data/VBOX/HardDisks/WindowsXP.vmdk -rawdisk /dev/sda -partitions 8 -relative -register

When you boot this machine it will fail with a grub error, you should be able to fix this using your windows CD (or an image of it) and booting this first. Press the "R" key during the setup in order to start the Recovery Console. Select your Windows XP installation from the list and enter the administrator password. At the input prompt, enter the command "FIXMBR" and confirm the query with "y". The MBR will be rewritten and GRUB will be uninstalled. Press "exit" to reboot the computer. This should only have an effect on the virtual machine (you did back up didn't you :D)

The final option is to create a file containing the mbr of another system (e.g. winxp.mbr) and reference this when you create the disk
     VBoxManage internalcommands createrawvmdk -filename /mnt/data/VBOX/HardDisks/WindowsXP.vmdk -rawdisk /dev/sda -partitions 8 -relative -mbr winxp.mbr -register

Again, this should only affect your virtual machine.


Good luck and be careful.

Regards
Andy


Bare Metal 1         Bare Metal 2
Intel Celeron 420M   Intel i5 540M
2GB Ram              4GB Ram
Intel 943GM          Radeon HD 5650 PCI Express
RT2573               RT2790
32bit KDE            32&64bit KDE

Offline Socratea

  • Full Member
  • ***
  • Posts: 156
  • Noob is as noob does
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #13 on: October 21, 2010, 09:36:27 AM »
OK, make a good backup of your system (I'd hate to trash it for you)

Regards
Andy


Thanks so much for this! Oke, I'm first going to make a backup, then try and then come back here hopefully to change this to solved.

Do you know (or anybody else) of any good (relatively easy - as I am a noob -  and robust) way to make a backup via USB?

Again there are so many choices on how to backup your Linux system, its great :-)... but take some reading! A great resource is this: http://www.pclinuxos.com/forum/index.php?topic=46540.0

Problem is my dvd-burner is out on loan to a friend. :-) 

« Last Edit: October 21, 2010, 10:23:17 AM by Writhen »

Only those that choose a different path from
the others become great and infinite.

.

Offline 7272andy

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1627
  • UK MLU
Re: Error - trying to use virtual box - booting from an existing partition.
« Reply #14 on: October 22, 2010, 05:05:51 AM »
OK this gave me a slight pause for thought, but I suggest

Download the latest Parted Magic live CD

as you don't currently have a burner boot the disk image using Virtual Box and then create a bootable usb of Parted Magic using UNetbootin

Shut everything down and reboot your machine with the live USB

use Ghost 4 Linux or Clonezilla to backup your system and write the files to an external USB device.

Regards
Andy


Bare Metal 1         Bare Metal 2
Intel Celeron 420M   Intel i5 540M
2GB Ram              4GB Ram
Intel 943GM          Radeon HD 5650 PCI Express
RT2573               RT2790
32bit KDE            32&64bit KDE