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

Thread: Trouble running VirtualBox with "real" partition

  1. #1
    Join Date
    Jan 2006
    Location
    Vancouver, Canada
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Trouble running VirtualBox with "real" partition

    My laptop is set up with Windows Vista on one smallish partition, and Ubuntu on the rest of the (single) hard drive. While I do use Windows mostly for just running Windows-based games easily, there are a few tools on it that I still like to use. I decided to look at virtualization again, since that allows me to use those tools without straying too far away from Linux's comforting presence.

    First, the good news: I have it working!

    I set up a virtual disk that points to the real hard drive as follows:

    VBoxManage internalcommands createrawvmdk -filename /home/dmccall/Documents/VirtualBox/WindowsVista_PhysicalPartition/sda.vdmk -rawdisk /dev/sda -register

    The problem here is that this makes the entire hard drive be accessed by the virtual machine! Clearly, I now run the risk of the universe imploding and it being my fault.
    Indeed, I have 3 critical seconds every time I boot that virtual machine in which to press Escape to open the GRUB menu, scroll down and choose Windows, or else Ubuntu will meet its duplicate self, creating a giant rift in time ultimately destroying us all!
    Obviously, being a kind and forgiving person, I do not want this to happen, so I hope to repair this doomsday machine before it is too late.

    That actual working solution was actually the last thing I tried, but I am sure many people here understand this stuff way better than I do. Initially, I had hoped to use the "-partition 1" argument to restrict access to just that one partition Windows lives on. This led to Error 17 in GRUB (and I do not want to kill GRUB). Changed the MBR using "dd" (note: I have no idea how this command works. Just copied "dd if=/dev/sda1 of=windowsvista.mbr bs=512 count=1" from a forum post and it seemed to do, err, something).
    Changing the MBR got me to Windows, but it gave an error immediately that \Windows\System32\winload.exe was corrupted or missing, thus could not boot. This is not the case. I had unmounted /media/sda1, so it was not because the partition was already in use, unless Ubuntu mounts it elsewhere, too.

    I get the following output from VBoxManage internalcommands listpartitions -rawdisk /dev/sda
    Code:
    VirtualBox Command Line Management Interface Version 1.5.4
    (C) 2005-2007 innotek GmbH
    All rights reserved.
    
    Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
    1       0x07  0   /32 /33  1023/254/63         76368         2048
    2       0x83  1023/254/63  1023/254/63         14300    156408840
    5       0x83  1023/254/63  1023/254/63         61318    185695398
    6       0x82  1023/254/63  1023/254/63           635    311275503
    As you can see, Windows resides on number 1, the others are all Linuxy partitions.

    Any help in getting this working with virtualized Windows restricted to just its partition would be much appreciated. Remember: It is for the good of us all. Otherwise, we're all doomed!
    Last edited by Mr. Picklesworth; January 11th, 2008 at 07:37 PM.

  2. #2
    Join Date
    Dec 2007
    Location
    Virginia USA
    Beans
    72
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Trouble running VirtualBox with "real" partition

    I don't know about limiting it to the partition added. I changed the boot menu:

    System->Administration->Start-Up Manager

    Uncheck "use timeout in bootloader menu"

    You can also make the default OS Windows if you are concerned that you'll have a moment of insanity even though you now have longer than three seconds to Armageddon.

    FYI, I just deleted the VMWare and VirtualBox rawdisk experiments on my computer. I use VirtualBox with a .vdi only now. It's much faster. The rawdisk versions took an eternity to load and brought the whole machine to screeching halt.

  3. #3
    Join Date
    Jul 2007
    Beans
    Hidden!
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Trouble running VirtualBox with "real" partition

    Quote Originally Posted by Mr. Picklesworth View Post
    VBoxManage internalcommands createrawvmdk -filename /home/dmccall/Documents/VirtualBox/WindowsVista_PhysicalPartition/sda.vdmk -rawdisk /dev/sda -register
    Is there any particular reason why you can't use /dev/sda1 in that statement?
    ch
    In Switzerland we make it other
    with apologies to Gerard Hoffnung


  4. #4
    Join Date
    Jan 2006
    Location
    Vancouver, Canada
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Trouble running VirtualBox with "real" partition

    Yup; it scares Windows if it suddenly wakes up in what looks like a completely different hard drive. If I don't want to confuse it, I have to use /dev/sda and the -partitions 1 argument. The -partitions argument says "Permit access to the listed partitions", and provides a whole lot of 0s for the other partitions. Thus, Windows still sees them but does nothing to them.

    By the way, thanks for moving this thread!

  5. #5
    Join Date
    Jan 2005
    Beans
    199

    Re: Trouble running VirtualBox with "real" partition

    Quote Originally Posted by Mr. Picklesworth View Post
    Yup; it scares Windows if it suddenly wakes up in what looks like a completely different hard drive. If I don't want to confuse it, I have to use /dev/sda and the -partitions 1 argument. The -partitions argument says "Permit access to the listed partitions", and provides a whole lot of 0s for the other partitions. Thus, Windows still sees them but does nothing to them.

    By the way, thanks for moving this thread!
    right, this will never work smoothly with windows. That is, being able to boot the same windows partition inside a VM, and directly from the real boot. Windows is just too sensitive to any changes between the real environment with its real devices, and the virtual machine with its virtual devices.

    For a Linux VM, it IS possible to achieve that (I have that working) but even then it's not totally smooth. I created a raw-disk drive in Virtual box, and installed linux there (running in a VM under a Windows host). since linux is installed in its own (raw) disk, I can boot it directly from the BIOS, but there is still a problem with the X-windows video driver. When running as a VM under virtualbox, the graphics card is a virtual device created by the VM, which uses a special driver (installed as part of the guest tools). But when booting the Linux partition directly, it needs a regular driver for the real video card (either generic VESA driver, or NVIDIA driver in my case). So I either have to change the video driver by modifying xorg.conf, or run without X-windows.


    In any case, I don't see much reason to boot Linux directly, since it works almost as fast running as a guest under the VMM. And I have the convenience of having both windows and linux running simultaneously. In fact, my linux VM is running apache web server, python application server (running gallery, trac, phpmyadmin as well as various custom web apps) , mySQL server, SSH server, IMAP server, postfix SMTP server, Samba server, and subversion server. And it's running incredibly stable and fast 24x7.

    And when I need to relax, I can still fire up my favourite windows games like UT3, Bioshock, Crysis, etc.... I also prefer doing web browsing and document edition in windows, And since I'm running X-ming X-server in windows, I can run Linux apps directly on the windows desktop (outside the VM window) using X remote display. Life is good !

  6. #6
    Join Date
    Jan 2006
    Location
    Vancouver, Canada
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Trouble running VirtualBox with "real" partition

    I see what you mean about running Linux in a VM. Haven't done it in a while. I just had the pleasure of running the Mandriva Live CD in VirtualBox, and was very impressed by the changes! Mouse pointer integration is fantastic

    However, I am turning into an open source zealot, so running Ubuntu in a virtual machine aboard Windows would simply not do. Thanks for the suggestion, though!

  7. #7
    Join Date
    Jun 2005
    Location
    south australia
    Beans
    70

    Re: Trouble running VirtualBox with "real" partition

    how did you use this "dd if=/dev/sda1 of=windowsvista.mbr bs=512 count=1" command?
    you got around your grub error 17 problem? im stuck on it about now =o\

  8. #8
    Join Date
    May 2006
    Beans
    57

    Re: Trouble running VirtualBox with "real" partition

    Exactly the same problem here! winloader.exe is not found. Would appreciate any help

  9. #9
    Join Date
    Sep 2005
    Beans
    10

    Re: Trouble running VirtualBox with "real" partition

    I have been wondering for a long time how to use vbox to run a physical (raw) partition! Can you please tell me how to do it? Suppose I have a partition with linux installedl. How do I use vbox in windows host to boot into it? Thanks in advance,
    Ariel

  10. #10
    Join Date
    Mar 2005
    Location
    Greenfield, MA
    Beans
    77
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Trouble running VirtualBox with "real" partition

    Mr. Picklesworth--

    Check this thread on the VirtualBox forums...http://forums.virtualbox.org/viewtopic.php?t=2019:

    install "mbr" package in your Linux host and run "install-mbr --force opensource.mbr". This will create a file called opensource.mbr in your home directory
    then,
    Code:
    VBoxManage internalcommands createrawvmdk -filename [PATH_TO_XP_VMDK FILE] -rawdisk /dev/sda -partitions [XP_PARTITION] -mbr [PATH_TO_FAKE_MBR_FILE] -relative
    That will bypass your actual MBR and go straight to Windows, bypassing the grub menu and thereby avoiding the risk of virtualizing your running host partition, cats and dogs sleeping together, mass hysteria, etc.

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
  •