# Install FreeBSD 9.2 on ZFS root : export/import?



## strider (Nov 26, 2013)

Hi,

I'm fairly new to freebsd FreeBSD so I apologize if this question seems stupid  :OOO 

I'm currently experimenting with installing Freebsd FreeBSD within VirtualBox in order to prepare an installation on 'bare metal' on my machine in the near future. Since this machine is already a dual boot between Windows and Arch Linux, I want to properly prepare my installation. I also want to install into ZFS because I'm tinkering with the idea of making a mediacenter/NAS based on Freebsd FreeBSD later on and I want that to have ZFS on it. On my current machine I have three internal drives so I can fully see what the advantages of ZFS are (it*'*s not the kind of installation with ZFS on a single drive, which according to me does not have that much added value ). 

So I read the wiki for installing root ZFS on an MBR slice (this is and older PC without GPT):  https://wiki.freebsd.org/RootOnZFS/ZFSBootPartition

I also read a lot of man pages on gpart, ZFS and so on and equally start reading the 'Absolute freebsd FreeBSD' (yep I'm properly preparing  :stud). However there is one step in the installation I do not understand. Before installing the bootcode (stage 1 and stage 2) the ZFS pool is exported and afterwards it's imported. Why the heck is that?

Thanks in advance*.*


----------



## J65nko (Nov 27, 2013)

I also wonder what is the purpose of that import/export 

In Root On ZFS @ FreeBSD 9 an export/import ritual is performed  to force ZFS to align on a 4K sector boundary.

BTW although not advisable in some dual or triple boot scenarios, it is not a problem to use GPT partitions on non-GPT/UEFI systems if you install a protective MBR (pmbr) with something like this: `# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0`


----------



## ShelLuser (Nov 27, 2013)

First of all using ZFS on a single drive also comes with great advantages. You're overlooking the issue that when you're using ZFS all your slices can become dynamic (provided you're using separate ZFS filesystems). So for example; depending on your setup there doesn't have to be any danger of /var becoming filled up because you didn't anticipate for the disk usage and assigned too much on /usr/local or /usr.

As to the export/import... Note that I'm not basing this on official documentation, merely on my experience with this environment. It's an optional step because everything you specify isn't specific to both used operations (creating the pool/filesystem and importing it). I always picked this up as an extra check to make sure that your system recognizes the pool and can automatically import it.


----------



## SirDice (Nov 27, 2013)

J65nko said:
			
		

> I also wonder what is the purpose of that import/export
> 
> In Root On ZFS @ FreeBSD 9 an export/import ritual is performed  to force ZFS to align on a 4K sector boundary.


No, the import/export is done to create a valid zpool.cache file. Which shouldn't be needed any more on 9.2 and higher. In case of the howto mentioned it's also done to get rid of the gnop virtual drives. Importing/exporting doesn't change anything on the filesystem itself, so it's not used to 'force' the filesystem to align on a 4K boundary.


----------



## ShelLuser (Nov 27, 2013)

SirDice said:
			
		

> No, the import/export is done to create a valid zpool.cache file.


That is interesting because the option to create a cachefile can also be used when creating a pool. That's what made me conclude that this option was a little bit redundant.


----------

