Results 1 to 3 of 3
Hi all this is my first time posting on Linux forums and its nice to be here. I'm currently working on a project that has seen me developing a modified ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-16-2011 #1
- Join Date
- Oct 2011
Convert modified OS in Vm to bootable physical media
Hi all this is my first time posting on Linux forums and its nice to be here.
I'm currently working on a project that has seen me developing a modified ubuntu server 10.04.03 distro inside a VMWare Fusion 3.1.3 virtual machine. I'm now ready to test this on a live device. This means taking the OS in the virtual machine and putting it on a couple of physical hard drives so that when the devices are switched on they can boot up into the OS I've developed.
Now as I'm expecting to still use the vm version for tweaks and bug fixes during testing I'm looking at this stage for a quick way of copying only the OS from the vm to the physical media, rather than creating a bootable image and having to (at this stage) deal with squashes etc.
I'm just wondering if anyone has any suggestions that could help me achieve this. I have tried initially to create a clone using clonezilla but found issues with it using it within a vm.
I've also looked into using the unix 'dd' command but this is undesirable due to issues regarding partioning and disk geometry. Ideally I'm looking really for some pointers, tips or techniques to help me achieve this.
- 10-16-2011 #2
- Join Date
- Jan 2005
- Saint Paul, MN
look at the commands "cpio" and "rsync". The "cpio" command is a very old command and it has the advantage that it handles the "/dev/" directory correctly. Also you should not copy the stuff inside "/proc" and "/sys" as they are populated at boot and copying them leaves bad data in them that just takes up space (not sure if they cause any side effects as I avoid coping them.)
- 10-17-2011 #3
- Join Date
- Jan 2011
- Fairfax, Virginia, USA
I've done what you want to do a few different ways. I think the method I'm describing is the easiest but I might be overlooking some things.
First, I'm (maybe incorrectly) assuming you can only get to the VM's medium inside VMWare. If that is true, (in my opinion), the easiest way to move forward is to export the entire raw target block device for your destination hard drive to the VM. If you want, you can set up the geometry of your partitions prior or you can do it within VMWare. Boot your VM with a Live CD. If your target hard drive hasn't been set up and formatted, do it now from the Live CD.
For most people, only two partitions for "/" and "/boot" need to be created ... I'm (maybe incorrectly) assuming this is the case for you.
Mount your new partitions anywhere that you can write (/tmp is usually a good candidate) and create a enough of a skeleton directory structure so all your new partitions fit together correctly. If you only have to worry about "/" and "/boot", then something like this will do:
> mkdir /tmp/MOUNT > mount /dev/sdX2 /tmp/MOUNT > mkdir /tmp/MOUNT/boot > mount /dev/sdX1 /tmp/MOUNT/boot
With Linux, the only special step involves installing grub. You probably won't have luck dd'ing the first (about) 500 bytes from the VM MBR to the target MBR so I'd recommend chroot'ing to the new target hard drive and running a command to install grub like grub-install or grub itself. Ensure all the special directories (/sys, /proc, and /dev/pts) are mounted before running grub-install ... I did a quick google and found this:
Using "mount -o bind" for chroot enviroments — Linux
Before your finished, take a look at /etc/fstab and make sure it makes sense with your new hard drive configuration.