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

Thread: Can I turn a virtualbox machine into a real partition?

  1. #1
    Join Date
    Apr 2008
    Beans
    108

    Can I turn a virtualbox machine into a real partition?

    I have a WindowsXP virtualbox machine on my Linux Mint box. I have recently decided to mod my Xbox360, which requires mounting the Xbox360's drive to the computer. Xplorer360 crashes,so I need to either make the virtual machine a real partition that is separately bootable, or find a replacement for Xplorer360 that is linux-friendly. The former seems much more likely. Can anyone help me?
    Ich fliege auf Gürteltieren in meiner Freizeit. Was machts du denn?

  2. #2
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: Can I turn a virtualbox machine into a real partition?

    I think probably the easiest way to transfer your VirtualBox OS to a partition would be to mount it, and then copy its entire file system to its new partition with "cp -ax" to preserve all the proper permissions/ownerships of all files. Most VirtualBox VDI files have just 3 sectors of VirtualBox header info at the beginning, and then the rest is the HDD image. So to mount a VDI file, you can usually do:
    Code:
    sudo losetup -f --show -o $((512*3)) ~/.VirtualBox/HardDisks/HDD_image.vdi
    That will also return the loop device that the VDI file gets associated with, for example "/dev/loop0". And then to see the partitions in that image:
    Code:
    sudo fdisk -lu /dev/loop0
    Using the above command, find the sector offset of the partition you want to mount, say for example the starting sector is 63, then do:
    Code:
    sudo mount -o loop,offset=$((512*63)) /dev/loop0 /mnt
    And that will mount your VirtualBox OS partition on /mnt. After that, it's just a matter of copying the file system to its new partition:
    Code:
    sudo cp -ax /mnt/* /path_to_mounted_destination_partition/
    And lastly, if you do:
    Code:
    sudo blkid -c /dev/null
    It will show you the UUID of your mounted VirtualBox partition, and you can transfer that UUID to the new partition with:
    Code:
    sudo tune2fs -U <VirtualBox partition UUID> /dev/<new partition>
    You will probably have to modify /boot/grub/menu.lst and possibly /etc/fstab for the OS on the new partition, but that should be about all it takes. Let me know if you decide to give this method a try and how it goes.

  3. #3
    Join Date
    Apr 2008
    Beans
    108

    Re: Can I turn a virtualbox machine into a real partition?

    Thanks much, I will try this soon
    Ich fliege auf Gürteltieren in meiner Freizeit. Was machts du denn?

  4. #4
    Join Date
    Apr 2008
    Beans
    108

    Re: Can I turn a virtualbox machine into a real partition?

    On this command...

    Code:
    sudo fdisk -lu /dev/loop0
    
    Disk /dev/loop0: 32.2 GB, 32212376576 bytes
    255 heads, 63 sectors/track, 3916 cylinders, total 62914798 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Disk identifier: 0x0000016e
    
    Disk /dev/loop0 doesn't contain a valid partition table
    I'm not sure what the starting sector is... is it 63?
    Ich fliege auf Gürteltieren in meiner Freizeit. Was machts du denn?

  5. #5
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: Can I turn a virtualbox machine into a real partition?

    So did you mount your VDI file with the first losetup command that uses the 3 sector offset? If so, maybe the HDD image in the .vdi file starts at a different sector. How about posting the output of:
    Code:
    hexdump -C -n10000 HDD_image.vdi | grep -A1 "55 aa"
    But replace HDD_image.vdi with your own .vdi image file.

  6. #6
    Join Date
    Apr 2008
    Beans
    108

    Re: Can I turn a virtualbox machine into a real partition?

    there was no output that I could see... nothing happened
    Ich fliege auf Gürteltieren in meiner Freizeit. Was machts du denn?

  7. #7
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: Can I turn a virtualbox machine into a real partition?

    You have to either give the path to your .vdi file, or you have to navigate to that directory using "cd" in the terminal. In other words, if your .vdi file is in your .VirtualBox directory, you might do something like:
    Code:
    hexdump -C -n10000 ~/.VirtualBox/HardDisks/HDD_image.vdi | grep -A1 "55 aa"
    If you have problems, copy/paste exactly what you have in the terminal to your next post so I can see what you are doing.

  8. #8
    Join Date
    Apr 2008
    Beans
    108

    Re: Can I turn a virtualbox machine into a real partition?

    I listed the entire directory the first time, but nothing happened... so I tried again by cd-ing first, which produced the same results.

    Code:
     hexdump -C -n10000 ~/.VirtualBox/VDI/WinXP.vdi | grep -A1 "55 aa"
    Last edited by mtgmutton; February 17th, 2009 at 10:39 PM.
    Ich fliege auf Gürteltieren in meiner Freizeit. Was machts du denn?

  9. #9
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: Can I turn a virtualbox machine into a real partition?

    OK, how about posting:
    Code:
    ls -l /home/evan/.VirtualBox/VDI
    hexdump -C -n10000 /home/evan/.VirtualBox/VDI/WinXP.vdi

  10. #10
    Join Date
    Apr 2008
    Beans
    108

    Re: Can I turn a virtualbox machine into a real partition?

    ok for

    Code:
    ls -l /home/evan/.VirtualBox/VDI
    i got this:
    Code:
    total 31488164
    -rw------- 1 evan evan 32212378112 2009-02-16 18:33 WinXP.vdi
    and for

    Code:
    hexdump -C -n10000 /home/evan/.VirtualBox/VDI/WinXP.vdi
    i get.... it's really long... it takes up WAY more than one terminal window. is it possible to get the terminal to put command output into a txt file?
    Ich fliege auf Gürteltieren in meiner Freizeit. Was machts du denn?

Page 1 of 3 123 LastLast

Tags for this Thread

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
  •