# ISO on flash drive?



## Melvin Stark (Feb 10, 2016)

I've successfully installed FreeBSD using the FreeBSD-10.2-RELEASE-amd64-memstick.img.  However, no iso boots from a flash drive.  I see a momentary flash, but then see my normal grub screen.

The FAQ page describes the img image as being sufficient for a flash drive.  However, unless I'm missing it, there's no mention that iso images can't be used.

I've successfully written ISO images to flash drives with other distributions.  So, is the FreeBSD iso image designed to not be used on a flash drive?


----------



## SirDice (Feb 10, 2016)

The ISO image is solely for CD/DVD, it cannot be used for flash drives. That's why we have separate images.


----------



## kpa (Feb 10, 2016)

It's possible to make an universal image that works both on CD/DVD and a flash drive (for example the netinst image on Debian) but it's not yet possible on FreeBSD because of how the boot blocks and loader(8) work.


----------



## Melvin Stark (Feb 10, 2016)

kpa said:


> It's possible to make an universal image that works both on CD/DVD and a flash drive (for example the netinst image on Debian) but it's not yet possible on FreeBSD because of how the boot blocks and loader(8) work.



Thank you, it makes more sense now.

I'm not trying to start a distribution war, but as writing an ISO to flash is so common, shouldn't the FAQ page specifically state the ISO images don't work with flash drives?  I realize there are separate files, but why is the img image so much smaller?  Does it contain the same content as the iso?

The size of the img led me to think that file exists to fit on a smaller storage device.  That, coupled with no disclaimer, led me to assume the problem was on my end.


----------



## SirDice (Feb 10, 2016)

Aren't you comparing the sizes of the mini-memstick image to the CD image? The memstick image and CD images aren't that much different in size.

The release notes show what image is to be used for what purpose and what it contains.
https://www.freebsd.org/releases/10.2R/announce.html


----------



## Melvin Stark (Feb 10, 2016)

SirDice said:


> Aren't you comparing the sizes of the mini-memstick image to the CD image? The memstick image and CD images aren't that much different in size.



No, I'm comparing it to the dvd image.   FreeBSD-10.2-RELEASE-amd64-dvd1.iso is 2,674,556 KB while FreeBSD-10.2-RELEASE-amd64-memstick.img is 755,520 KB.

As with memstick, I assumed the CD image exists as a smaller size due to the storage capacity of the CD.


----------



## SirDice (Feb 10, 2016)

> dvd1
> 
> This contains everything necessary to install the base FreeBSD operating system, the documentation, *and a small set of pre-built packages aimed at getting a graphical workstation up and running.* It also supports booting into a "livefs" based rescue mode. This should be all you need if you can burn and use DVD-sized media.





> memstick
> 
> This can be written to an USB memory stick (flash drive) and used to do an install on machines capable of booting off USB drives. It also supports booting into a "livefs" based rescue mode. *There are no pre-built packages.*
> 
> ...


----------



## Melvin Stark (Feb 10, 2016)

> This can be written to an USB memory stick (flash drive) and used to do an install on machines capable of booting off USB drives. It also supports booting into a "livefs" based rescue mode. *There are no pre-built packages.*



As I mentioned in my original post, I successfully installed FreeBSD with the memstick img.  But, if an ISO can't be written to a flash device, why is the img data inferior to the ISO?  I understand there are no pre-built packages, but why?  My flash device can easily accommodate the data in the DVD ISO.

After installing, I mounted the iso I'd written to my flash device as /dist.  I then executed `setenv REPOS_DIR /dist/packages/repos` and built some packages as a test.  But if the data on the img and iso versions were identical I could do so from the flash img.

This is not the end of the world, but that's my take as a new user.


----------



## SirDice (Feb 10, 2016)

Melvin Stark said:


> But, if an iso can't be written to a flash device, why is the img data inferior to the iso?


It isn't. The memstick image is the same as the CD image. It's the DVD image that's the odd one out. 

You really shouldn't be using the packages on the DVD any way. By the time you install the release the packages are old and will require updating. So it's best not to install them from DVD and pull them directly from the repositories.


----------



## gkontos (Feb 10, 2016)

You can always convert the ISO to IMG. Keep in mind that packages from the original distribution will be outdated, so installing over the Internet is recommended.


----------



## Melvin Stark (Feb 10, 2016)

SirDice said:


