Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
virtualbox raw disk access, your recommendation?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
swingkyd
Guru
Guru


Joined: 13 Jan 2005
Posts: 334

PostPosted: Fri Aug 31, 2007 5:22 pm    Post subject: virtualbox raw disk access, your recommendation? Reply with quote

I am wondering if anyone is using Virtualbox-bin to access a partition of windows on their system.
I would like to be able to use my windows XP partition as a VM in my gentoo box without reinstalling windows. Is this possible?
For example, my system looks like this:
Code:
 # fdisk -l /dev/hda

Disk /dev/hda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        2175    17470656    7  HPFS/NTFS
/dev/hda2            2176        2179       32130   83  Linux
/dev/hda3            2180        3454    10241437+  83  Linux
/dev/hda4            3455        7296    30860865    f  W95 Ext'd (LBA)
/dev/hda5            3455        5111    13309821    b  W95 FAT32
/dev/hda6            5112        7226    16988706   83  Linux
/dev/hda7            7227        7296      562243+  82  Linux swap / Solaris

I read in the virtualbox documentation that it is possible to have raw access to a partition on a hard drive. However, this comes with a pretty nasty warning: from Section 9.9.2

Quote:
Warning: Raw hard disk access is for expert users only. Incorrect use or use of an outdated configuration can lead to total loss of data on the physical disk. Most importantly, do not attempt to boot the partition with the currently running host operating system in a guest. This will lead to severe data corruption.

But can I do what I want... I have a fully licenced version of XP, but I lost my "activation code" as it was purchased when I was a student quite a few years ago...
any recommendations or suggestions as to how I can proceed?

[edit] changed title to ask for your recommendation
Back to top
View user's profile Send private message
mikitex
n00b
n00b


Joined: 28 Oct 2005
Posts: 8
Location: Pordenone, Italy

PostPosted: Fri Aug 31, 2007 6:41 pm    Post subject: Reply with quote

I don't have tested on Gentoo (I have to install VirtualBox first, I'm working on this..) but at work I have VirtualBox installed on Windows XP that runs a Gentoo machine with 2 raw disks: the first is shared with Windows XP, the second is used only by Linux.
The only real warning is that a partition must be accessed (used) exclusively by one machine (host or guest). If a partition must be accessed by two or more machines, it must be mounted by one machine and exported via network to the others boxes.
Back to top
View user's profile Send private message
swingkyd
Guru
Guru


Joined: 13 Jan 2005
Posts: 334

PostPosted: Fri Aug 31, 2007 6:54 pm    Post subject: Reply with quote

...so with a previously installed windows XP system with NTFS, will this work or will I have to set up nfts-3g to access the disk. Also, won't the previously installed windows xp system get very confused with all the hardware switching to the virtual machine? This would be equivalent to taking the harddrive of the XP system and putting it into a new system... I've tried this with windows 98...the windows was not happy at all. I'm thinking it will force me to re-activate my system. And let's say for some reason I get it working, what will happen if I actually boot into the windows XP system after setting this up?
I appreciate your thoughts!
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Fri Aug 31, 2007 6:59 pm    Post subject: Reply with quote

I'm using WinXP on a raw partition from VirtualBox, it works great. But if you've lost the activation code, you're screwed. You see, VirtualBox is seen by Windows as a new machine, so you'll be asked for activation. Your only chance are alternative methods *ahem*.
Back to top
View user's profile Send private message
swingkyd
Guru
Guru


Joined: 13 Jan 2005
Posts: 334

PostPosted: Fri Aug 31, 2007 7:04 pm    Post subject: Reply with quote

Gusar wrote:
I'm using WinXP on a raw partition from VirtualBox, it works great. But if you've lost the activation code, you're screwed. You see, VirtualBox is seen by Windows as a new machine, so you'll be asked for activation. Your only chance are alternative methods *ahem*.


thanks for your comment. My big concern is whether your XP was a previously installed version on an NTFS drive? HOw did this work for you?
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Fri Aug 31, 2007 9:25 pm    Post subject: Reply with quote

