# Installing FreeBSD in an existing ZFS pool



## STREBLO (Jan 22, 2016)

I'm setting up my desktop was hoping to be able to dual boot Arch Linux with FreeBSD under the same ZFS pool. is it possible to install FreeBSD into an existing dataset if I already have Arch Linux installed? I was looking at this Gentoo link and wondering if something similar was possible.

I plan to set up a mirror of two 480GB SSDs for my root and home directories on FreeBSD and Linux, as well as have a mirror of two 2TB HDDs in another vdev. Currently I only have one of the SSDs and I was wondering if it would be okay too start the setup on the single SSD and then attach the other SSD to turn it into a mirror later.

I was also wondering about what would be a proper setup to be able to use a single pool with more than one operating system. Here's what I'm thinking, would it make sense to do something like this?

LINUX and FREEBSD are different datasets


```
# SSD Mirror:
        pool/LINUX/
        pool/FREEBSD/

# other vdev 2TB mirror
        pool/data

# ext2 partition on first SSD with grub
        /boot
```

I was also wondering about the bootloader. I'm going to be setting this up using UEFI and I guess grub seems to be the bootloader with the most support on both operating systems. I've been seeing some things about how using as ZFS boot partition can cause problems so I was planning on using an ext2 partition on the first SSD, then partition the rest then mirror that partition with the other SSD.

So the disks would be


```
SSD1
        - ext2 partition
        -ZFS partition

SSD2
        -ZFS partition
```


Then mirror SSD1 ZFS partition with SSD2 ZFS partition.

Is it okay to mirror an entire drive with the partition of the SSD? Is there a better place for me to put the boot loader so that I can mirror two entire drives? Or does not really matter and I will just be losing that little bit of space as a partition is partition.


----------



## ANOKNUSA (Jan 22, 2016)

FreeBSD and Linux implement ZFS and manipulate its features in fundamentally different ways. I don't know if it's possible for them to share a zpool, but it's certainly a very bad idea.


----------



## STREBLO (Jan 22, 2016)

ANOKNUSA said:


> FreeBSD and Linux implement ZFS and manipulate its features in fundamentally different ways. I don't know if it's possible for them to share a zpool, but it's certainly a very bad idea.


Really... That's too bad, I thought that was the whole point of OpenZFS, they are compatible as long as you stay on the same version? So what's recommended would be making another GPT partition and another zpool? Is the reason that it was able to be done with Gentoo is that they are doing something behind the scenes ?


----------



## ANOKNUSA (Jan 22, 2016)

STREBLO said:


> ...I thought that was the whole point of OpenZFS, they are compatible as long as you stay on the same version?



The point of OpenZFS is to continue open-source ZFS development from a point before Oracle locked down the code. FreeBSD has been integrating ZFS into its base system since before that time, while Linux has only recently gotten a more "native" implementation. And things brought into the FreeBSD base system are more tightly integrated with other base components than what you'll find in the typical Linux distribution. The FreeBSD devs do currently pull code from and contribute it to OpenZFS, but FreeBSD, Linux, Solaris, and Illumos all have different means of utilizing ZFS filesystems. On FreeBSD, on-disk block size/alignment, minimum and maximum ARC size, transfer rates, TRIM, and other tweaks are all governed by kernel options that wouldn't be compatible with any other OS, and the same would be true for the Linux ZFS kernel module. Sure, I you should be able to import and mount a zpool made in one OS on another OS to transfer files without any trouble, but actually installing and running one OS on a filesystem created by a different OS is always a bad idea, be it ZFS or anything else.



STREBLO said:


> So what's recommended would be making another GPT partition and another zpool?



There's nothing inherent to ZFS preventing that, but at present FreeBSD cannot boot a root-on-ZFS system from UEFI, and requires a patched version of GRUB to dual-boot a FreeBSD system on a disk with another OS. Also, while it's easy to mirror individual partitions on separate disks, I don't know what that having two different zpools from two different operating systems running intermittently might mean for the life of your SSDs. I'd like to think there wouldn't be any substantial wear, but I'm hardly an expert.



STREBLO said:


> Is the reason that it was able to be done with Gentoo is that they are doing something behind the scenes ?



I don't see any mention in that Gentoo wiki article of running anything but one Gentoo system on one zpool written to one disk, and it was done with a custom LiveCD.


----------



## tobik@ (Jan 22, 2016)

ANOKNUSA said:


> at present FreeBSD cannot boot a root-on-ZFS system from UEFI


Soon with FreeBSD 10.3: https://svnweb.freebsd.org/base?view=revision&revision=294068


----------



## STREBLO (Jan 22, 2016)

ANOKNUSA said:


> The point of OpenZFS is to continue open-source ZFS development from a point before Oracle locked down the code.


I wasn't saying that was all that the OpenZFS projects was doing, I realized the project is about a lot more than just making different systems compatible, but that is part of what it does. It brings compatibility between all the different versions on the different operating systems and makes sure the effort people put into writing code isn't being repeated.



ANOKNUSA said:


> There's nothing inherent to ZFS preventing that, but at present FreeBSD cannot boot a root-on-ZFS system from UEFI, and requires a patched version of GRUB to dual-boot a FreeBSD system on a disk with another OS.



I'm pretty sure there's code going in the next release of FreeBSD so I might just wait till then, otherwise I think the FreeBSD Server install of PC-BSD they call TrueOS has the patch so I might just have to use that end for now if the patch doesn't go in next release.



ANOKNUSA said:


> I don't see any mention in that Gentoo wiki article of running anything but one Gentoo system on one zpool written to one disk, and it was done with a custom LiveCD.



Sorry, I posted the wrong link. Here is the proper one.


----------



## phoenix (Jan 22, 2016)

You can (and many people do) use the same ZFS pool with FreeBSD and Linux (or illumos or Delphix or any other OpenZFS-using OS).  You just have to do your homework before you create the pool, and find out which ZFS features each of the OSes support, and enable only the features they all support, and disable all the features that are unique to individual OSes.


----------



## STREBLO (Jan 23, 2016)

phoenix said:


> You can (and many people do) use the same ZFS pool with FreeBSD and Linux (or illumos or Delphix or any other OpenZFS-using OS).  You just have to do your homework before you create the pool, and find out which ZFS features each of the OSes support, and enable only the features they all support, and disable all the features that are unique to individual OSes.


Ahhhhh I thought so! That's kinda why I was going to install it on Linux first, it's typically further behind FreeBSD with ZFS.


----------

