Reinstalling FreeBSD while preserving contents of home directory.

why do you want to reinstall? What is broken?
Speaking by my own experience:
When you are new to a system, and decide to dig deeper into it, after your first steps you learned a couple of things about it, which includes done things not perfectly right, or even wrong, simply by experimenting, still not knowing better, doing things which later turn out better be done otherwise or not at all ... - aka learning - your first installation(s) at a certain point just feel messed up, botchy, even if it's not.
It simply feels better to give it a new, fresh, clean start with a clean, fresh, new installation.

To judge if it's really messed up irreparable also needs some experience like cleaning/repairing a messed up system. If there is nothing of value on it, it's just way quicker and easier to simply reinstall, plus it gives you the feeling of having a clean, proper system in order, you can trust in.
Repair and rescue a messed up system before you consider reinstallation is something also need to be learned, yes, sure. But that comes when the system is of some value, contains work put into it: /home contains some stuff, a lot many software packages installed, several config files edited. But when you are new to a system, there are so many things to learn, and so many more things to learn first before to learn how to rescue/repair a system that does not contain any value, yet.

Plus reinstallation is always a good chance to reconsider things like drives, partition tables, or filesystem.
I believe I'm not the only one when I came to FreeBSD once I had some experiences with Linux and the idea about must have it all distributed over several partitions, bothered a lot about how to partition the disk(s), where to put what etc.. Even if all this partitioning trouble (still) made sense, I'd rather chose separate drives or pools. We are not in the 90s anymore, where additional storage space cost real money. You can get a 1TB HDD for under 30 bucks (thirty, not three hundred nor thousand.) Anyway you may come to the conclusion the partition scheme you've chosen was anything but perfect: /home too small, /tmp and /var way too large. Or you come to the conclusion, all this partitioning is BS anyway. boot, EFI, swap and / is all what's needed on a single drive system. Personally I don't see no sense in having an extra partition for /home, /var or /tmp on the same physical drive, but there can be reasons. IMO better give /home a drive/pool of its own when the machine provides the space for another drive, and place /tmp into a RAM disk (very simple, see HB. [This one was for other readers not knowing this yet, of course not you, cracauer@.:cool:])
The classic: swap = 2xRAM. BS! Total overkill. Comes from times machines had 2G RAM or less. Obsolete. But I learned that later. My very first FreeBSD installation had a 64G swap partition! I'm pretty sure it stayed totally virgin, never saw a single 1️⃣ in its whole life. 😂
 
i never reinstalled though i installed freebsd on hundreds of boxes but mostly servers/routers. one time i upgraded a bunch of 4.x hosts to 6.x remotely without serial console or ipmi or anything.
they were tens to hundreds of km away and without anybody speaking unix near them.
4.x rootfs was too small to fit a 6.x root fs. also there was a single drive in this boxes. can't remember how i exactly i hacked the partitions but i had a script at the top of /etc/rc that hacked the disklabel (everything was mbr + 'slices' + bsd partitions back then) before going multiuser unpacked 6.x and rebooted to 6.x. of course it was tested locally before.

people upgraded via cvsup/make world back then, there were no binary upgrades (well there was tar :))
major upgrades usually needed a visit to single user mode
 
people upgraded via cvsup/make world back then, there were no binary upgrades (well there was tar :))
major upgrades usually needed a visit to single user mode

I don't know for sure but I've heard it was only necessary on one specific update decades ago. People used to justify it more generally on the grounds that when you boot into a new kernel ABI, pretty much any userland binary can fail, so you might want to defer starting any daemons at that point. I can't see how anything changed in this area with freebsd-update.

The official instructions are written for in-place upgrades, but with ZFS you can update into a mounted BE and make it self consistent before rebooting - in my experience this works by default without following update instructions for ABI workarounds. The other advantage is that it can't affect the running system, so the update can be done in the background without any downtime, apart from one reboot, which can be deferred. In desktop use there's no need to disable kernel module loading in rc.conf if the kmod packages have be updated.

There may be a flaw in this I'm not seeing, but it seems a better way, and it's very scriptable.
 
The classic: swap = 2xRAM. BS! Total overkill. Comes from times machines had 2G RAM or less. Obsolete. But I learned that later. My very first FreeBSD installation had a 64G swap partition! I'm pretty sure it stayed totally virgin, never saw a single 1️⃣ in its whole life. 😂
My understanding is that 2xRAM came from a time when 1xRAM of free swap space was needed for a crash dump.
 