> It isn't. The memstick image is the same as the CD image. It's the DVD image that's the odd one out.
> 
> You really shouldn't be using the packages on the DVD any way. By the time you install the release the packages are old and will require updating. So it's best not to install them from DVD and pull them directly from the repositories.



I prefer installing from medium and creating a backup image before connecting to the internet.  For updates, the internet is necessary, but for installation I disagree.  Different philosophies, in my opinion (what do I know?) the memstick should be brought up to the dvd level.


----------



## Melvin Stark (Feb 10, 2016)

gkontos said:


> You can always convert the ISO to IMG. Keep in mind that packages from the original distribution will be outdated, so installing over the Internet is recommended.



Thank you, that's a good idea.  I just converted it with dd and will test it tomorrow.


----------



## SirDice (Feb 11, 2016)

Melvin Stark said:


> I prefer installing from medium and creating a backup image before connecting to the internet.  For updates, the internet is necessary, but for installation I disagree.  Different philosophies, in my opinion (what do I know?) the memstick should be brought up to the dvd level.


You might want to give PC-BSD a try, that's probably more like you expected.


----------



## Melvin Stark (Feb 11, 2016)

SirDice said:


> You might want to give PC-BSD a try, that's probably more like you expected.



I tried PC-BSD after attempting the FreeBSD ISO.  Although I could boot to the PC-BSD ISO on my flash drive, the installation encountered ACPI errors.  I had roughly the same problem with FreeBSD but `boot -m` fixed it.  Perhaps there's a comparable PC-BSD solution but I have FreeBSD up and running.


----------



## Melvin Stark (Feb 13, 2016)

> You can always convert the ISO to IMG. Keep in mind that packages from the original distribution will be outdated, so installing over the Internet is recommended.



Converting to an IMG image with dd did not work.  It's probably more complicated.

I have FreeBSD installed so this is more from curiosity.  Is there a method other than `dd bs=4M if=InFileName.iso of=FreeBSD.img`?


----------



## Juha Nurmela (Feb 13, 2016)

You are confused: that `dd` is just a copy `cp file.a file.b`, dd converts nothing (except  lowercase/uppercase and such). Renaming `mv file.a file.b` would do the same, when original file is not needed anymore.

Also, any *bs*= above 128k (usually, depends on system's _MAXPHYS_) is not worth much, it just hinders caching.
There will be read-ahead and write-behind, which work best when you use the _MAXPHYS_. There might be exceptions to this, usually depending on the output device.

Juha

Edit: Often perpetuating misinformation, I checked the numbers:


```
1GB random img
dd bs=1m of=/dev/da0p3 if=img    562 seconds real (crappy memstick)
dd bs=128k of=/dev/da0p3 if=img 550 seconds real
dd bs=128k of=/dev/mmcsd0s2b    88.71 seconds real (less crappy SD) 
dd bs=1m of=/dev/mmcsd0s2b      88.72 seconds real
```


----------



## Melvin Stark (Feb 14, 2016)

Juha Nurmela said:


> You are confused: that `dd` is just a copy `cp file.a file.b`, dd converts nothing (except  lowercase/uppercase and such). Renaming `mv file.a file.b` would do the same, when original file is not needed anymore.



That makes sense as I did a "diff" on the files and they're identical.  I've used dd, but only to burn images to flash drives.  The reason I tried dd is I found some posts suggesting that very thing for converting from ISO to IMG.


----------



## Juha Nurmela (Feb 14, 2016)

cmp(1) would be more appropriate when comparing binary data.

CD image would be an ISO9660 formatted thing, memorysticks have different partitioning. There are plenty of ways to convert, but I don't know the best way (except just getting the proper image).

You could insert the memstick and mount the CD image via mdconfig(8), then start install from the mounted CD to the memstick device, but you could easily trash your harddisk installation instead.

Juha


----------



## wblock@ (Feb 14, 2016)

ISO9660 CD images use 2K blocks and have a special filesystem.  Some computers can boot from those images when they are copied to a flash drive, but not all.  Converting an ISO9660 image to a real hard drive/flash drive image is much more complicated.  For FreeBSD, there is very little point, it is usually quicker and easier to just download the correct type of image.


----------



## gkontos (Feb 14, 2016)

From my OSX environment it is very easy actually (sorry for the off topic answer)

`hdiutil convert -format UDRW -o /path/to/target.img /path/to/source.iso`
`sudo dd if=/path/to/target.img of=/dev/rdiskN bs=1m` (where N is the USB disk#)


----------

