# how to put system and /home on separate drives?



## unc (Apr 11, 2021)

Long term Linux user here (with stress on _user_). Been keeping an eye on FreeBSD for a while. With 13.0 around the corner, I think I'm finally ready to make the switch, especially since afaik 13.0 will offer fairly complete hardware support for my Thinkpad E570.

Before I get started, I have a question, though. I have a setup with 2 hard drives, one SSD and one actual "spinning disk" one. I would like to put the system install on the SSD, and the /home partitions/slices on the HD. What would be a good approach to achieving this (with a fresh install)? Also, am I correct in assuming that I probably want to be using UFS in this case, and not ZFS? I've read this, but still can't quite wrap my head around it.


----------



## SirDice (Apr 12, 2021)

Just do the install on the SSD first. Don't create a user during the installation. Add the other disk when the system's installed and booted. It's much easier to do. Not creating the user during the install will also make sure /home is empty, so there's nothing to move around. 



unc said:


> Also, am I correct in assuming that I probably want to be using UFS in this case, and not ZFS?


Irrelevant. You can create two pools, one for each disk. Don't mix SSDs and HDs on the same pool though (unless you use the SSD as L2ARC or ZIL).


----------



## unc (Apr 12, 2021)

Thanks, very clear!


----------



## VladiBG (Apr 12, 2021)

You can create a mount point for /usr/home on the HDD during the installation. It will look like this under UEFI boot.
This is VM so ignore the size information of the partitions. The actual mount point is /usr/home not visible on the picture below






After the installation it will look like this:


----------



## Jose (Apr 12, 2021)

These are my quick notes on how I did it when I created a large ZFS array:


```
zpool create zfspool raidz2 da0 da1 da2 da3 da4 da5
zfs create zfspool/home
cp -rp /home/* /zfspool/home
rm /home
mv /usr/home /zfspool/home/backup
ln -s /zfspool/home /home
ln -s /zfspool/home /usr/home
```

I ran `rm -rf /zfspool/home/backup` when I was happy with the new home directories.


----------



## mefizto (Apr 12, 2021)

Hi VladiBG,

at which part of the install process  do you get to that screen so that you can select a different drive?

Kindest regards,

M


----------



## unc (Apr 12, 2021)

Thanks for your advice, VladiBG and Jose. It's probably going to be a couple of weeks before I get around to setting up FreeBSD on my machine, but I'll report back here once I'm done.
One thing I'm still torn about is whether I should use UFS or ZFS. Been reading up on this here and there. The higher RAM demands of ZFS don't concern me that much, but I'm worried that ZFS will be just a bit too alien for me, considering I'm not exactly a computer wiz.


----------



## Jose (Apr 12, 2021)

Try ZFS you'll never go back to the old way of dealing with disks, partitions, etc. Super clean and logical separation of concerns.


----------



## VladiBG (Apr 12, 2021)

mefizto said:


> at which part of the install process do you get to that screen so that you can select a different drive?


During partitioning when you select between UFS, Manual, Shell, ZFS.  When you select for example Auto (UFS) at the next screen you have option to add additional partitions on other hard disk, to select the partition type, and mountpoint. 









						Chapter 2. Installing FreeBSD
					

Guide about how to install FreeBSD, the minimum hardware requirements and supported architectures, how to create the installation media, etc




					docs.freebsd.org


----------



## jardows (Apr 12, 2021)

I did something like this on my home server, and I used ZFS.  I have a couple of small hard drives mirrored for the system, then a couple of large drives mirrored for /usr/home.  It's been a while, and I didn't document my process (bad jardows!) but I do remember I setup the whole system on the smaller drives first, then later connected the large drives, mirrored them, and moved the /usr/home to a dedicated zpool on those drives.  It wasn't that complicated, though setting it up using UFS during install (especially since you're not mirroring anything) may be much more simple.


----------



## mefizto (Apr 12, 2021)

Hi VladiBG,

thank you.

Kindest regards,

M


----------



## decuser (Apr 13, 2021)

unc said:


> Thanks for your advice, VladiBG and Jose. It's probably going to be a couple of weeks before I get around to setting up FreeBSD on my machine, but I'll report back here once I'm done.
> One thing I'm still torn about is whether I should use UFS or ZFS. Been reading up on this here and there. The higher RAM demands of ZFS don't concern me that much, but I'm worried that ZFS will be just a bit too alien for me, considering I'm not exactly a computer wiz.


In my opinion, ZFS is the easier, more flexible choice. The learning curve is pretty small compared to the gain in flexibility and power. If you know what a partition is (and you surely do, if you have used Linux a while), you already know some details that are not really needed for ZFS. Yes, ZFS is uber powerful and has many, many advanced features, but for the basic setup of put a filesystem on my disk, manage it, snapshots and so on, it's drop dead easy and you gain boot environments which are useful for risk-free upgrades (although I saw Vermaden's boot environments for UFS, so that may not be as big a differentiator as it was).