swingkyd wrote:
thanks for your comment. My big concern is whether your XP was a previously installed version on an NTFS drive? HOw did this work for you?
Yes, it's a previously installed version on NTFS.

First boot into Windows. There, run the MergeIDE utility as explained here. Then, create a new hardware profile (right-click on My Computer -> Properties -> Hardware tab -> Hardware profile), name the profiles Native and Virtualbox. Now boot into linux. Follow the VirtualBox User Manual to create a virtual machine with raw disk access and start it. When asked, select the VirtualBox profile. After logging in you'll be asked to activate. When Windows is activated and finishes loading, install VirtualBox Additions. You're done.

Now you can either boot into Windows natively or start it from VirtualBox, just select the appropriate hardware profile. If you boot natively, ignore the activation request, Windows will still work.
Back to top
View user's profile Send private message
swingkyd
Guru
Guru


Joined: 13 Jan 2005
Posts: 334

PostPosted: Sat Sep 01, 2007 1:51 am    Post subject: Reply with quote

brilliant! thanks! I will try this and get back to everyone the status of my success or failure.
Back to top
View user's profile Send private message
swingkyd
Guru
Guru


Joined: 13 Jan 2005
Posts: 334

PostPosted: Sat Sep 01, 2007 1:58 am    Post subject: Reply with quote

..so the consensus is I will not need ntfs-3g to write to my ntfs drive. the VM figures that stuff out?

Thanks.
Back to top
View user's profile Send private message
swingkyd
Guru
Guru


Joined: 13 Jan 2005
Posts: 334

PostPosted: Sat Sep 01, 2007 3:31 am    Post subject: Reply with quote

well, after following the directions to add a partition, the following command worked for me :
Code:
vboxmanage internalcommands createrawvmdk -filename /home/carl/vm/winxp.vmdk -rawdisk /dev/hda -partitions 1 -relative

However, in light of my partitioning scheme where NTFS is living on Partition 1 of /dev/hda, I cannot seem to figure out how to get the created vmdk file to load up.
The files created are:

Code:
 vm # ll
total 132
-rw-rw---- 1 root disk 129024 Aug 31 21:26 winxp-pt.vmdk
-rw-rw---- 1 root disk    682 Aug 31 21:26 winxp.vmdk

Now the partition file winxp-pt.vmdk will not load in the virtual disk manager. I receive this error:

Code:
Could not access hard disk image '/home/carl/vm/winxp-pt.vmdk' (VERR_VDI_INVALID_SIGNATURE).
Result Code:
0x80004005
Component:
HardDisk
Interface:
IHardDisk {fd443ec1-000f-4f5b-9282-d72760a66916}
Callee:
IVirtualBox {d1a2295c-d257-4a4c-a9a6-843d87db6f45}

well, unfortunately I do not know what is going on or why.
Any help???
Code:
brw-rw---- 1 root disk 3, 1 Aug 31 13:05 /dev/hda1


Thanks...


Last edited by swingkyd on Sat Sep 01, 2007 4:17 am; edited 2 times in total
Back to top
View user's profile Send private message
swingkyd
Guru
Guru


Joined: 13 Jan 2005
Posts: 334

PostPosted: Sat Sep 01, 2007 3:33 am    Post subject: Reply with quote

I can load up this file:
Code:
winxp.vmdk

But this is my entire 60GB partition..I didn't want to write to that...it would erase all my data I figured.
Back to top
View user's profile Send private message
swingkyd
Guru
Guru


Joined: 13 Jan 2005
Posts: 334

PostPosted: Sat Sep 01, 2007 5:24 am    Post subject: Reply with quote

OKay, here is some more detail. I tried running the following and got the error messages. I really feel like I'm over my head here *sigh*

Code:
 $ vboxmanage internalcommands createrawvmdk -filename /home/carl/vm/winxp.vmdk -rawdisk /dev/hda -partitions 1 -relative -register
VirtualBox Command Line Management Interface Version 1.4.0
(C) 2005-2007 innotek GmbH
All rights reserved.

