FreeBSD root on ZFS, mirror, Recovery from non booting system / lost hard drive

Hello everyone,

It is a first time I would like to work with ZFS. So I have plenty of silly questions. Sorry...
I read this FreeBSD Handbook part about ZTF which I found quite nice. Now back to business.

I have two 1TB Hard drives, and I'm would like to build RAID 1 (mirror).


1. Is it a good idea to make root file system on zfs in a first place?

2. Here is a file system that is created by a FreeBSD installed on ZFS mirror:
Code:
# gpart show
=>        40  1953525088  ada0  GPT  (932G)
          40        1024     1  freebsd-boot  (512K)
        1064         984        - free -  (492K)
        2048     8388608     2  freebsd-swap  (4.0G)
     8390656  1945133056     3  freebsd-zfs  (928G)
  1953523712        1416        - free -  (708K)

=>        40  1953525088  ada1  GPT  (932G)
          40        1024     1  freebsd-boot  (512K)
        1064         984        - free -  (492K)
        2048     8388608     2  freebsd-swap  (4.0G)
     8390656  1945133056     3  freebsd-zfs  (928G)
  1953523712        1416        - free -  (708K)

lets assume I lost disk ada0, and I have spare disk ada3, what step should I take to restore functionality on non booting system? With GMIRROR it was quite easy: gmirror forget / gmirror insert.

Thanks in advance.

PS:
Sorry, if my questions sounds too silly...
 
1. Is it a good idea to make root file system on zfs in a first place?
Absolutely. ZFS on FreeBSD has become quite reliable and robust. I've been using this for a long time already, even had to cope with failing hardware and other issues. ZFS never failed me.

lets assume I lost disk ada0, and I have spare disk ada3, what step should I take to restore functionality on non booting system? With GMIRROR it was quite easy: gmirror forget / gmirror insert.
You'd be looking at # zpool detach and # zpool attach, see also zpool(8). I still use gmirror on an older server and well... it's somewhat comparable.

Just don't forget to bootstrap the second disk as well (using gpart(8)) so that both disks will be bootable. That can help you to get the system up quickly in case your primary boot disk would fail for some reason.
 
Just don't forget to bootstrap the second disk as well (using gpart(8)) so that both disks will be bootable. That can help you to get the system up quickly in case your primary boot disk would fail for some reason.

So, you mean I have to manually create / prepare file system on the new disk first, before zpool staff right?

And another question, is the ZFS so memory hungry as it described? 1 GB of RAM for every 1 TB of storage, and !!! 5 GB of RAM per TB of storage to be deduplicated .... Which sounds quite scary to me :)
 
So, you mean I have to manually create / prepare file system on the new disk first, before zpool staff right?

:)
^^ This. FreeBSD could use a comprehensive flowchart as a
simpler form of the twenty (?) odd use cases where ZFS can
handily be more useful than UFS2, so that newbies such as I
do not ask and re-ask questions and have a written centralized
two disks left side >> use case right side flowchart where
problems/solutions are presented in box style, leaving the
threads shorter. [ in this case, the freebsd.org wiki
ZFSQuickStartGuide could be a starting point, I found out
midway after this post was finalized... so just leaving
this post up as sort of helpful. ]
 
So, you mean I have to manually create / prepare file system on the new disk first, before zpool staff right?
Sort off. The current FreeBSD installer supports ZFS so basically all you have to do is follow its lead. But yes, just like any other filesystem you need to set it up.

(very) Generally speaking ZFS is pretty much the same as any other filesystem when it comes to setting it up. You need to dedicate a slice ('partition') for it and then you can use it. Instead of using newfs you'd use zpool create (simplified).

The major difference is with its usage. Where a normal filesystem is "just that" (one section of dedicated space) ZFS allows you to split up the dedicated space into multiple filesystems.

This is of course keeping things very simplified because there's a little more to it than that, but just trying to clear things up a bit.

And another question, is the ZFS so memory hungry as it described? 1 GB of RAM for every 1 TB of storage, and !!! 5 GB of RAM per TB of storage to be deduplicated ....
ZFS usage is quite memory intensive. But do keep in mind that the memory requirements depend a lot on the size of your ZFS pool(s).

Also: deduplication is usually turned off. It has its uses but normally the default settings are more than enough.
 
ShelLuser, Thank you so much, now its clear for me, I'm creating a pool not from a disk (in case of root fs on a single hard disk) but from a partition say ada0p3, the boot code and swap partitions can be sacrificed in case of disk damage...

It will be a good idea to have a dedicated disk/flash to start boot from and OS root file system on the entire hard drive ...
 
Back
Top