Results 1 to 6 of 6
I have my computer dual booting fedora 17 and windows 7. I program while in fedora, but I did not find out about virtualbox until recently so instead of having ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-27-2013 #1
- Join Date
- Apr 2013
[How] Can you make a vbox image of existing Fedora partition
I was wondering if there is a way to make a virtualbox image of the existing fedora partition that I have been using so that I do not need to set everything up again.
If anyone has any idea how to do this and safely that'd be awesome! Thanks
Last edited by who_stow; 04-27-2013 at 05:17 AM.
- 04-27-2013 #2
First, you're going to want to backup any important data you have on your Fedora installation.
You'll need an external USB hard drive. You'll need some kind of live cd. While it is possible to image a PC while running the host operating system, it's generally considered good practice to to use an install media for the task.
Boot into your live CD, and open a terminal prompt. Format your external drive as ntfs with gparted or another partition program. Make sure you have enough space on the external drive to accommodate the amount of space used on your Fedora partition. You can see a list of all block devices that are currently on the system by running the command 'lsblk'. Make sure you know the correct device name of your external drive, but for this let's call it /dev/sdb. Once you format your external drive you should have /dev/sdb1, etc., depending on how you formatted it.
Mount /dev/sdb1 at /mnt, and create a folder there called 'backup'. Now we're going to be using the 'dd' command, so you'll want to be mindful of what you're doing here.
What we're going to do is image your Fedora partition (let's call it /dev/sda1) and store it as a file on the external drive. We can do this with the following command (without the quotes):
"sudo dd if=/dev/sda1 of=/mnt/backup/fedora.img bs=1M"
The image we're creating can be directly converted into a virtualbox disk image. Depending on the size of your Fedora partition, this could take up to a few hours.
When the copying is finished, install Virtualbox in your live CD environment. Now we need to copy the image create on /dev/sdb1 to something Virtualbox can read and understand. Once Virtualbox is installed, 'cd' into /mnt/backup and run the following command:
"vboxmanage convertfromraw fedora.img -format VDI fedora.vdi"
Virtualbox will convert the fedora.img to the VDI format, which Virtualbox uses as a virtual hard drive. This will also take a while, depending of course on the size of the image.
When that's finished, reboot your computer and login to Windows. Open up Virtualbox and create a new virtual machine for Fedora. When asked for the Virtual Hard Disk, instead of Virtualbox creating a new one by default, select 'Use existing hard disk' and find the fedora.vdi file on your external hard drive. Because you copied the image of /dev/sda1 onto an NTFS partition, Windows should automatically detect and mount your external hard drive partition /dev/sdb1.
I hope this guide will help you. I can't guarantee it will work for you, but I've used this method a few times before and didn't encounter any issues. Let me know how everything went.
- 04-27-2013 #3
- Join Date
- Apr 2013
Hey thanks for the quick reply! I'll try this out once I get my usb working. It isn't showing up when I plug it into any of my usb ports so I'm looking around for an answer to that right now
- 04-28-2013 #4
I forgot to mention that you can certainly copy the fedora.vdi file from your external drive onto your Windows partition and store it in any directory of your choosing. You may have already inferred that, but I just want to make sure it was clear enough. Then once you have tested your fedora.vdi in Virtualbox and everything works as expected, you can proceed to delete or format your Fedora partition. For optimal performance, I'd suggest running your Fedora VM with 1024MB of RAM allocated to it. If you have a lot of RAM on your machine then you can certainly use more.
- 04-28-2013 #5
- Join Date
- Apr 2013
I need help figuring out which partition to make the image of. Fedora installs itself in several separate parts with a root a home a swap a tmp and I think one other.
When I do lsblk this is the output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 698.7G 0 disk
├─sda1 8:1 0 649.8G 0 part
├─sda2 8:2 0 13.9G 0 part
├─sda3 8:3 0 500M 0 part /boot
├─sda4 8:4 0 1K 0 part
└─sda5 8:5 0 34.5G 0 part
├─vg_jarvis-lv_swap (dm-0) 253:0 0 7.9G 0 lvm [SWAP]
└─vg_jarvis-lv_root (dm-1) 253:1 0 26.7G 0 lvm /
sdb 8:16 0 2.7T 0 disk
└─sdb1 8:17 0 2.7T 0 part /media/sdb1
sr0 11:0 1 1024M 0 rom
I have made a .vdi of sda5 but it said no bootable media when I tried running it. What do you think?
- 04-28-2013 #6
Oh, I see. It looks like you have LVM on sda5, with a /boot partition on sda3. sda4 does not appear to have a mount point, and only contains 1K of disk space. Are you sure that is your /tmp partition? I'm not sure how to do this now that I see you have LVM partition. Perhaps someone else here can help. But if I were in your situation, what I'd do is backup all my important files from my Fedora system into a backup folder on the external drive. Then I'd create a brand new Fedora VM on Windows and set it up like you have it on your hard drive, and then copy all the important files from the backup drive to your Fedora VM. It's probably easier to do it that way instead of cloning and copying. It would be better to copy the partition into a compressed image if you had everything on one partition.