RAW host disk access VMDK file /home/carl/vm/winxp.vmdk created successfully.
[!] FAILED calling aVirtualBox->OpenHardDisk(filename, hardDisk.asOutParam()) at line 640!
[!] Primary RC  = 0x80004005
[!] Full error info present: true , basic error info present: true
[!] Result Code = 0x80004005
[!] Text        = Could not access hard disk image '/home/carl/vm/winxp.vmdk' (VERR_VDI_INVALID_SIGNATURE)
[!] Component   = HardDisk, Interface: IHardDisk, {fd443ec1-000f-4f5b-9282-d72760a66916}
[!] Callee      = IVirtualBox, {d1a2295c-d257-4a4c-a9a6-843d87db6f45}
[1]-  Done                    virtualbox  (wd: ~)
(wd now: ~/vm)
[2]+  Done                    virtualbox
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Sat Sep 01, 2007 8:42 am    Post subject: Reply with quote

Unless you create a separate MBR for VirtualBox, you will need to give the VM access to the entire disk I think. Or at least to the partition where grub resides in addition to the windows partition. Then you need write access to anything VirtualBox needs, so add yourself to the 'disk' group.

To create a separate MBR, you will need a windows cd, preferably one with a recovery console.

And no, you don't need ntfs-3g for VirtualBox.
Back to top
View user's profile Send private message
swingkyd
Guru
Guru


Joined: 13 Jan 2005
Posts: 334

PostPosted: Thu Sep 20, 2007 4:07 pm    Post subject: Reply with quote

Gusar,
Thanks for your help before. for some reason it works now...I have no idea what but I suspect it's because I logged off and on again. I'm back from vacation and that's why I've not responded in a while.
now all I have to figure out is how to get the fat32 E drive in my windows will play nice with my windows /dev/hda5 drive which I use as a share between the two.

Cheers,
Carl
Back to top
View user's profile Send private message
swingkyd
Guru
Guru


Joined: 13 Jan 2005
Posts: 334

PostPosted: Wed Sep 26, 2007 4:27 pm    Post subject: Reply with quote

Gusar,
Unfortunately, I do have to re-activate on my "native" hardware profile. I tried leaving it as you suggested, but I could not access the OS after 3 days. Is this what you observed as well?

Thanks!
Back to top
View user's profile Send private message
Gusar
Advocate
Advocate


Joined: 09 Apr 2005
Posts: 2665
Location: Slovenia

PostPosted: Wed Sep 26, 2007 5:03 pm    Post subject: Reply with quote

swingkyd wrote:
Gusar,
Unfortunately, I do have to re-activate on my "native" hardware profile. I tried leaving it as you suggested, but I could not access the OS after 3 days. Is this what you observed as well?
Yes. Just boot from within Virtualbox and you'll be able to reactivate without giving the code. Now you have again 3 days in native. And after those 3 days, activate from Virtualbox again. It sucks, but it's workable. If you haven't reached your activation quota yet, you could also start doing it the other way around, have the main activation in native and do the 3 days thing in Virtualbox.

If it really annoys you, there's always alternative methods. Kinda ironic isn't it, that an anti-piracy measure could actually turn one into a pirate because of the annoyance factor.
Back to top
View user's profile Send private message
swingkyd
Guru
Guru


Joined: 13 Jan 2005
Posts: 334

PostPosted: Wed Sep 26, 2007 5:27 pm    Post subject: Reply with quote

Gusar wrote:
Yes. Just boot from within Virtualbox and you'll be able to reactivate without giving the code. Now you have again 3 days in native. And after those 3 days, activate from Virtualbox again. It sucks, but it's workable. If you haven't reached your activation quota yet, you could also start doing it the other way around, have the main activation in native and do the 3 days thing in Virtualbox.

But we are not pirating. that's the problem... we don't even have the freedom to use our own OS with virualization?
How many "activations" are we allowed. I thought we were only allowed 3 activations.
So just out of curiosity, aren't hardware profiles supposed to take care of this stuff?
It looks like I'm going to have to go back to the "dual-boot" option at this point. *sigh* Does MS have any way of addressing this so that we are not asked to reactivate all the time?
thanks again for your help though. I did get it working... an accomplishment in itself for me ;)
Back to top
View user's profile Send private message
IBJamon
n00b
n00b


