LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-01-2024, 12:55 PM   #1
dodoLQ
Member
 
Registered: Dec 2014
Location: France
Distribution: Slackware
Posts: 211

Rep: Reputation: Disabled
Converting a .vmx image into a .iso one


Hi guys, what i want to do is convert a vmware (.vmx) image into a .iso format for a bare-metal installation. The image to convert is Metasploitable2 and i don't want to run it in VM. Can you give me some ways to do that ? Thanks!
 
Old 04-02-2024, 12:31 AM   #2
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416
Blog Entries: 43

Rep: Reputation: 36
I know this! It's not the most fun though...

What you do, the easiest way I know, is boot the VM from a clonezilla-sysrescue cd image.

https://clonezilla.org/related-live-.../more_info.php

Then, you run a dd command, to copy the hard drive to a file. You use the extension .iso, as that's really all an .iso is, just a disk image. Assuming the content is a valid .iso, it will be a valid .iso.
 
1 members found this post helpful.
Old 04-02-2024, 01:30 AM   #3
Thom1b
Member
 
Registered: Mar 2010
Location: France
Distribution: Slackware
Posts: 484

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Quote:
Originally Posted by dodoLQ View Post
Hi guys, what i want to do is convert a vmware (.vmx) image into a .iso format for a bare-metal installation. The image to convert is Metasploitable2 and i don't want to run it in VM. Can you give me some ways to do that ? Thanks!
Hi dodo, I don't know if you receive my private message in french. We can talk about that on french forum if you want, it will be easier for me.
See you soon
 
Old 04-04-2024, 12:52 PM   #4
dodoLQ
Member
 
Registered: Dec 2014
Location: France
Distribution: Slackware
Posts: 211

Original Poster
Rep: Reputation: Disabled
@des_a Thanks for the tip!
@Thom1b Don't got any private message, will open a thread on your forum
 
Old 04-04-2024, 04:30 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,987

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
Maybe the best choice is to make a clone. Clonezilla is one way to take some drive to include boot area. If you create a VM and boot to the clonezilla iso and have your virtual hard drive and some networked or more local storage you can create a set of files. Clonezilla has a way to publish that over the lan/wan too if you don't want to make a set of storage files.

If one wanted to they might use dd command but it is not a beginner level task usually.
 
Old 04-08-2024, 12:46 AM   #6
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416
Blog Entries: 43

Rep: Reputation: 36
If you go the dd route, but jefro may be right about just making a clone, but it's really a choice depending, on circumstances, it should be as easy as

Code:
dd if=<file_to_convert> of=<file_to_output><.iso> bs=512
Note that I could be wrong about the exact command, and this assumes I'm right about the format. Keep in mind, that with this command, when you use it, it's important to get EXACTLY as you intend, or you could wipe out your whole hard drive! I've done that before, by putting an "a", where a "b" belongs. It's a useful tool, but it's very powerful. For that reason, maybe the clone is better. Just wanted to give you more information. Please mark as solved if solved.
 
Old 04-08-2024, 12:47 AM   #7
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416
Blog Entries: 43

Rep: Reputation: 36
P.S. - I don't know how to use clonezilla. I'm learning partimage's replacement, but I don't know it either yet.
 
Old 04-09-2024, 01:57 PM   #8
des_a
Senior Member
 
Registered: Sep 2006
Posts: 1,416
Blog Entries: 43

Rep: Reputation: 36
Actually, I rethought my command. Maybe in this case, you'd need to have it be the hard drive of a VM, and find which sd hd or mmcblk it is, and then do this, if it was /dev/sda:

Code:
dd if=/dev/sda of=<file_converted> bs=512
If that's not right, I guess I don't know the command specifically, which I may have been tired when I wrote that, but the principles apply that you "could" use it. Sorry for being tired. When you recognize you're tired, it's not a great time to write those commands. The hard part is recognizing you're tired.

The command I gave or this one, will both not damage the machine if you type it right, under normal circumstances, putting the /dev/sda on the other side probably will in that case. That's why, be very careful. By writing it when I was tired, though I didn't give a command that will damage your machine, even though I didn't realize it, I demonstrated what to try NOT to do.

See, when I rethought it, I thought, wait a minute, the file may not quite be understood by dd, unless it's running! I guess I'll stay silent again now, unless someone else responds, on this thread. But the whole point of posting again, is that it's really up to you which method you choose to use, and I was trying to be helpful, but I guess I was tired, without knowing.

Even when I'm tired, I rarely damage my machine anymore, because putting the device on the wrong side, is a beginner mistake, but when I'm tired, I might still clone the wrong drive. The hard part is knowing when you are tired.
 
Old 04-09-2024, 02:31 PM   #9
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 961

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Maybe it would be good to do some basic explanation of different file systems, partitions and media...

A physical or in some kind virtual environment emulated hard drive is a read and write capable media which usually is rather big. This big media is mostly split up into different smaller chunks, "partitions". The beginning of the media might contain some boot code and mostly also contains some kind of partition table. Those partitions might have different file systems. Linux installations often have ext2/ext4 file systems.

An optical media is often only possible to write once, and once written it will be mounted read only. It is possible to boot also from optical media, but an optical media does not have the same kind of boot record that a hard drive has. Optical media also lacks partitions and the only file systems to choose from are iso9660 file with extensions. Before burning an iso9660 file system to optical media the file system can be created as a file and such files are usually named *.iso.

It is possible to use optical media as installation media. For such purposes the optical media usually contains programs and scripts to configure a hard drive, install software compressed from the optical media to the hard drive and finally configure the installed operating system to match the hardware it was installed on.

This installation process is not reversible, you can usually not take a configured system and create a generic full featured installation media. At best, you can create an image of your installed system and with or without compression put it on optical media (if it fits on such limited size). That image file can then be used to run on identical hardware.

Now you have a vmx file which runs in vmware. It is possible to do:

Code:
mkisofs -o file.iso -udf file.vmx
The above however assumes that your vmx file is 4 GB or smaller as that is a limit of the iso9660 file system. If your vmx file is bigger than 4 GB you will need to compress and/or split the file to smaller sizes.

The example above will place your .vmx file in an .iso file system possible to burn to optical media. That vmx file will then be possible to copy to a hard drive, chmod to writeable and run in vmware again.

regards Henrik
 
Old 04-09-2024, 04:58 PM   #10
babydr
Member
 
Registered: Aug 2015
Location: Fairbanks , Alaska
Distribution: Slackware-14.2 & 15.0
Posts: 229

Rep: Reputation: 45
@henca , Doing a bit of googl'ng , seems Bluray also uses udf format
So 4GB isn't always the limit on size .
Unless teh tool you mentioned has such a limit ?
 
Old 04-09-2024, 07:33 PM   #11
scuzzy_dog
Member
 
Registered: Apr 2021
Location: Free State of Texas (somewhat free)
Posts: 108

Rep: Reputation: Disabled
It would be so much easier just to install Metasploit onto a drive using a Metasploit iso image. Then copy any config files, etc, etc. A .vmx file is not your usual file.
 
Old 04-10-2024, 01:05 AM   #12
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 961

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Quote:
Originally Posted by babydr View Post
@henca , Doing a bit of googl'ng , seems Bluray also uses udf format
So 4GB isn't always the limit on size .
Unless teh tool you mentioned has such a limit ?
Yes, I might have confused the 4 GB file size limit with something else than udf.

When burning BluRay on Slackware 15 for some reason k3b has not worked well for me on Slackware 15 on file systems precreated with mkisofs. Instead I have resorted to growisofs for BluRay disks.

regards Henrik
 
1 members found this post helpful.
Old 04-14-2024, 02:50 AM   #13
dodoLQ
Member
 
Registered: Dec 2014
Location: France
Distribution: Slackware
Posts: 211

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by henca View Post
Now you have a vmx file which runs in vmware. It is possible to do:

Code:
mkisofs -o file.iso -udf file.vmx
Hi henca, after inflating metasploitable-linux-2.0.0.zip we have these files:
Code:
-rw------- 1 dodo users       8684 May 20  2012 Metasploitable.nvram
-rw-r--r-- 1 dodo users 1925644288 May 20  2012 Metasploitable.vmdk
-rw-r--r-- 1 dodo users          0 May  7  2010 Metasploitable.vmsd
-rwxr-xr-x 1 dodo users       2804 May 20  2012 Metasploitable.vmx*
-rw-r--r-- 1 dodo users        269 May  7  2010 Metasploitable.vmxf
i've tested your commande and mounted the iso but i only get a image on /mnt/dvd:
Code:
ls /mnt/dvd
Metasploitable.vmdk
Just wanted the CONTENT of Metasploitable.vmdk ...
 
Old 04-14-2024, 06:25 AM   #14
henca
Member
 
Registered: Aug 2007
Location: Linköping, Sweden
Distribution: Slackware
Posts: 961

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Quote:
Originally Posted by dodoLQ View Post
Just wanted the CONTENT of Metasploitable.vmdk ...
That content is most likely a partitioned hard disk image with some partition(s) containing an installation configured to match the hardware emulated by vmware.

Do you want that content for backup purposes? I so storing the .vmdk file and other files on optical media should probably be enough.

Do you want to create a bootable optical media capable of running the same software on some random machine? That can only be accomplished by any utility within the operating system installed in the virtual machine. In my experience, not many operating system installations has support for "create a live optical media of this installation". Some live optical media installations has support for "install this on a hard drive", but the opposite is far from common.

regards Henrik
 
Old 04-16-2024, 12:24 PM   #15
dodoLQ
Member
 
Registered: Dec 2014
Location: France
Distribution: Slackware
Posts: 211

Original Poster
Rep: Reputation: Disabled
I think i'll stay with an installation of Slackware64-15.0 (without patches) on a Pentium dual-core for testing. I also think this vm is based on ubuntu (there's a reference in the script Metasploitable.vmx telling that) and i'm not interrested with that now
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting SDK files into image to burn into SoC NAND flash lxdev Linux - Embedded & Single-board computer 0 08-25-2016 04:45 AM
converting .bin into iso image file aogbuokiri General 4 02-10-2009 12:40 PM
Turn My Linux Distro into a VMX. gamewolf Linux - Software 2 08-16-2007 03:51 PM
How do you merge 4 CD ISO images into one DVD ISO image? nsydenham Linux - Software 6 01-15-2007 09:49 AM
vmware-vmx started among boot positrox Linux - Software 1 03-03-2006 06:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration