Jump to content

How to convert a Vmware image to ISO?


ViTALiTY

Recommended Posts

I'm not sure if it would work 100%, but you can always just install your OS to USB, then image it off as a backup.

I would use Linux and the dd command, just be careful or you can destroy your data lol.

You may be able to use tools like clonezilla as well. I'm sure there are a number of software options out there.

Link to comment
Share on other sites

Isn't there a slight danger here in that your hardware may not be properly supported from this image since it's now configured to work with the virtual/emulated hardware exposed within the VM?

As a starting point, I'd suggest going the 'cp -a' route. Using fdisk create a sufficiently large partition on a USB stick but don't mark it as bootable just yet.

Find out what the UUID of the USB stick's partition is by running

ls -al /dev/disk/by-uuid

You're going to need that uuid exactly as presented there a few times...

Mount the stick from within the virtual, let's assume you have /mnt/stick for that, and then, from the root directory:

cp -a /bin /mnt/stick
cp -a /boot /mnt/stick
etc. etc.
cp -a /var /mnt/stick

As you do this, exclude the dev, proc and sys folders. Just create these directories in /mnt/stick when you're done. Remove /mnt/stick/etc/mtab as that file keeps track of the currently mounted filesystems and the OS now on your stick hasn't mounted anything.

Having done this, restart the virtual with the stick in it. If you're using lilo then at the boot prompt select the normal image you'd use and type, after the name, root=UUID=<the uuid of the stick's partition>

If you're using grub, select the option you'd normally use and, from that menu, select edit and append that bit to the kernel parameters.

End result is that you should now be running your VMWare's Linux kernel but using of the stick for disk. Once booted up, it's a good idea to verify this by running 'mount' and making sure '/' is mounted as the device with that UUID. If it's the case, update your /etc/fstab and your grub/lilo config file(s) such that it now points at the USB stick. In all cases where a device name is needed and you want to specify the stick, write simply "UUID=<the uuid of the stick's partition>". You can't use /dev/sdX9 since in that the X and the 9 will be different from one machine to the next whereas the uuid will remain constant.

Finally, run fdisk on your stick again and mark the stick's partition as bootable.

From this point on your stick should contain a live copy of your OS, capable of being booted on any machine, assuming that the kernel on there supports all the hardware present on the box.

Link to comment
Share on other sites

Isn't there a slight danger here in that your hardware may not be properly supported from this image since it's now configured to work with the virtual/emulated hardware exposed within the VM?

As a starting point, I'd suggest going the 'cp -a' route. Using fdisk create a sufficiently large partition on a USB stick but don't mark it as bootable just yet.

Find out what the UUID of the USB stick's partition is by running

ls -al /dev/disk/by-uuid

You're going to need that uuid exactly as presented there a few times...

Mount the stick from within the virtual, let's assume you have /mnt/stick for that, and then, from the root directory:

cp -a /bin /mnt/stick
cp -a /boot /mnt/stick
etc. etc.
cp -a /var /mnt/stick

As you do this, exclude the dev, proc and sys folders. Just create these directories in /mnt/stick when you're done. Remove /mnt/stick/etc/mtab as that file keeps track of the currently mounted filesystems and the OS now on your stick hasn't mounted anything.

Having done this, restart the virtual with the stick in it. If you're using lilo then at the boot prompt select the normal image you'd use and type, after the name, root=UUID=<the uuid of the stick's partition>

If you're using grub, select the option you'd normally use and, from that menu, select edit and append that bit to the kernel parameters.

End result is that you should now be running your VMWare's Linux kernel but using of the stick for disk. Once booted up, it's a good idea to verify this by running 'mount' and making sure '/' is mounted as the device with that UUID. If it's the case, update your /etc/fstab and your grub/lilo config file(s) such that it now points at the USB stick. In all cases where a device name is needed and you want to specify the stick, write simply "UUID=<the uuid of the stick's partition>". You can't use /dev/sdX9 since in that the X and the 9 will be different from one machine to the next whereas the uuid will remain constant.

Finally, run fdisk on your stick again and mark the stick's partition as bootable.

From this point on your stick should contain a live copy of your OS, capable of being booted on any machine, assuming that the kernel on there supports all the hardware present on the box.

Thanks for the help, but I guess that is way too much for me. :unsure:

Link to comment
Share on other sites

Ok so, I got around to trying this:

http://www.turnkeylinux.org/blog/convert-vm-iso

And I'm stuck in this:

mount -o loop turnkey-core.raw turnkey-core.mount

Error: "mount: you must specify the filesystem type"

So maybe the VM has partitions.

Then I did these two:

loopdev=$(losetup -s -f turnkey-core.raw)apt-get install kpartxAnd I got stuck here:kpartx -a $loopdev

Error:

llseek error
device-mapper: resume ioctl on loop0p1 failed: Invalid argument
create/reload failed on loop0p1
device-mapper: resume ioctl on loop0p2 failed: Invalid argument
create/reload failed on loop0p2

And I have absolutely no idea on what to do now.

Edited by ViTALiTY
Link to comment
Share on other sites

Okay. So clearly, as you suspected, your VMWare image has 2 partitions and losetup is used to create a loopback device for each of them by mapping into the turnkey-core.raw file.

Roughly how large is your turnkey-core.raw file?

I'd say try again, this time starting with the command

losetup -D
to remove any previously created loopback mappings, and you can leave out the apt-get command since the program has already been installed.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...