Learn you a FreeBSD

Jeremy Ford
479 followers
432 Video Views·Jan 8, 2026
Watch me rebuild my NAS from Linux to FreeBSD
(I apologize for the audio. Lesson learned)
AI Generated·May contain errors
Today after work I realized that I need to rebuild my NAS.
So I thought I would film it for those who are interested in these sorts of projects
and for those who are interested in Unix-like operating systems.
As you see here on the screen, or maybe you can't see it because the font's kind of small,
this is running AmaLinux right now, but I'm going to rebuild it into FreeBSD.
The reason I want to rebuild it into FreeBSD is because, well, for one, I love FreeBSD.
I was into Unix before I got into Linux 25 years ago.
I love Unix operating systems, but for this specific machine,
I needed the root partition to be ZFS as well as the data pool to be ZFS,
and I'll explain why as we're going along.
So I've had this machine up and running for about a year.
Before that it was Oracle Linux and many other versions of Linux over the years,
but I don't know if you can hear it through the microphone, but this drive is starting to click.
The root partition has been corrupted, both physically and in the software side.
I was able to get the software back up, but where I live,
Duke Energy has a weak power grid.
It's an over-provisioned, saturated power grid,
and every time there's lightning anywhere, it blips off.
Yes, one could say I could use a UPS to backup power it so it shuts down correctly,
but right now my UPS is on my Mac Studio.
That's more important to me than this machine,
and yes, my important files are down here.
I'm not worried about them, but this, it would be much easier if it was ZFS,
and the reason is ZFS is unique,
and if you walk up to a machine running ZFS and you unplug it,
and then you power it back on, there's no data loss.
There's nothing went wrong.
ZFS doesn't have FSCK, for those who understand these sorts of things.
It doesn't make sense in ZFS, because if there's corruption,
it rolls back to the latest snapshot and rebuilds itself.
Basically, it heals itself, and other file systems have tried to emulate that,
like ButterFS really wants to do that, but ButterFS is not stable.
I understand if you roll Fedora, if you roll OpenSUSE,
by default on a desktop or laptop, you get ButterFS,
but if you go to their website and you look at what's not done,
what's not complete, it's too many things.
It's not ready for production, as we say.
For a laptop, it's fine, but if you have data that you care about,
you don't want to be on ButterFS.
Extended 4 is a horrible operating system for integrity.
I know a lot of people use it.
These days, so many people still use Extended 4.
It was not intended to be long-term.
It was a fix to a problem.
Extended 3 was a fix to Extended 2.
Extended 2 came from...
I think the GNU Hurd operating system invented Extended 2.
Linux adopted it, and then they came up with Extended 3,
and then eventually Extended 4 to sort of help it limp along.
It never got to the next-gen type file system, as we call them.
So Extended 4 is not good.
I know so many people still use it, but it's not.
That's why many years ago, Red Hat basically,
they gave up on Extended 4.
They gave up their hope for ButterFS, and they went to XFS by default.
So if you run any type of Red Hat-based operating system,
you get XFS by default.
I happen to be in the Red Hat world of things
because I work in infrastructure.
I don't care much about desktops and laptops for Linux.
That's not my thing, although I did years ago.
Since we're talking file systems,
my main driver for many years was Slackware,
and I would always install it with JFS.
If you don't know JFS, that's an operating system that...
I believe IBM created for their version of Unix,
which is called AIX.
Do I have that right?
So IBM had one, Unix.
Yeah, I think it's AIX.
And then SGI had another one, which is iRICS.
iRICS invented XFS, and AIX invented JFS.
Do I have that right?
If I don't have that right, if I have those mixed up,
correct me in any comments.
But basically, you get it.
JFS, XFS, ZFS, they came from the Unix space,
and I trust those more than the Linux ones,
not because Linux is bad.
I'm not a Linux hater.
In fact, I use Linux every single day about that.
It's just I understand file systems
because I used to be a storage engineer.
You know, I was in charge of big arrays,
you know, rows of NetApp arrays,
rows of EMC arrays, Pure Storage, Nexenta.
So I understand storage at that level.
In fact, I'll tell you a funny story
about NetApp if you're aware of it.
So NetApp runs the waffle file system,
and the waffle file system was actually invented
in the same room by the same people
who invented CFS for Sun Microsystems,
you know, for their Solaris operating system.
And they split in two different directions
and sort of pretended they weren't the same.
At the beginning, they were the same.
They just split off.
They're basically forks of each other.
And when I was in training for NetApp to be certified,
the trainer told me a story
because we went out to lunch with him,
where the International Space Station,
at least at the time, this was circa 2017 or so,
the International Space Station,
they have a NetApp array on the space station.
As it flies over Texas,
it snap mirrors its entire data set,
a copy of its entire data set down to Texas
before it reaches over the horizon,
basically until it's, you know, out of line of sight,
which I found fantastic
because if you ever snap mirrored
a big data set from NetApp,
like that's sort of an impressive thing
to have it come from space.
Anyway, I digress, as I often do.
So what I'm going to do now
is I'm going to power this down.
And since this drive is clicking,
it's basically the storm has powered it off
too many times where both the software
and the hardware are damaged.
I'm going to swap this out for one of my spare ones.
And then we're going to install FreeBSD.
So I'll walk you through it.
Okay, we have the new hard drive in.
We're going to boot up FreeBSD
and hope everything goes as planned
because if you ever work on home lab stuff,
it doesn't always go as planned.
So I'm just going to boot from USB.
And this is, if you haven't seen it,
this is the BTX bootloader.
All the BSDs use a BTX bootloader.
It's a lot different from Grub or Lilo
if you've used Lilo.
And if you haven't used FreeBSD before,
it's very fast.
Much, in a way that you might not expect
if you're in the Linux world.
So we're already booted up.
So I'll just walk you through the installer.
And the first thing they ask is about the key map.
I'm just going to hit the default.
I'm going to give it just a generic little name.
I'll call it FreeBSD NAS.
And it's asking, this is something new for FreeBSD 15.
They're asking if you want tech preview packages.
No, I don't.
The old stuff.
And then it asks, you know,
if you've ever installed Slackware
or something like that,
where it's sort of the older way of things,
they ask you which packages
that you want to install by default.
And they give you some options.
And I'm just going to pick exactly what's here.
I'm not going to make any changes.
Now it's asking for my card.
It's going to be the top one, the Realtek.
So it's getting the network now.
Usually these things are very easy.
I know a lot of people like the point and click stuff.
I'm not, I come from the world of,
you know, my computers when I was young,
there was no option of having a mouse.
So that's the world I came from.
There was nothing to click on
because everything you type.
Now it's asking which file system I want to use.
Of course, I'm going to pick the top one,
which is ZFS.
Some people still need UFS or FFS,
which is fast file system,
which is the old, old BSD file system.
But that being BSD and OpenBSD
actually still used by default.
But I'm going to pick ZFS
and now it's asking to make sure
that everything looks right.
It's going to call the,
basically, if you haven't worked with ZFS,
it organizes things into pools
because it's designed for massive storage arrays.
So it treats every disk
or every part of ZFS as a pool
that you can add and subtract this from.
It's not a good idea to subtract, but you can.
So it's treating this as a single disk
pool and a stripe.
You would call it a stripe if it was RAID,
but in this case, it's just a single disk.
So that's what they're calling it, a stripe.
No redundancy.
And it's asking me to choose the disk.
There's only one there.
So of course, I'm going to choose that one.
And it's making sure before I hit yes,
it's making sure if I want to destroy everything
because what it's going to do,
it's not just going to reformat it.
It's going to destroy the GPT partition
to make sure that there's no remnants
at the beginning and the end of the disk.
If you don't know anything about GPT partitions
and you only work with MBRs,
GPT has a little section at the beginning and the end.
So if there's corruption in one,
it can recover it from the other end and fix itself.
So it's destroying both first,
making a new GPT partition,
then it will install ZFS on it.
So you might notice if you ever acquire a disk
that was a part of a ZFS system
and you can't format it,
you can't get that ZFS off there,
that's the reason.
You have to actually destroy the GPT partition
all the way down to its core.
If you don't know how to do that,
you can leave it in the comments.
I'll instruct.
And usually formatting ZFS is very fast,
unlike other file systems.
See, it's done already.
Now it's asking me to choose the mirror.
I'm just going to hit the default mirror.
So this is sort of like a combination.
This installer is a combination,
in my opinion,
of the Slackware installer
and the non-GUI Debian installer.
It's closer to the Slackware
if you're more used to that.
And that's not by accident.
Slackware designed Slackware
to be the most BSD-like Linux out there.
And they were the second Linux distribution,
or at least the second
oldest surviving Linux distribution.
There were others back then.
Debian was first 1992.
Slackware was 1993.
All others that around that time have died off.
Okay, now it's asking me for my password.
Since I'm on video,
I'm just going to choose a throwaway password.
I'll fix it later.
And now it's asking for the time zone.
Pretty standard stuff here.
United States,
Eastern, most areas.
PST looks reasonable.
It absolutely does.
That is the correct date,
more or less.
That's the correct time.
And it's asking me which services.
I'm actually going to ask it
to sync NTP just in case
because I like having correct time.
I don't need anything else.
That last menu was security settings.
That's for a different video.
But FreeBSD actually is pretty good
with security if you don't know that.
That's why Juniper
and a few other companies,
but like Juniper specifically uses FreeBSD
for their JunOS operating system
which runs all of their networking,
their firewalls, their routers, their everything.
And now it's installing extra firmware packages
to run the hardware.
And it's asking to add any additional users.
So now we're at the stage
where it's like Debian.
And if you don't know this
on both Linux and BSD,
you want to add your user to the wheel group
if it's going to be doing
any elevated privilege stuff
because on some systems
you don't automatically get pseudo access
after you create the user.
So you want to do it manually.
So wheel is the group that you want for that.
And now it's asking which shell.
I end up liking the TC shell on FreeBSD.
It's just my preference.
You can change it to whatever shell you want.
It doesn't come with Bash.
That's one thing.
Bash is not by default.
Like you can install it from the ports tree,
but by default you don't have Bash
because Bash is, believe it or not,
it's not as good as the other shells.
If you don't know the other shells,
this is you have shell,
which is the born again shell.
I'm sorry.
The born shell is SH.
Then the Bash is born again shell.
You have C shell here, the TC shell.
There's also Z shell, corn shell.
Corn shell is actually my favorite
because OpenBSD was my main driver for years.
I got very used to the corn shell.
Anyway, I'm digressing too much.
Now it's asking if I want ZFS encryption.
That's very useful for certain systems,
but I'm going to skip that here.
Now it's asking for my password.
I mistyped.
That user creation,
the menu before was like Debian,
but this step is exactly like Slack.
Then we are done.
Now we're going to reboot.
I have the BIOS set,
so it should bypass the USB
and boot directly from the hard drive.
We just want to make sure everything works.
Okay.
Everything is set up
and let's check the state of everything here.
I'm going to log in SSH on my Mac.
This is what FreeBSD looks like when you log in.
It gives you a nice little message of the day.
You can read it.
It's very technical and helpful.
I know some of you like NeoFetch,
so that's the FreeBSD NeoFetch,
but I'm more interested in my data,
so I'm going to inspect that.
Okay.
See how the import went.
Actually, there was an issue,
probably because it came from Linux.
So the repartition is fine.
But it doesn't like my pool
that I'm pulling up from Linux,
so let's do some concrete to check that out.
I'm going to import one of these.
I'm going to import the second one manually.
Force it.
Nothing.
I'm sorry.
Okay.
All right.
So now the root file system
and the Samba file system.
See, this is what I was talking about with ZFX.
Even though it had a problem,
basically, the way that Linux handles naming system,
or disks, is way different
from the way that FreeBSD does.
So FreeBSD was having trouble
looking at both of them
and thinking that they were a part of the same group.
So I had to pull a little trick
to force it into doing it,
and now it's read-only,
so I can't write to it.
Let's make sure that all the data's there.
And it is, actually.
Yeah, everything looks there.
Let's check the size.
And it's 349 gigs out of basically 1.8 terabytes.
Yeah, that seems correct.
So that's what it looks like once set up.
So I have my data.
That's basically the video.
All I did was I took a file system
that was connected to my old Linux NAS,
and I imported it to FreeBSD.
No reformatting, no data loss.
And you can do this across systems.
It doesn't just work with Linux and FreeBSD.
It's gonna work with OmniOS.
It's gonna work with SmartOS, Triblix,
even NetBSD.
Wait, did I already say NetBSD?
Doesn't matter.
Anyway, you have all these different systems.
As long as they're ZFS compatible,
you can move your files across systems.
You don't reformat anything.
You don't have to move anything around.
And the thing with ZFS is,
as long as you know how to use the tools correctly,
and as long as you pay attention to the messages,
the chances of data loss are minimal.
And the things that you can do with ZFS,
for example, if I were to have
like a four or six drive pool,
the things that you can do with compression,
you can actually set up ZFS compression
where as soon as you save the file there,
it compresses it,
and it actually takes up less space.
I know you can do this on other RAID-style systems,
but the way that ZFS handles compression
is really incredible if you read into it.
Now, I do know that there are some Linux enthusiasts
who are very particular about the GPL.
And there has been some beef between Linux
and some microsystems about ZFS not using GPL,
it uses the CDDL.
I don't get caught up in all this politics.
For me, they're compatible enough,
and I have no problem using them together.
Some people are very particular about that.
But I mean, Ubuntu basically puts ZFS
into the operating system,
and they've been doing it for a long time now.
So I mean, choose your battle.
For me, ZFS has been very helpful.
It has prevented me from losing data many times,
which is why I've done this
because as much as I love Linux,
I was getting so nervous about the power
I was shutting off that I had to do it this way.
I've gone on long enough.
I tend to ramble.
It's my thing.
So if you have any questions,
leave them in the comments.
Thank you.