If you choose ZFS on boot during the install, it's pretty much set it and forget it unless you want to add disks or make changes, then it's super easy to do those changes.


----------



## grafi (Jul 11, 2022)

decuser  Im kindly and most politely disagree with following part of your last statement



> If you choose ZFS on boot during the install, it's pretty much set it and forget it unless you want to add disks or make changes, then it's super easy to do those changes
> *then it's super easy to do those changes*



Every tutorial i have found including bsd handbook is focused on auto installation or manual installation while you using 1 physical hdd or sdd.
As long i make my partition on 1 physical drive it is all good. If i want to poot os on ada0 and user space on ada1 then crazy things start to occure.
God forbid to put home in a fashion of /home (linux kinda way) not /usr/home (standard bsd way) on separate drive during install.
If i only could view how the auto partitioning name and set the partitions I would even not write this post.
How on earth I can put  my home or at last /usr with all what is in it on second separate drive
Let say i have 120GB ssd and 2TB HDD
When i go manual partitioning zfs during install  i end up with.
after 5 days im sick of it


----------



## zirias@ (Jul 11, 2022)

grafi said:


> As long i make my partition on 1 physical drive it is all good. If i want to poot os on ada0 and user space on ada1 then crazy things start to occure.
> God forbid to put home in a fashion of _/home_ (linux kinda way) not /usr/home (standard bsd way) on separate drive during install.


I have all my users' home dirs in /home which is mounted via NFS and never had any issues, neither with new installs nor with upgrades.


grafi said:


> When i go manual partitioning zfs during install i end up with.
> after 5 days im sick of it


Instead of ranting and posting a screenshot that only shows it's "broken", maybe open a new thread, describe exactly what you did (including `gpart` output, /etc/fstab and whatever else is relevant, so people can actually help you, pointing out what exactly is wrong?


----------



## mefizto (Jul 11, 2022)

Hi Zirias,

could you check your p.m.?  I have a question regarding your NFS setup, but do not want to derail this thread.

Kindest regards,

M


----------



## mer (Jul 11, 2022)

grafi Going by memory since it's been a long while, this is how you do it after the fact:

zfs is datasets.  the installer by default create a dataset named user/home:
zroot/usr/home               24.6G   179G     24.6G  /usr/home
making sure noone is logged in or using /usr/home/username, so 
as root from a console you use zfs commands to rename the existing zroot/usr/home dataset something like 
    zfs rename zroot/usr/home zroot/usr/home.ORIG
use zfs commands to change the mountpoint, something like
     zfs set mountpoint=/usr/home.ORIG zroot/usr/home.ORIG

then assuming your second device is hooked, you use gpart to set it up, set gpt scheme on it, create a partition of type freebsd-zfs, make sure you align and label it as something like "zfs1" or something meaningful
then simply use zfs commands to create a new pool on that partition
     zpool create storage gpt/zfs1 or ada1p1  (of course you use your correct label and device names)
then create your new user/home dataset:
     zfs create storage/home
set the mountpoint to /usr/home
     zfs set mountpoint=/usr/home storage/home

Now you have your home directories on a different device.   If you have data in your existing user directories, many ways to copy it over a simple way would be to use tar piping through stdout/stdin.  Or rsync or cp -R /usr/home.ORIG /usr/home.
One could also use zfs send/zfs receive if desired.  I find that for a home user system with a single or couple of users, cp or tar works good enough.

The installer you would need to drop to a shell at some point and do the partitioning and zpool and dataset creation by hand, pay attention to the mount points, lots of things to keep track of.
That is why people suggested do the install on a single disk, do not create a user, simply get the system up and running.  Then you do what I've outlined here, since there are no user directories yet, nothing to copy.

ZFS I learned you want to get yourself copies of the following books by Michael W Lucas:
FreeBSD Mastery: Storage Essentials
FreeBSD Mastery: ZFS (with Allan Jude)
FreeBSD Mastery: Advanced ZFS (with Allan Jude)
Pretty much any "How do I do this" question on ZFS I've ever had are answered in them.


----------



## grafi (Jul 12, 2022)

Do not get me wrong but mate! I love you 
Thank You a big time. I will save your post and try to play with zfs.
I'm kinda fed up with Linux  and the direction in which Linux as a whole is going.
Since I'm on Linux for very long time, the only logical option for me is FreeBSD or BSD in because it is unix and linux, is unixLIKE system.
Cannot thank you enough 
Take care and have great day


----------

