Installing FreeBSD from USB stick

Just came up with this handy cmd:-

xz -dc FreeBSD-12.0-RELEASE-amd64-mini-memstick.img.xz > /dev/da0

I was trying to enhance this by combining it with fetch() as in

Code:
fetch -o - http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.0-RELEASE/src.txz | tar xSf -

which fetches and extracts into the current directory. I was wondering if I could somehow pipe the output of fetch into xz....

kind of
Code:
fetch -o - https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/12.0/FreeBSD-12.0-RELEASE-amd64-mini-memstick.img.xz | xz -dc - > /dev/da0
if you know what I mean...
 
if you know what I mean...
you seem to like creating potential troubles, wondering where you get such ideas from.

Better make sure that your download is not corrupted!

https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/bsdinstall-pre.html said:
After downloading the image file, download CHECKSUM.SHA256 from the same directory. Calculate a checksum for the image file. FreeBSD provides sha256(1) for this, used as sha256 imagefilename.
 
I was trying to enhance this by combining it with fetch() as in

Code:
fetch -o - http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.0-RELEASE/src.txz | tar xSf -

which fetches and extracts into the current directory. I was wondering if I could somehow pipe the output of fetch into xz....

kind of
Code:
fetch -o - https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/12.0/FreeBSD-12.0-RELEASE-amd64-mini-memstick.img.xz | xz -dc - > /dev/da0
if you know what I mean...

This seems to work:-

fetch -o - https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/12.0/FreeBSD-12.0-RELEASE-amd64-mini-memstick.img.xz | xz -dc > /dev/da0

Can anyone give it a try?
 
note that the script above does not install but just copy the content on the da0.

automatically, you could fetch, mkdir /usr/freebsd-dist, run bsdinstall and there it would be installation, or
faster:
run gpart from script, you could replace bsdinstall by fetch and bring (unpack) the kernel and base on any places that you desire in few cmds.
 
Why don't you try it yourself? I rather check my download first before burning it to disk.
It works for me, just wondered if I was assuming something which wouldn't apply for someone else...
Yes, like tommiie implies, you are assuming your download will *always* result in a *perfectly valid* ISO image.

From what I understand xz does not have a proper CRC implementation (or any at all?), so to play it safe, the very least you should do is to also fetch the signature file and check your download against its checksum... not that hash functions implementations are infallible when it comes to collisions but having one less reason for disaster to worry about is always better.

And before you tell me "Uhh, how bad can a corrupt ISO be?! The USB just won't boot and I'll have wasted a few minutes of my life, tops." I'll just recount how a bad ISO once ended up damaging the MBR and parts of the partitions' metadata and how I spent the rest of the day recreating them and restoring data. That's how testing what should've been a valid live CD became a horror story instead of a walk in the park.
 
Yes, like tommiie implies, you are assuming your download will *always* result in a *perfectly valid* ISO image.

From what I understand xz does not have a proper CRC implementation (or any at all?), so to play it safe, the very least you should do is to also fetch the signature file and check your download against its checksum...

Easier said than done since I don't actually have a download.

If the img is corrupted would I end up with a bootable USB stick? Just asking...

To be honest, I can't remember ever having problems retrieving files from freebsd.org...
 
note that the script above does not install but just copy the content on the da0.

automatically, you could fetch, mkdir /usr/freebsd-dist, run bsdinstall and there it would be installation, or
faster:
run gpart from script, you could replace bsdinstall by fetch and bring (unpack) the kernel and base on any places that you desire in few cmds.

...but the idea is to create a bootable USB stick which would be inserted in a computer to install FreeBSD.

I actually do have a script which I can run to install FreeBSD by booting off the network. Maybe I'll post that sometime in another thread.
 
Easier said than done since I don't actually have a download.
Because you're outputting to the standard output which gets redirected through a pipe. And?

If the img is corrupted would I end up with a bootable USB stick? Just asking...
Maybe, maybe not. It depends on which part got corrupted. It may boot and throw errors but otherwise cause no dire consequences. It may boot and instead of reading from the disk it'll write to it. It may boot and write rubbish in unwanted parts of the memory. Or it may not boot at all because vital parts are completely messed up. A broken finger doesn't prevent you from running a marathon but a broken toe will.

To be honest, I can't remember ever having problems retrieving files from freebsd.org...
... doesn't mean you should not have checks in place. It's like programming without ever checking for errorcodes or exceptions. That's asking for trouble. Sooner or later you'll run into problems and you'll regret being sloppy.
 
Beastie
some folks are resistant for a rationale. They deserve hitting the hard road. What is left to us is showing other beginners better not to follow their path.
Some time ago the FreeBSD Forums were a known place for best practices and quality. That sadly changed a little as silly ideas hit the forums as everywhere else.
 
...but the idea is to create a bootable USB stick which would be inserted in a computer to install FreeBSD.

I actually do have a script which I can run to install FreeBSD by booting off the network. Maybe I'll post that sometime in another thread.
so you take a cdrom memstick you bring freebsd on it
you can then install it onto a harddisk usb, and with entire disk install, and then populate /usr/freebsd-dist with the desired release rXXXXXX you want.

then you have installed freebsd and it can install bsd anywhere once you boot from USB with F12 on your legacy bios.
 
Back
Top