Joined: 26 May 2007
Posts: 9

PostPosted: Thu Oct 25, 2007 1:27 am    Post subject: Reply with quote

I saw this thread, and since I was hoping to do the same thing.. can you try something?

1) Backup the C:\Windows\System32\wpa.dbl file from a working dual-boot hardware profile;
2) Boot up the virtual machine and activate; then backup the working virtual machine wpa.dbl file to another place;

Then when you want to boot back into the hardware Windows, could you:

1) Shut down the VM
2) Restore/replace the wpa.dbl with the working hardware file
3) Boot into it..

And vice-versa for the VM version? I am curious if this will work; I was hoping someone could test it.. Thanks for trying! :)

IBJamon

P.S. If one is paranoid, I suppose you could ghost before trying this..
Back to top
View user's profile Send private message
IBJamon
n00b
n00b


Joined: 26 May 2007
Posts: 9

PostPosted: Fri Oct 26, 2007 12:33 am    Post subject: Reply with quote

I may try it this weekend.. we'll see. I'll update when I can. It may be somewhat complicated by the fact that my current windows version is a Dell OEM version, which does BIOS checks undoubtedly..

IBJamon
Back to top
View user's profile Send private message
dj_farid
l33t
l33t


Joined: 14 Jun 2004
Posts: 613

PostPosted: Tue Mar 18, 2008 8:26 am    Post subject: Reply with quote

How did all this turn out to work? Any tips & trix?
I am in the process of doing the same thing.

I found this guide: http://mesbalivernes.blogspot.com/2008/01/virtual-box-booting-from-existing.html
Back to top
View user's profile Send private message
Jamon
Apprentice
Apprentice


Joined: 03 May 2002
Posts: 173

PostPosted: Tue Mar 18, 2008 11:17 am    Post subject: Reply with quote

My windows install ended up crashing, so I took a different route and made VMs for just the work I was doing. Worked out better that way. I'm sorry I forgot to update.

Jamon/IBJamon (I forgot my old profile was here.. I wish I could combine them - Jamon was from 2002 ;) though I prefer the name on the new one ;) oh well)
_________________
Looking for a Linux PC? Check us out at
http://www.progresssystemsinc.com!
Back to top
View user's profile Send private message
drescherjm
Advocate
Advocate


Joined: 05 Jun 2004
Posts: 2790
Location: Pittsburgh, PA, USA

PostPosted: Tue Mar 18, 2008 1:58 pm    Post subject: Reply with quote

Did you get a BSOD on boot?

That is what I got when I tried that on my laptop.
_________________
John

My gentoo overlay
Instructons for overlay
Back to top
View user's profile Send private message
dj_farid
l33t
l33t


Joined: 14 Jun 2004
Posts: 613

PostPosted: Wed Mar 19, 2008 9:53 pm    Post subject: Reply with quote

I get a black screen with a few ascii characters on random spots of the screen when it tries to boot XP. This is when it should display the Windows logo. There it just stops.

At first I thought that it is because I have the wrong HAL installed in Windows. So I reinstalled windows on top of the old install (Repair existing installation) in the Virtual world. The non graphical part of the installation goes fine, but after the reboot to the graphical part the same thing happens.

After that I just gave up for this Easter. Any ideas until I will start with it again next week?
Back to top
View user's profile Send private message
drescherjm
Advocate
Advocate


Joined: 05 Jun 2004
Posts: 2790
Location: Pittsburgh, PA, USA

PostPosted: Wed Mar 19, 2008 11:26 pm    Post subject: Reply with quote

Sounds familiar to me. I really wanted that to work since this is the only free box I have that has the cpu virtulization instructions. I would have done a clean install of XP without the raw disk access (leaving my bootable XP alone) but since the machine is a laptop with a 60GB hard drive it really does not have enough space for that.
_________________
John

My gentoo overlay
Instructons for overlay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum