# Is it possible to convert a bootable .iso to a bootable SSD?



## Chris_H (Jan 5, 2014)

Greetings, all.

I'm looking to convert a bootable install CD/DVD into a bootable flash/SSD image. My thoughts are; that it's faster, and more "environmentally friendly" to experiment/develop from an SSD, than turning CD/DVD media into "coasters". That said; I'm looking to create an install image from a USB SSD image.

Which I boot from;
then load the entire contents into RAM;
then begin the install process from the contents now in RAM.
This leaves me the ability to then _wipe_ the contents of the flash/SSD drive. So as to install to it. In my mind, this makes it a snap to test installs, and complete systems, that I can later save and dump to media for later deployment. So I have a bootable .iso image, and am wondering how/if I can mount it, and then dump it to a USB SSD, so I can boot from it, to test it. Is it possible? How do I do it? I know about dd(). But don't know enough to apply it to my situation.

Thank you for all your time, and consideration.

--Chris

Oh, I almost forgot: this is on an 8.4-STABLE system.


----------



## wblock@ (Jan 6, 2014)

*Re: Is it possible to convert a bootable .iso to a bootable*

Yes, there are USB memory stick images to install FreeBSD. Look in the ISO directory of the release for the "-memstick.img" file. Just download one of those rather than the CD or DVD image. There is also mfsBSD, a very nice minimal memory stick version of FreeBSD.


----------



## Chris_H (Jan 6, 2014)

*Re: Is it possible to convert a bootable .iso to a bootable*



			
				wblock@ said:
			
		

> Yes, there are USB memory stick images to install FreeBSD. Look in the ISO directory of the release for the "-memstick.img" file. Just download one of those rather than the CD or DVD image. There is also mfsBSD, a very nice minimal memory stick version of FreeBSD.


Thanks @wblock@,

But I have an (custom) .iso image. Is it not possible to simply use dd() to dump it onto the USB SSD drive? Will it still be bootable, as the .iso is now? Remember, as I noted in the OP, this is for deployment of modified/customized images. Intended to be used to duplicate the same configuration across many servers. Kind of like cloning one of the servers, but not quite.

Thanks again for the reply, @wblock@.

--Chris


----------



## Chris_H (Jan 6, 2014)

*Re: Is it possible to convert a bootable .iso to a bootable*

OK. Here's where I'm at, at this point. I've performed the following: `mount -t cd9660 /dev/`mdconfig -f BSDserver01.iso` /mnt`. This has mounted my ISO image on /mnt*.* This will easily allow me to copy the contents of the ISO to the USB SSD drive. But the _boot_ business is different on a CDFS (cd9660) than for a typical drive, _especially_ a USB SSD. Can anyone please advise me from here?

Thanks.

--Chris


----------



## wblock@ (Jan 6, 2014)

*Re: Is it possible to convert a bootable .iso to a bootable*

Actually, the original did not mention customized images.  I had written some about that, but then went back and deleted it as irrelevant.

No, ISO uses a different layout than a standard disk, and the blocks are 2048 bytes instead of 512.  There is no point in using an ISO for a customized image because it gives no advantages and makes things more difficult.

Clonezilla and g4u are two backup systems that will do what you want, but not very well.  They use dd(1), which is a mistake because it copies everything, not just occupied space.  Later versions of Clonezilla can copy just used blocks in UFS filesystems, but insist on copying swap space as binary.

An alternate way: create two partitions on a memory stick.  The first needs to be just large enough to hold mfsBSD.  The second is for a filesystem to hold dump(8) files.  A script can be written to automate the restore, but be careful: it's easy to overwrite a working system.  See Backup Options For FreeBSD for instructions on using dump(8) and restore(8).


----------



## Chris_H (Jan 6, 2014)

*Re: Is it possible to convert a bootable .iso to a bootable*

Thank you very much for your informative reply, @wblock@.


			
				wblock@ said:
			
		

> Actually, the original did not mention customized images.  I had written some about that, but then went back and deleted it as irrelevant.


I'm sorry. I'm afraid I didn't think my post through, before I made it. Because _I_ know what I was attempting to do, I made too many assumptions, while making the post.


			
				wblock@ said:
			
		

> No, ISO uses a different layout than a standard disk, and the blocks are 2048 bytes instead of 512.  There is no point in using an ISO for a customized image because it gives no advantages and makes things more difficult.
> 
> Clonezilla and g4u are two backup systems that will do what you want, but not very well.  They use dd(1), which is a mistake because it copies everything, not just occupied space.  Later versions of Clonezilla can copy just used blocks in UFS filesystems, but insist on copying swap space as binary.
> 
> An alternate way: create two partitions on a memory stick.  The first needs to be just large enough to hold mfsBSD.  The second is for a filesystem to hold dump(8) files.  A script can be written to automate the restore, but be careful--it's easy to overwrite a working system.  See Backup Options For FreeBSD for instructions on using dump(8) and restore(8).


Thanks for all the pointers. I'm not sure it's _exactly_ what I'm looking for. But it's _definitely_ close enough.  If I still have trouble. I'll take more time to better articulate what I'm trying to accomplish, before I post. 

Thanks again @wblock@.

--Chris


----------



## jrm@ (Jan 6, 2014)

*Re: Is it possible to convert a bootable .iso to a bootable*

I have some notes telling me this worked for me at one point.  Details elude me, but maybe it's a place to start.  Don't forget to substitute /dev/da0 with your USB device.


```
% fetch '﻿﻿http://www.uni-koblenz.de/~krienke/ftp/noarch/geteltorito/geteltorito.pl﻿'
% perl geteltorito.pl cd.iso > some.img
% sudo dd if=some.img of=/dev/da0 bs=512K
```

Edit: Changed wget to fetch.  No need to use an external program when fetch is in the base.


----------



## SirDice (Jan 6, 2014)

*Re: Is it possible to convert a bootable .iso to a bootable *

The script @jrm mentions shows why it will not work. The way CDs and harddisks boot are quite different. Harddisks boot off of a boot record whereas CDs use something called El Torito.

http://en.wikipedia.org/wiki/El_Torito_ ... tandard%29
http://en.wikipedia.org/wiki/Boot_sector


----------



## Chris_H (Jan 6, 2014)

*Re: Is it possible to convert a bootable .iso to a bootable*

Thank you @jrm, and @SirDice for the information. I opted to simply mount the .iso image, and copy the everything I needed to a directory. Then I used md() to create an empty image. So I can copy the tree(s) to it. I'm now just working out how to make the image bootable.

Thanks again, @jrm, and @SirDice!

--Chris


----------



## SirDice (Jan 6, 2014)

*Re: Is it possible to convert a bootable .iso to a bootable*



			
				Chris_H said:
			
		

> I opted to simply mount the .iso image, and copy the everything I needed to a directory. Then I used md() to create an empty image. So I can copy the tree(s) to it. I'm now just working out how to make the image bootable.


You should be able to do that with `gpart bootcode`. Creating an El Torito bootable CD is actually a lot more complex


----------



## kpa (Jan 6, 2014)

*Re: Is it possible to convert a bootable .iso to a bootable*

It is actually possible to create an image file that is both a bootable CD image and a bootable USB memory stick image, the Debian Linux install images are like that. FreeBSD's image creation tools that are part of release(7) just don't support creation of such images yet.


----------



## SirDice (Jan 6, 2014)

*Re: Is it possible to convert a bootable .iso to a bootable*

I think it very much depends on the BIOS how you can boot a CD. Even El Torito isn't guaranteed to work on old hardware. Booting a USB memory stick, harddisk or (S|P)ATA harddisk isn't that different when you boot them. If the machine has USB 2.0 you can most likely boot from it. I'm not sure about machines that have USB 1.0.

A reasonably new UEFI/BIOS should be able to boot from just about anything with a proper boot record.


----------