My understanding is that 2xRAM came from a time when 1xRAM of free swap space was needed for a crash dump.
The originally idea of swap space is just to have more working memory than the machine provides by (expensive) RAM.
The machine keeps working even if there is more programs and data loaded into working memory as there is RAM. It's (way) slower, but it keeps working.
Today swap is mostly a reserve for "emergency", exceptions, when short term situations lead to more RAM is requested/needed than the machine provides. The machine becomes (significantly) slower, but keeps working and does not crash. Already with 32G quasi all today's machines provide (way) more than enough RAM for the common daily single user desktop tasks. If you are doing often jobs using such large amounts of RAM a common machine would get to its limits - it swaps - in general you should know that you are doing this, respect this fact, and better give your machine a sufficient amount of RAM. The 8G the FreeBSD installer suggests by default are for the most single user desktop machine cases way more than enough reserve. But 1xRAM or even 2xRAM as swap is too much sinply not needed. If your machine becomes slow on certain jobs you check your swap to see if it runs out of RAM. If this is the case you decide either to live with the situation, reduce the machine's load, or enlarge your RAM. But you don't fumble with swap space. Today you don't rely anymore on swap being a normal part of your working memory.
War story:
Back in the 1990s, when Windows machines became widespread, on software packages including MS Windows there was not only written in their specs, which CPU and OS was needed to run it, but also minimum and recommended RAM. Of course most bought the cheapest possible machines. Which not only means not chosing the fastest, most powerful most recent CPU, because those were brutally expensive (this didn't change), small harddrive, but above all just the bare minimum of RAM. At the same time back then Windows was already capable to let you start as many programs as you wish at the same time. This was proudly presented as a very new technical breakthrough, named multitasking.😂 Of course, you couldn't work with them all at the same time. At least not on a MS Windows machine. On Unix, Amiga OS et al real multitasking was an old story. [Boy, what I missed my Amiga 2000 when I changed to this W95 junk.] You had to switch between the applications, which was done by a delay. This could last between a few fractions of a second up to minutes (yes, sometimes you could got yourself a coffee until the machine finished swapping), depending on what you loaded and how much RAM you machine had. Almost constant access to swap was quite normal back then. Working with a Word document of half a dozen pages with some pictures and tables not seldom was already enough to bring a common machine to its limits. Because everybody not being in computers really never listens to such "freaky hacker stuff" like, 'reduce the size of the pictures first', 'you need to close other applications to disburden your working memory', 'you need more RAM', or, 'Be patient. Just wait! DON'T PRESS THE RESET BU...!!! -' *sigh* Complaining their machine became so very instable, and they lost data, and, 'Yes yes. I will do backups. Promised. But later. Now I have no time for that computer freak's stuff!'
Those were the "good" old days.:mad:🤪
MS reacted on that - they know their customers:
Backups is still some unkown foreign word from the black magic those weird nerds, geeks and hackers celebrate in the deepest depths of their dark dungeons, but nothing sophisticated nobles get their hands dirty on. Hence clouds. Now the better ones complain, there is so much spying on them, and nothing works anymore when a cloud server fails. *sigh* The curse of the knowing ones is to live among ignorant ones immovably convinced being the smart ones.😔

But having enough space for core dumps can be still the case today.
By default not the whole memory is dumped. If you experienced a core dump with default config you may have already seen it's a lot smaller than the RAM you have. But if you want a full dump you can tell dumpon(8) where to write it to. So you don't need to have an oversized swap just for this occasion.
 
As DRAMs became quite expensive because of AI/LLM bubble, possibly swaps beyond 2x of RAM could be regularly needed.
Yeah, I did not take that in account.
But, then you have to put it onto real fast drives, which are also not that cheap, reduce the machines load, or we are back, where we were in the 90s: swapping like hell. And many of the "youngsters" have no idea how annoying computering can become, when there are permanently significant lags of different length, and no smooth computering as we are used to today. 🥸
 
Yeah, I did not take that in account.
But, then you have to put it onto real fast drives, which are also not that cheap, reduce the machines load, or we are back, where we were in the 90s: swapping like hell. And many of the "youngsters" have no idea how annoying computering can become, when there are permanently significant lags of different length, and no smooth computering as we are used to today. 🥸
Maybe Rust guys need reconsidering their approach, NOT to build monolithic huge applications, but reduce memory footprint as small as possible by dynamically linking by default to share as much as possible. Back to Unix way. 😁 Or more aggressively, say, OS-9 way.
 
As DRAMs became quite expensive because of AI/LLM bubble, possibly swaps beyond 2x of RAM could be regularly needed.

I'd say any machine actually using 1x RAM swapspace would be catastrophically slow.

Keep in mind only read-write and anonymous pages are ever moved to swapspace. The rest is just dropped and then reloaded from the original filesystem location.

So by the time swapspace is used heavily all your readonly content is already gine, and that includes the actual program code for languages like C and C++.
 
Keep in mind only read-write and anonymous pages are ever moved to swapspace. The rest is just dropped and then reloaded from the original filesystem location.

So by the time swapspace is used heavily all your readonly content is already gine, and that includes the actual program code for languages like C and C++.
It's not quite that bad; file backed pages can't be discarded as long as they remain in the active queue, and that's (more or less) an MFU queue, which make it good at retaining the core resident set.
I don't know if they still exist, but FreeBSD had/has sysctls for swapping idle processes (I believe it actually just deactivated them). The main use case for this was login servers where most of the user processes aren't actively used. In that sort of scenario there is no clear limit to swap use.

My experience on desktops was that up to about 40% it didn't make much difference, but performance rapidly degraded beyond that. However, there was a time when Firefox builds momentarily used a huge amount of memory and my computer would lock-up for a couple minutes, but it would fully recover. It only lasted a month or so, but having an unreasonable amount of swap got me through that without paying for ram I wouldn't have otherwise needed.

There are a couple of other uses for large amounts of swap; one is backing tmpfs, the other is soaking up memory leaks. Obviously whatever is using tmpfs will be affected, but it preserves the performance of the rest of the system.
 
Back
Top