
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.funtoo.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.funtoo.org/api.php?action=feedcontributions&amp;user=Ryao&amp;feedformat=atom</id>
		<title>Funtoo Linux - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://www.funtoo.org/api.php?action=feedcontributions&amp;user=Ryao&amp;feedformat=atom"/>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Special:Contributions/Ryao"/>
		<updated>2013-05-24T21:33:41Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.20.6</generator>

	<entry>
		<id>http://www.funtoo.org/wiki/ZFS_Install_Guide</id>
		<title>ZFS Install Guide</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/ZFS_Install_Guide"/>
				<updated>2013-03-18T11:23:34Z</updated>
		
		<summary type="html">&lt;p&gt;Ryao: Update description to be consistent with my latest btrfs knowledge.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This tutorial will show you how to install Funtoo on ZFS (rootfs). This tutorial is meant to be an &amp;quot;overlay&amp;quot; over the [[Funtoo_Linux_Installation|Regular Funtoo Installation]]. Follow the normal installation and only use this guide for steps 2, 3, and 8.&lt;br /&gt;
&lt;br /&gt;
=== Introduction to ZFS ===&lt;br /&gt;
&lt;br /&gt;
Since ZFS is a new technology for Linux, it can be helpful to understand some of its benefits, particularly in comparison to BTRFS, another popular next-generation Linux filesystem:&lt;br /&gt;
&lt;br /&gt;
* On Linux, the ZFS code can be updated independently of the kernel to obtain the latest fixes. btrfs is exclusive to Linux and you need to build the latest kernel sources to get the latest fixes.&lt;br /&gt;
&lt;br /&gt;
* ZFS is supported on multiple platforms. The platforms with the best support are Solaris, FreeBSD and Linux. Other platforms with varying degrees of support are NetBSD, Mac OS X and Windows. btrfs is exclusive to Linux.&lt;br /&gt;
&lt;br /&gt;
* ZFS has the Adaptive Replacement Cache replacement algorithm while btrfs uses the linux kernel's Last Recently Used replacement algorithm. The former often has an overwhelmingly superior hit rate, which means fewer disk accesses.&lt;br /&gt;
&lt;br /&gt;
* ZFS has the ZFS Intent Log and SLOG devices, which accelerates small synchronous write performance.&lt;br /&gt;
&lt;br /&gt;
* ZFS handles internal fragmentation gracefully, such that you can fill it until 100%. Internal fragmentation in btrfs can make btrfs think it is full at 10%. Btrfs has no automatic rebalancing code, so it requires a manual rebalance to correct it.&lt;br /&gt;
&lt;br /&gt;
* ZFS has raidz, which is like RAID 5/6 (or a hypothetical RAID 7 that supports 3 parity disks), except it does not suffer from the RAID write hole issue thanks to its use of CoW and a variable stripe size. btrfs gained integrated RAID 5/6 functionality in Linux 3.9. However, its implementation uses a stripe cache that can only partially mitigate the effect of the RAID write hole.&lt;br /&gt;
&lt;br /&gt;
* ZFS send/receive implementation supports incremental update when doing backups. btrfs' send/receive implementation requires sending the entire snapshot.&lt;br /&gt;
&lt;br /&gt;
* ZFS supports data deduplication, which is a memory hog and only works well for specialized workloads. btrfs has no equivalent.&lt;br /&gt;
&lt;br /&gt;
* ZFS datasets have a hierarchical namespace while btrfs subvolumes have a flat namespace.&lt;br /&gt;
&lt;br /&gt;
* ZFS has the ability to create virtual block devices called zvols in its namespace. btrfs has no equivalent and must rely on the loop device for this functionality, which is cumbersome.&lt;br /&gt;
&lt;br /&gt;
The only area where btrfs is ahead of ZFS is in the area of small file&lt;br /&gt;
efficiency. btrfs supports a feature called block suballocation, which&lt;br /&gt;
enables it to store small files far more efficiently than ZFS. It is&lt;br /&gt;
possible to use another filesystem (e.g. reiserfs) on top of a ZFS zvol&lt;br /&gt;
to obtain similar benefits (with arguably better data integrity) when&lt;br /&gt;
dealing with many small files (e.g. the portage tree).&lt;br /&gt;
&lt;br /&gt;
=== Disclaimers ===&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This guide is a work in progress. Expect some quirks.}}&lt;br /&gt;
{{fancyimportant|'''Since ZFS was really designed for 64 bit systems, we are only recommending and supporting 64 bit platforms and installations. We will not be supporting 32 bit platforms'''!}}&lt;br /&gt;
&lt;br /&gt;
== Video Tutorial ==&lt;br /&gt;
&lt;br /&gt;
As a companion to the install instructions below, a YouTube video ZFS install tutorial is now available:&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=MXyBamArues|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Setting up your environment ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. We will be downloading two things: &lt;br /&gt;
&lt;br /&gt;
# System Rescue CD, &lt;br /&gt;
# ZFS System Rescue Module (SRM)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is just a file that when combined with System Rescue CD, gives you those tools.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SystemRescueCd-x86-3.3.0 (368 MiB)&lt;br /&gt;
Release Date: 2013-01-24&lt;br /&gt;
md5sum 01c9d3ff99b46771779ea2d3a66a1c7c&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Funtoo now has mirrored copies of System Rescue CD and the ZFS SRM at the links below.&lt;br /&gt;
&lt;br /&gt;
[http://ftp.osuosl.org/pub/funtoo/distfiles/sysrescuecd/systemrescuecd-x86-3.3.0.iso Download System Rescue CD 3.3.0]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://ftp.osuosl.org/pub/funtoo/distfiles/sysrescuecd/zfs-3.4.27-std330-amd64.tar.bz2 Download the ZFS System Rescue Module]&lt;br /&gt;
&lt;br /&gt;
[[Creating_System_Rescue_CD_ZFS_Modules|Follow the instructions here to download and place the srm into your flash drive]].&lt;br /&gt;
&lt;br /&gt;
== Creating partitions ==&lt;br /&gt;
There are two ways to partition your disk: You can use your entire drive and let ZFS automatically partition it for you, or you can do it manually.&lt;br /&gt;
&lt;br /&gt;
Using your entire disk drive is recommended since ZFS turns on/off a few settings. For one, if you use your whole-disk, ZFS will set the I/O elevator for the drive automatically. On Solaris machines, ZFS also enables the disk's write cache.&lt;br /&gt;
&lt;br /&gt;
If you partition it manually, you should set your I/O scheduler to no-op so it doesn't conflict with the ZFS scheduler. Partitioning manually also gives you the advantage of putting your /boot outside the ZFS pool so that you can use a bootloader that doesn't support booting from ZFS.&lt;br /&gt;
=== Whole Disk ===&lt;br /&gt;
This is the easiest method and the recommended method. &amp;lt;br /&amp;gt;&lt;br /&gt;
First lets make sure that the disk is completely wiped from any previous disk labels and partitions.&lt;br /&gt;
We will also assume that &amp;lt;tt&amp;gt;/dev/sda&amp;lt;/tt&amp;gt; is the target drive.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##gdisk /dev/sda&lt;br /&gt;
&lt;br /&gt;
Command: ##i##x ↵&lt;br /&gt;
Expert command: ##i##z ↵&lt;br /&gt;
About to wipe out GPT on /dev/sda. Proceed?: ##i##y ↵&lt;br /&gt;
GPT data structures destroyed! You may now partition the disk using fdisk or other utilities.&lt;br /&gt;
Blank out MBR?: ##i##y ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
Now that we have a clean drive, we will create the new pool in it while letting zfs automatically partition it. &lt;br /&gt;
&lt;br /&gt;
Create the pool as normal:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool create -f -o ashift=12 -o cachefile= -O compression=on -m none -R /mnt/funtoo rpool /dev/sda&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
Doing this will let ZFS create a GPT style disk with two partitions. We will also slightly modify this to add a BIOS Boot Partition so that grub can be installed successfully. First lets export the pool so that the kernel can use the new partition table without rebooting.&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool export rpool&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And now lets create a new BIOS Boot Partition at partition 2 from sectors '''48''' to '''2047''':&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##gdisk /dev/sda&lt;br /&gt;
&lt;br /&gt;
Command (? for help): ##i##p ↵&lt;br /&gt;
&lt;br /&gt;
Number  Start (sector)    End (sector)  Size       Code  Name   &lt;br /&gt;
1            2048        16758783   8.0 GiB     BF01  zfs   &lt;br /&gt;
9        16758784        16775167   8.0 MiB     BF07 &lt;br /&gt;
&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition number: ##i##2 ↵&lt;br /&gt;
First sector: ##i##48 ↵&lt;br /&gt;
Last sector: ##i##2047 ↵&lt;br /&gt;
Hex code or GUID: ##i##EF02 ↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##w ↵&lt;br /&gt;
Do you want to proceed? (Y/N): ##i##y&lt;br /&gt;
OK; writing new GUID partition table (GPT) to /dev/sda.&lt;br /&gt;
The operation has completed successfully.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you were to check &amp;lt;tt&amp;gt;/dev/sda&amp;lt;/tt&amp;gt; again, you would see these 3 partitions:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Number  Start (sector)    End (sector)  Size       Code  Name   &lt;br /&gt;
1            2048        16758783   8.0 GiB     BF01  zfs   &lt;br /&gt;
2              48            2047   1000.0 KiB  EF02  BIOS boot partition   &lt;br /&gt;
9        16758784        16775167   8.0 MiB     BF07&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let's import the pool again:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool import -f -o cachefile= -R /mnt/funtoo rpool&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[ZFS_Install_Guide#Create_the_zfs_datasets|Now continue with creating your datasets.]]&lt;br /&gt;
=== Manual partitioning ===&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
'''Create Partition 1''' (boot):&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition type: ##i##↵&lt;br /&gt;
Partition number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+250M ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (ZFS):&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition type: ##i##↵&lt;br /&gt;
Partition number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##t ↵&lt;br /&gt;
Partition number: ##i##2 ↵&lt;br /&gt;
Hex code: ##i##bf ↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##p ↵&lt;br /&gt;
&lt;br /&gt;
Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;
/dev/sda1            2048      514047      256000   83  Linux&lt;br /&gt;
/dev/sda2          514048  1953525167   976505560   bf  Solaris&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== gdisk (GPT Style) ====&lt;br /&gt;
'''Create Partition 1''' (boot):&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+250M ↵&lt;br /&gt;
Hex Code: ##i##↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (BIOS Boot Partition):&lt;br /&gt;
&amp;lt;console&amp;gt;Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+32M ↵&lt;br /&gt;
Hex Code: ##i##EF02 ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
{{fancyimportant|Only make the above BIOS Boot Partition if you are using GRUB 2 on GPT. If you are using the extlinux bootloader, this partition is not necessary.}}&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (ZFS):&lt;br /&gt;
&amp;lt;console&amp;gt;Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##↵&lt;br /&gt;
Hex Code: ##i##bf01 ↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##p ↵&lt;br /&gt;
&lt;br /&gt;
Number  Start (sector)    End (sector)  Size       Code  Name   &lt;br /&gt;
1            2048          514047   250.0 MiB   8300  Linux filesystem   &lt;br /&gt;
2          514048      1953525134   931.3 GiB   BF01  Solaris /usr &amp;amp; Mac ZFS&lt;br /&gt;
&lt;br /&gt;
Command: ##i##w ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Format your boot volume ===&lt;br /&gt;
If you did manual partitioning, format your separate boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext4 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Create the zpool ===&lt;br /&gt;
We will first create the pool. The pool will be named `rpool` and the disk will be aligned to 4096 (using ashift=12)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##zpool create -f -o ashift=12 -o cachefile= -O compression=on -m none -R /mnt/funtoo rpool /dev/sda2&amp;lt;/console&amp;gt;&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change /dev/sda2 to /dev/sda3.}}{{fancynote|If you have a previous pool that you would like to import, you can do a: '''zpool import -f -R /mnt/funtoo &amp;lt;pool_name&amp;gt;'''}}&lt;br /&gt;
&lt;br /&gt;
=== Create the zfs datasets ===&lt;br /&gt;
We will now create some datasets. For this installation, we will create a small but future proof amount of datasets. We will have a dataset for the OS (/), and your swap. We will also show you how to create some optional datasets: /home, /var, /usr/src, and /usr/portage.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Create some empty containers for organization purposes, and make the dataset that will hold /&lt;br /&gt;
# ##i##zfs create -o mountpoint=none rpool/ROOT&lt;br /&gt;
# ##i##zfs create -o mountpoint=/ rpool/ROOT/funtoo&lt;br /&gt;
&lt;br /&gt;
Optional, but recommended datasets: /home, /root&lt;br /&gt;
# ##i##zfs create -o mountpoint=/home rpool/HOME&lt;br /&gt;
# ##i##zfs create -o mountpoint=/root rpool/HOME/root&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&lt;br /&gt;
# ##i##zfs create -o mountpoint=none rpool/FUNTOO&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/src rpool/FUNTOO/src&lt;br /&gt;
# ##i##zfs create -o mountpoint=/var rpool/FUNTOO/var&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Creating a separate portage dataset (optional) ====&lt;br /&gt;
Creating a separate portage dataset could be useful if you would like to keep your portage tree, distfiles (source code files), and packages (your compiled binaries if you have FEATURES=&amp;quot;buildpkg&amp;quot; enabled) in a safe place (or if you want to back up this directory up easily). This requires a few extra steps because we can't just do a regular emerge --sync when we initially chroot. We will need to download a portage snapshot tarball and extract it into the directory. The required steps for getting and extracting the snapshot will be shown later on in the guide once you chroot into the environment. &lt;br /&gt;
&lt;br /&gt;
For now just create the datasets:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage -o compression=off rpool/FUNTOO/portage&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/distfiles -o compression=off rpool/FUNTOO/distfiles&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of RAM (This is kinda big though).'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs create -o sync=always -o primarycache=metadata -o secondarycache=none -o volblocksize=4K -V 9G rpool/swap&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Format your swap zvol ===&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkswap -f /dev/zvol/rpool/swap&lt;br /&gt;
# ##i##swapon /dev/zvol/rpool/swap&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Last minute checks and touches ===&lt;br /&gt;
Check to make sure everything appears fine:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool status&lt;br /&gt;
# ##i##zfs list&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the '''zpool.cache''' file to your new environment.&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkdir -p /mnt/funtoo/etc/zfs&lt;br /&gt;
# ##i##cp /etc/zfs/zpool.cache /mnt/funtoo/etc/zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make an empty mtab file&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##touch /mnt/funtoo/etc/mtab&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we will continue to install funtoo.&lt;br /&gt;
== Installing Funtoo ==&lt;br /&gt;
[[Funtoo_Linux_Installation|Download and install the Funtoo stage3 and continue installation as normal.]]&lt;br /&gt;
&lt;br /&gt;
Then chroot into your new funtoo environment:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /mnt/funtoo&lt;br /&gt;
&lt;br /&gt;
Mount your boot drive ** You don't need to do this if you're using whole-disk zfs **&lt;br /&gt;
# ##i##mount /dev/sda1 /mnt/funtoo/boot&lt;br /&gt;
&lt;br /&gt;
Bind the kernel related directories&lt;br /&gt;
# ##i##mount --rbind /proc proc&lt;br /&gt;
# ##i##mount --rbind /dev dev&lt;br /&gt;
# ##i##mount --rbind /sys sys&lt;br /&gt;
&lt;br /&gt;
Copy network settings&lt;br /&gt;
# ##i##cp /etc/resolv.conf etc/&lt;br /&gt;
chroot into your new funtoo environment&lt;br /&gt;
# ##i##env -i HOME=/root TERM=$TERM chroot . /bin/bash -l&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Syncing your portage tree ===&lt;br /&gt;
==== If you didn't create a separate portage dataset, then just sync your portage tree as normal. ====&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##emerge --sync&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== If you did create a separate portage dataset, let's now get the portage snapshot set up. ====&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Change into your /usr directory&lt;br /&gt;
# ##i##cd /usr&lt;br /&gt;
&lt;br /&gt;
Download and extract the portage snapshot&lt;br /&gt;
# ##i##wget http://ftp.osuosl.org/pub/funtoo/funtoo-current/snapshots/portage-latest.tar.xz&lt;br /&gt;
# ##i##tar xf portage-latest.tar.xz&lt;br /&gt;
&lt;br /&gt;
Change into your portage directory and checkout the funtoo branch&lt;br /&gt;
# ##i##cd portage&lt;br /&gt;
# ##i##git checkout funtoo.org&lt;br /&gt;
&lt;br /&gt;
Now sync your portage tree&lt;br /&gt;
# ##i##emerge --sync&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Kernel Configuration ==&lt;br /&gt;
{{fancynote|The below configurations are the requirements for &amp;quot;Bliss Initramfs Creator&amp;quot;. Some of these might not be needed for genkernel.}}&lt;br /&gt;
&lt;br /&gt;
Tested with kernel 2.6.32, 3.2.34, 3.6.X, 3.7.X.&lt;br /&gt;
&lt;br /&gt;
When you get up to the kernel, make sure that you disable the CFQ scheduler, and turn on No-op (It's the default one once you disable all schedulers). The reason for this is because ZFS has its own scheduler and the CFQ one conflicts with it. Go to your kernel config, and make sure you have the following: (there should be a /usr/src/linux symlink as well)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ZLIB_INFLATE/DEFLATE must be compiled into the kernel (not as a module).&lt;br /&gt;
&amp;gt; ZLIB_INFLATE [=y], ZLIB_DEFLATE [=y]&lt;br /&gt;
&lt;br /&gt;
General setup ---&amp;gt;&lt;br /&gt;
&amp;gt; [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support&lt;br /&gt;
&amp;gt; () Initramfs source file(s)&lt;br /&gt;
&lt;br /&gt;
[*] Enable loadable module support ---&amp;gt;&lt;br /&gt;
[*] Module unloading&lt;br /&gt;
&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
&amp;gt; Generic Driver Options ---&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; [*] Maintain a devtmpfs filesystem to mount at /dev&lt;br /&gt;
&lt;br /&gt;
Cryptographic API ---&amp;gt;&lt;br /&gt;
&amp;lt;*&amp;gt; Deflate compression algorithm&lt;br /&gt;
&amp;lt;*&amp;gt; Zlib compression algorithm&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Continue and compile/install your kernel:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##make bzImage modules&lt;br /&gt;
# ##i##make install&lt;br /&gt;
# ##i##make modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installing the ZFS userspace tools ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##emerge -av zfs&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check to make sure that the zfs tools are working, the zpool.cache file that you copied before should be displayed.&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool status&lt;br /&gt;
# ##i##zfs list&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything worked, continue.&lt;br /&gt;
&lt;br /&gt;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&lt;br /&gt;
If you are using whole-disk zfs then you will need grub2 because grub2 is the only bootloader that supports booting from a zfs pool. &lt;br /&gt;
&lt;br /&gt;
Before you do this, make sure this checklist is followed:&lt;br /&gt;
* Installed kernel and kernel modules&lt;br /&gt;
* Installed zfs package from the tree&lt;br /&gt;
* /dev, /proc, /sys are mounted in the chroot environment&lt;br /&gt;
&lt;br /&gt;
Once all this is checked, let's install grub2. First we need to enable the &amp;quot;libzfs&amp;quot; use flag so zfs support is compiled for grub2.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##echo &amp;quot;sys-boot/grub libzfs&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we will compile grub2:&lt;br /&gt;
{{fancyimportant|GRUB should be _at least_ version 2.0.0 since 2.0.0 added zfs support. 1.99,.98 will not work.}}&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##emerge -av grub&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once this is done, you can check that grub is version 2.00 by doing the following command:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##grub-install --version&lt;br /&gt;
grub-install (GRUB) 2.00&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now try to install grub2:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##grub-install --no-floppy /dev/sda&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should receive the following message&lt;br /&gt;
&amp;lt;console&amp;gt;Installation finished. No error reported.&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If not, then go back to the above checklist.&lt;br /&gt;
=== Extlinux ===&lt;br /&gt;
There are four things we need to do for extlinux:&lt;br /&gt;
&lt;br /&gt;
# Install extlinux bootloader&lt;br /&gt;
# Write the .bin to the front of the target disk&lt;br /&gt;
# Toggle BIOS partition flag&lt;br /&gt;
# Write a extlinux configuration file&lt;br /&gt;
&lt;br /&gt;
First emerge extlinux:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##emerge -av syslinux&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then create a /boot/extlinux directory:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##mkdir /boot/extlinux&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Change into the extlinux dir and install the bootloader:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot/extlinux&lt;br /&gt;
# ##i##extlinux --install .&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== MBR ====&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##fdisk /dev/sda&lt;br /&gt;
&lt;br /&gt;
Command: ##i##a ↵&lt;br /&gt;
Partition number: ##i##1 ↵&lt;br /&gt;
Command: ##i##w ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Printing the &amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt; partition layout should show a star next to &amp;lt;tt&amp;gt;/dev/sda1&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;console&amp;gt;/dev/sda   *    2048    514047    256000    83    Linux&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Flash the .bin to the front of the disk:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##dd conv=notrunc bs=440 count=1 if=/usr/share/syslinux/mbr.bin of=/dev/sda&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== GPT ===&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##sgdisk /dev/sda --attributes=1:set:2&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Flash the .bin to the front of the disk:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##dd conv=notrunc bs=440 count=1 if=/usr/share/syslinux/gptmbr.bin of=/dev/sda&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We will write the extlinux/grub configuration file in the next section.&lt;br /&gt;
== Create the initramfs ==&lt;br /&gt;
There are two ways to do this, you can use genkernel, or you can use my bliss initramfs creator. I will show you both.&lt;br /&gt;
&lt;br /&gt;
=== genkernel ===&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge -av sys-kernel/genkernel&lt;br /&gt;
# ##i##genkernel --zfs initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example: kernel name is: vmlinuz-3.7.3-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.7.3-ALL&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''grub.cfg''':&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
set timeout=3&lt;br /&gt;
set default=0&lt;br /&gt;
&lt;br /&gt;
# Funtoo&lt;br /&gt;
menuentry &amp;quot;Funtoo - 3.7.3&amp;quot; {  &lt;br /&gt;
  insmod zfs  &lt;br /&gt;
  linux /ROOT/funtoo/@/boot/vmlinuz-3.7.3-ALL root=rpool/ROOT/funtoo real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /ROOT/funtoo/@/boot/initramfs-genkernel-x86_64-3.7.3-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''extlinux.conf''':&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo&lt;br /&gt;
  MENU LABEL Funtoo 3.7.3-ALL&lt;br /&gt;
  KERNEL /boot/vmlinuz-3.7.3-ALL&lt;br /&gt;
  INITRD /boot/initramfs-genkernel-x86_64-3.7.3-ALL&lt;br /&gt;
  APPEND real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
Clone my creator which is located at: git://github.com/fearedbliss/Bliss-Initramfs-Creator.git&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##git clone git://github.com/fearedbliss/Bliss-Initramfs-Creator.git&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then go into this new directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd Bliss-Initramfs-Creator&lt;br /&gt;
# ##i##./createInit&lt;br /&gt;
# ##i##mv initrd-&amp;lt;kernel_name&amp;gt;.img /boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;kernel_name&amp;gt;''' is the name of what you selected in the initramfs creator, and the name of the outputted file. Once you do this just go to your bootloader config, and add it in there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example: Kernel name is: vmlinuz-3.7.3-ALL&lt;br /&gt;
initramfs name is: initrd-3.7.3-ALL.img&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''grub.cfg''':&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
set timeout=3&lt;br /&gt;
set default=0&lt;br /&gt;
&lt;br /&gt;
# Funtoo&lt;br /&gt;
menuentry &amp;quot;Funtoo - 3.7.3&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /ROOT/funtoo/@/boot/vmlinuz-3.7.3-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
  initrd /ROOT/funtoo/@/boot/initrd-3.7.3-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''extlinux.conf:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo  &lt;br /&gt;
  MENU LABEL Funtoo 3.7.3-ALL  &lt;br /&gt;
  KERNEL /boot/vmlinuz-3.7.3-ALL  &lt;br /&gt;
  INITRD /boot/initrd-3.7.3-ALL.img  &lt;br /&gt;
  APPEND root=rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Final configuration ==&lt;br /&gt;
=== Add the zfs tools to openrc ===&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##rc-update add zfs boot&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Add filesystems to /etc/fstab ===&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##nano /etc/fstab&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;fs&amp;gt;                  &amp;lt;mountpoint&amp;gt;    &amp;lt;type&amp;gt;          &amp;lt;opts&amp;gt;          &amp;lt;dump/pass&amp;gt;&lt;br /&gt;
# Do not add the /boot line below if you are using whole-disk zfs&lt;br /&gt;
/dev/sda1               /boot           ext4            defaults        1 2&lt;br /&gt;
/dev/zvol/rpool/swap    none            swap            sw              0 0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Clean up and reboot ===&lt;br /&gt;
We are almost done, we are just going to clean up, '''set our root password''', and unmount whatever we mounted and get out.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Delete the stage3/portage tarballs you downloaded earlier so they don't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-latest.tar.xz&lt;br /&gt;
# ##i##rm /usr/portage-latest.tar.xz&lt;br /&gt;
&lt;br /&gt;
Set your root password&lt;br /&gt;
# ##i##passwd&lt;br /&gt;
&amp;gt;&amp;gt; Enter your password, you won't see what you are writing (for security reasons), but it is there!&lt;br /&gt;
&lt;br /&gt;
Get out of the chroot environment&lt;br /&gt;
# ##i##exit&lt;br /&gt;
&lt;br /&gt;
Unmount all the kernel filesystem stuff and boot (if you have a separate /boot)&lt;br /&gt;
# ##i##cd /mnt/funtoo&lt;br /&gt;
# ##i##umount -l proc dev sys boot&lt;br /&gt;
&lt;br /&gt;
Turn off the swap&lt;br /&gt;
# ##i##swapoff /dev/zvol/rpool/swap&lt;br /&gt;
&lt;br /&gt;
Export the zpool&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##zpool export -f rpool&lt;br /&gt;
&lt;br /&gt;
Reboot&lt;br /&gt;
# ##i##reboot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|'''Don't forget to set your root password as stated above before exiting chroot and rebooting. If you don't set the root password, you won't be able to log into your new system.'''}}&lt;br /&gt;
&lt;br /&gt;
and that should be enough to get your system to boot on ZFS.&lt;br /&gt;
&lt;br /&gt;
== Extra: After reboot ==&lt;br /&gt;
After you restart your machine and your inside your desktop, continue to set up anything you need in terms of /etc configurations. Once you have everything the way you like it, take a snapshot of your system. You will be using this snapshot to revert back to this state if anything ever happens to your system down the road. The snapshots are cheap, and almost instant. &lt;br /&gt;
&lt;br /&gt;
To take the snapshot of your rootfs, type the following:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##zfs snapshot rpool/ROOT/funtoo@install&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To see if your snapshot was taken, type:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##zfs list -t snapshot&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your machine ever fails and you need to get back to this state, just type:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##zfs rollback rpool/ROOT/funtoo@install&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Recovery Environment ===&lt;br /&gt;
On ZFS it is extremely easy to create a recovery environment using an already working snapshot. So that's what we will be doing. Create a clone of the @install snapshot which you will use for recovery purposes. If something happens to your main install, you can boot into this clone and fix the main one. One of the differences (maybe the only difference) between a clone and a snapshot is that a clone is rewritable while a snapshot is only read-only.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##zfs clone rpool/ROOT/funtoo@install rpool/ROOT/recovery&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add the clone to your grub.cfg ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
set timeout=3&lt;br /&gt;
set default=0&lt;br /&gt;
&lt;br /&gt;
# Funtoo Recovery&lt;br /&gt;
menuentry &amp;quot;Funtoo Recovery - 3.7.3&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /ROOT/funtoo/@/boot/vmlinuz-3.7.3-ALL root=rpool/ROOT/recovery quiet&lt;br /&gt;
  initrd /ROOT/funtoo/@/boot/initrd-3.7.3-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add the clone to your extlinux.conf ====&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo-recovery    &lt;br /&gt;
  MENU LABEL Funtoo Recovery    &lt;br /&gt;
  KERNEL /boot/vmlinuz-3.7.3-ALL    &lt;br /&gt;
  INITRD /boot/initrd-3.7.3-ALL.img    &lt;br /&gt;
  APPEND root=rpool/ROOT/recovery&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Things to watch out for ====&lt;br /&gt;
Since your recovery clone will tend to get old as you use your main system, and since your recovery and other stuff are on the same pool, we don't want the new pool stuff to be mounted when we launch recovery. We also don't want video drivers to be conflicting.&lt;br /&gt;
# Make sure that nvidia/nouveau stuff are blacklisted.&lt;br /&gt;
# Make sure that your /boot and /lib/modules for the kernel in your 'recovery' are matching.&lt;br /&gt;
# Disable the zfs openrc script so that nothing else gets automatically mounted. Only your rootfs.&lt;br /&gt;
&lt;br /&gt;
You can do the above stuff by mounting your copy and chrooting into it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Mount the recovery clone&lt;br /&gt;
# ##i##mkdir /mnt/recovery&lt;br /&gt;
# ##i##mount -t zfs -o zfsutil rpool/ROOT/recovery /mnt/recovery&lt;br /&gt;
# ##i##cd /mnt/recovery&lt;br /&gt;
&lt;br /&gt;
Mount the kernel devices&lt;br /&gt;
# ##i##mount --rbind /proc ./proc&lt;br /&gt;
# ##i##mount --rbind /dev ./dev&lt;br /&gt;
# ##i##mount --rbind /sys ./sys&lt;br /&gt;
&lt;br /&gt;
Copy zpool.cache&lt;br /&gt;
# ##i##cp /etc/zfs/zpool.cache etc/zfs&lt;br /&gt;
&lt;br /&gt;
Chroot into the new environment&lt;br /&gt;
# ##i##env -i HOME=/root TERM=$TERM chroot . bash --login&lt;br /&gt;
&lt;br /&gt;
Disable zfs/zfs-shutdown openrc scripts&lt;br /&gt;
# ##i##rc-config delete zfs boot&lt;br /&gt;
&lt;br /&gt;
Blacklist nouveau/nvidia drivers&lt;br /&gt;
# ##i##echo &amp;quot;blacklist nouveau&amp;quot; &amp;gt;&amp;gt; /etc/modprobe.d/blacklist.conf&lt;br /&gt;
# ##i##echo &amp;quot;blacklist nvidia&amp;quot; &amp;gt;&amp;gt; /etc/modprobe.d/blacklist.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you are done doing your changes, just umount and exit the chroot:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##umount -l proc dev sys&lt;br /&gt;
# ##i##exit&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Getting into the recovery ====&lt;br /&gt;
Just start your machine and pick the '''Funtoo Recovery''' option from the Boot Menu.&lt;br /&gt;
&lt;br /&gt;
Enjoy your new install on ZFS :)&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;br /&gt;
[[Category:Filesystems]]&lt;br /&gt;
[[Category:Featured]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
__NOTITLE__&lt;/div&gt;</summary>
		<author><name>Ryao</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/ZFS_Install_Guide</id>
		<title>ZFS Install Guide</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/ZFS_Install_Guide"/>
				<updated>2013-01-16T22:28:56Z</updated>
		
		<summary type="html">&lt;p&gt;Ryao: Setting sync=always on a swap zvol is a very bad idea. It should be sync=disabled. The idea is to evict data from memory ASAP, which sync=always does not do.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial will show you how to install Funtoo on ZFS (rootfs).&lt;br /&gt;
&lt;br /&gt;
This tutorial is meant to be an &amp;quot;overlay&amp;quot; over the [[Funtoo_Linux_Installation|Regular Funtoo Installation]]. Follow the normal installation and only use this guide for steps 2, 3, and 8.&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|'''Since ZFS was really designed for 64 bit systems, we are only recommending and supporting 64 bit platforms and installations. We will not be supporting 32 bit platforms'''!}}&lt;br /&gt;
&lt;br /&gt;
== Setting up your environment ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. We will be downloading two things: System Rescue CD, &amp;lt;br /&amp;gt;&lt;br /&gt;
and the ZFS System Rescue Module (SRM). This is just a file that when combined with System Rescue CD, gives you those tools.&lt;br /&gt;
&lt;br /&gt;
[https://sourceforge.net/projects/systemrescuecd/files/sysresccd-x86/3.2.0/systemrescuecd-x86-3.2.0.iso/download Download System Rescue CD 3.2.0]&lt;br /&gt;
&lt;br /&gt;
[http://jonathanvasquez.com/files/sysresccd/ Download the ZFS System Rescue Module]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SystemRescueCd-x86-3.2.0 (353 MiB)&lt;br /&gt;
Release Date: 2013-01-07&lt;br /&gt;
&lt;br /&gt;
md5sum 90528f0c4b861363992fd9cbcc52d00a&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Creating_System_Rescue_CD_Modules|Follow the instructions here to download and place the srm into your flash drive]]. &lt;br /&gt;
&lt;br /&gt;
We will now start to partition the system. Open up a terminal, and type in the following (We will assume it's a fresh drive for simplicity).&lt;br /&gt;
&lt;br /&gt;
== Creating partitions ==&lt;br /&gt;
&lt;br /&gt;
We will be creating two partitions, /boot, and the remaining disk space will be for ZFS.&lt;br /&gt;
&lt;br /&gt;
(All commands will be ran as root).&lt;br /&gt;
&lt;br /&gt;
=== fdisk (MBR Style) ===&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 1''' (boot):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition type: ##i##↵&lt;br /&gt;
Partition number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+250M ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (ZFS):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition type: ##i##↵&lt;br /&gt;
Partition number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##t ↵&lt;br /&gt;
Partition number: ##i##2 ↵&lt;br /&gt;
Hex code (type L to list codes): ##i##bf ↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##p ↵&lt;br /&gt;
&lt;br /&gt;
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes&lt;br /&gt;
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors&lt;br /&gt;
Units = sectors of 1 * 512 = 512 bytes&lt;br /&gt;
Sector size (logical/physical): 512 bytes / 512 bytes&lt;br /&gt;
I/O size (minimum/optimal): 512 bytes / 512 bytes&lt;br /&gt;
Disk identifier: 0x3e954df7&lt;br /&gt;
&lt;br /&gt;
   Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;
/dev/sda1            2048      514047      256000   83  Linux&lt;br /&gt;
/dev/sda2          514048  1953525167   976505560   bf  Solaris&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== gdisk (GPT Style) ===&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 1''' (boot):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+250M ↵&lt;br /&gt;
Hex Code: ##i##↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (BIOS Boot Partition):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+32M ↵&lt;br /&gt;
Hex Code: ##i##EF02 ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|Only make the above BIOS Boot Partition if you are using GRUB 2 on GPT. If you are using the extlinux bootloader, this partition is not necessary. The below instructions continue as if you did not create this partition and assumes you are using extlinux as the bootloader.}}&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (ZFS):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##↵&lt;br /&gt;
Hex Code: ##i##bf01 ↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##p ↵&lt;br /&gt;
Disk /dev/sda: 1953525168 sectors, 931.5 GiB&lt;br /&gt;
Logical sector size: 512 bytes&lt;br /&gt;
Disk identifier (GUID): C0C1E56A-B24F-492F-95DB-2E227676F228&lt;br /&gt;
Partition table holds up to 128 entries&lt;br /&gt;
First usable sector is 34, last usable sector is 1953525134&lt;br /&gt;
Partitions will be aligned on 2048-sector boundaries&lt;br /&gt;
Total free space is 2014 sectors (1007.0 KiB)&lt;br /&gt;
&lt;br /&gt;
Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          514047   250.0 MiB   8300  Linux filesystem&lt;br /&gt;
   2          514048      1953525134   931.3 GiB   BF01  Solaris /usr &amp;amp; Mac ZFS&lt;br /&gt;
&lt;br /&gt;
Command: ##i##w ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Format your boot volume ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkfs.ext4 /dev/sda1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create the zpool ===&lt;br /&gt;
We will first create the pool. The pool will be named `rpool` and the disk will be aligned to 4096 (using ashift=12)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool create -f -o ashift=12 -o cachefile= -O compression=on -m none -R /mnt/funtoo rpool /dev/sda2&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the GPT partitioning instructions, you should change /dev/sda2 to /dev/sda3.}}&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have a previous pool that you would like to import, you can do a: '''zpool import -R /mnt/funtoo &amp;lt;pool_name&amp;gt;'''}}&lt;br /&gt;
&lt;br /&gt;
=== Create the zfs datasets ===&lt;br /&gt;
We will now create some datasets. For this installation, we will create a small but future proof amount of datasets. We will have a dataset for the OS (/), and your swap. We will also show you how to create some optional datasets: /home, /var, /usr/src, and /usr/portage.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Create some empty containers for organization purposes, and make the dataset that will hold /&lt;br /&gt;
# ##i##zfs create -o mountpoint=none rpool/ROOT&lt;br /&gt;
# ##i##zfs create -o mountpoint=/ rpool/ROOT/funtoo&lt;br /&gt;
&lt;br /&gt;
Optional, but recommended datasets: /home, /root &lt;br /&gt;
# ##i##zfs create -o mountpoint=/home rpool/HOME&lt;br /&gt;
# ##i##zfs create -o mountpoint=/root rpool/HOME/root&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&lt;br /&gt;
# ##i##zfs create -o mountpoint=none rpool/FUNTOO&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/src rpool/FUNTOO/src&lt;br /&gt;
# ##i##zfs create -o mountpoint=/var rpool/FUNTOO/var&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a separate portage dataset (optional) ====&lt;br /&gt;
&lt;br /&gt;
Creating a separate portage dataset could be useful if you would like to keep your portage tree, distfiles (source code files), and packages (your compiled binaries if you have FEATURES=&amp;quot;buildpkg&amp;quot; enabled) in a safe place (or if you want to back up this directory up easily).&lt;br /&gt;
&lt;br /&gt;
This requires a few extra steps because we can't just do a regular emerge --sync when we initially chroot. We will need to download a portage snapshot tarball and extract it into the directory.&lt;br /&gt;
&lt;br /&gt;
The required steps for getting and extracting the snapshot will be shown later on in the guide once you chroot into the environment. For now just create the datasets:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage -o compression=off rpool/FUNTOO/portage&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/distfiles -o compression=off rpool/FUNTOO/distfiles&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create your swap zvol ===&lt;br /&gt;
&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of RAM (This is kinda big though).'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs create -o sync=disabled -o primarycache=metadata -o secondarycache=none -V 9G rpool/swap&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Format your swap zvol ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkswap -f /dev/zvol/rpool/swap&lt;br /&gt;
# ##i##swapon /dev/zvol/rpool/swap&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright that finishes the creation of the zpool and zfs datasets. &lt;br /&gt;
&lt;br /&gt;
Check to make sure everything appears fine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool status&lt;br /&gt;
# ##i##zfs list&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the zpool.cache file to your new environment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkdir -p /mnt/funtoo/etc/zfs&lt;br /&gt;
# ##i##cp /etc/zfs/zpool.cache /mnt/funtoo/etc/zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make an empty mtab file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##touch /mnt/funtoo/etc/mtab&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we will continue to install funtoo.&lt;br /&gt;
&lt;br /&gt;
== Installing Funtoo ==&lt;br /&gt;
&lt;br /&gt;
[[Funtoo_Linux_Installation|Download and install the Funtoo stage3 and continue installation as normal.]]&lt;br /&gt;
&lt;br /&gt;
Then chroot into your new funtoo environment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /mnt/funtoo&lt;br /&gt;
&lt;br /&gt;
Mount your boot drive&lt;br /&gt;
# ##i##mount /dev/sda1 /mnt/funtoo/boot&lt;br /&gt;
&lt;br /&gt;
Bind the kernel related directories&lt;br /&gt;
# ##i##mount --bind /proc ./proc&lt;br /&gt;
# ##i##mount --bind /dev ./dev&lt;br /&gt;
# ##i##mount --bind /sys ./sys&lt;br /&gt;
&lt;br /&gt;
Copy network settings&lt;br /&gt;
# ##i##cp /etc/resolv.conf etc/&lt;br /&gt;
&lt;br /&gt;
chroot into your new funtoo environment&lt;br /&gt;
# ##i##env -i HOME=/root TERM=$TERM chroot . bash -l&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Syncing your portage tree ===&lt;br /&gt;
&lt;br /&gt;
==== If you didn't create a separate portage dataset, then just sync your portage tree as normal. ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge --sync&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== If you did create a separate portage dataset, let's now get the portage snapshot set up. ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Change into your /usr directory&lt;br /&gt;
# ##i##cd /usr&lt;br /&gt;
&lt;br /&gt;
Download and extract the portage snapshot&lt;br /&gt;
# ##i##wget http://ftp.osuosl.org/pub/funtoo/funtoo-current/snapshots/portage-latest.tar.xz&lt;br /&gt;
# ##i##tar xf portage-latest.tar.xz&lt;br /&gt;
&lt;br /&gt;
Change into your portage directory and checkout the funtoo branch&lt;br /&gt;
# ##i##cd portage&lt;br /&gt;
# ##i##git checkout funtoo.org&lt;br /&gt;
&lt;br /&gt;
Now sync your portage tree&lt;br /&gt;
# ##i##emerge --sync&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Kernel Configuration ==&lt;br /&gt;
&lt;br /&gt;
Tested with kernel 2.6.32, 3.2.34, 3.6.9, 3.7.1.&lt;br /&gt;
&lt;br /&gt;
When you get up to the kernel, make sure that you disable the CFQ scheduler, and turn&lt;br /&gt;
on No-op (It's the default one once you disable all schedulers). The reason for this is because ZFS has its&lt;br /&gt;
own scheduler and the CFQ one conflicts with it.&lt;br /&gt;
&lt;br /&gt;
Go to your kernel config, and make sure you have the following: (there should be a /usr/src/linux symlink as well)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ZLIB_INFLATE/DEFLATE must be compiled into the kernel (not as a module).&lt;br /&gt;
&amp;gt; ZLIB_INFLATE [=y], ZLIB_DEFLATE [=y]&lt;br /&gt;
&lt;br /&gt;
General setup ---&amp;gt;&lt;br /&gt;
&amp;gt; [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support&lt;br /&gt;
&amp;gt; () Initramfs source file(s)&lt;br /&gt;
&lt;br /&gt;
[*] Enable loadable module support ---&amp;gt;&lt;br /&gt;
[*] Module unloading&lt;br /&gt;
&lt;br /&gt;
Enable the block layer ---&amp;gt;&lt;br /&gt;
IO Schedulers ---&amp;gt;&lt;br /&gt;
&amp;lt; &amp;gt; Deadline I/O scheduler&lt;br /&gt;
&amp;lt; &amp;gt; CFQ I/O scheduler&lt;br /&gt;
Default I/O scheduler (No-op)&lt;br /&gt;
&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
&amp;gt; Generic Driver Options ---&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; [*] Maintain a devtmpfs filesystem to mount at /dev&lt;br /&gt;
&amp;gt;&amp;gt; [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs&lt;br /&gt;
&lt;br /&gt;
Cryptographic API ---&amp;gt;&lt;br /&gt;
&amp;lt;*&amp;gt; Deflate compression algorithm&lt;br /&gt;
&amp;lt;*&amp;gt; Zlib compression algorithm&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Continue and compile/install your kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##make bzImage modules&lt;br /&gt;
# ##i##make install&lt;br /&gt;
# ##i##make modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installing the ZFS userspace tools ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge -av zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check to make sure that the zfs tools are working, the zpool.cache file that you copied before should be displayed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool status&lt;br /&gt;
# ##i##zfs list&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything worked, continue.&lt;br /&gt;
&lt;br /&gt;
== Create the initramfs ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to do this, you can use genkernel, or you can use my bliss initramfs creator. I will&lt;br /&gt;
show you both.&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
&lt;br /&gt;
Make sure you compile sys-apps/busybox with the static flag.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-apps/busybox static&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge -av sys-apps/busybox&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone my creator which is located at: git://github.com/fearedbliss/Bliss-Initramfs-Creator.git&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/Bliss-Initramfs-Creator.git&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then go into this new directory, run the script as root, and place it into /boot&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd Bliss-Initramfs-Creator&lt;br /&gt;
# ##i##./createInit&lt;br /&gt;
# ##i##mv initrd-&amp;lt;kernel_name&amp;gt;.img /boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;kernel_name&amp;gt;''' is the name of what you selected in the initramfs creator, and the name of the outputted file.&lt;br /&gt;
&lt;br /&gt;
Once you do this just go to your bootloader config, and add it in there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
Kernel name is: vmlinuz-3.7.1-ALL&lt;br /&gt;
initramfs name is: initrd-3.7.1-ALL.img&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
extlinux.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo&lt;br /&gt;
  MENU LABEL Funtoo 3.7.1-ALL&lt;br /&gt;
  KERNEL /boot/vmlinuz-3.7.1-ALL&lt;br /&gt;
  INITRD /boot/initrd-3.7.1-ALL.img&lt;br /&gt;
  APPEND pool_root=rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== genkernel ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge -av sys-kernel/genkernel&lt;br /&gt;
# ##i##genkernel --zfs initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
kernel name is: vmlinuz-3.7.1-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.7.1-ALL&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&lt;br /&gt;
extlinux.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo&lt;br /&gt;
  MENU LABEL Funtoo 3.7.1-ALL&lt;br /&gt;
  KERNEL /boot/vmlinuz-3.7.1-ALL&lt;br /&gt;
  INITRD /boot/initramfs-genkernel-x86_64-3.7.1-ALL&lt;br /&gt;
  APPEND real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Final configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Add the zfs tools to openrc ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##rc-update add zfs boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Add filesystems to /etc/fstab ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##nano /etc/fstab&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;fs&amp;gt;                  &amp;lt;mountpoint&amp;gt;    &amp;lt;type&amp;gt;          &amp;lt;opts&amp;gt;          &amp;lt;dump/pass&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/dev/sda1               /boot           ext4            defaults        1 2&lt;br /&gt;
/dev/zvol/rpool/swap    none            swap            sw              0 0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Clean up and reboot ===&lt;br /&gt;
We are almost done, we are just going to clean up, '''set our root password''', and unmount whatever we mounted and get out.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Delete the stage3/portage tarballs you downloaded earlier so they don't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-latest.tar.xz&lt;br /&gt;
# ##i##rm /usr/portage-latest.tar.xz&lt;br /&gt;
&lt;br /&gt;
Set your root password&lt;br /&gt;
# ##i##passwd&lt;br /&gt;
&amp;gt;&amp;gt; Enter your password, you won't see what you are writing (for security reasons), but it is there!&lt;br /&gt;
&lt;br /&gt;
Get out of the chroot environment&lt;br /&gt;
# ##i##exit&lt;br /&gt;
&lt;br /&gt;
Unmount all the kernel filesystem stuff and boot&lt;br /&gt;
# ##i##cd /mnt/funtoo&lt;br /&gt;
# ##i##umount proc dev sys boot&lt;br /&gt;
&lt;br /&gt;
Turn off the swap&lt;br /&gt;
# ##i##swapoff /dev/zvol/rpool/swap&lt;br /&gt;
&lt;br /&gt;
Export the zpool&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##zpool export -f rpool&lt;br /&gt;
&lt;br /&gt;
Reboot&lt;br /&gt;
# ##i##reboot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|'''Don't forget to set your root password as stated above before exiting chroot and rebooting. If you don't set the root password, you won't be able to log into your new system.'''}}&lt;br /&gt;
and that should be enough to get your system to boot on ZFS.&lt;br /&gt;
&lt;br /&gt;
== Extra: After reboot ==&lt;br /&gt;
&lt;br /&gt;
After you restart your machine and your inside your desktop, continue to set up anything you need in terms of /etc configurations. Once you have everything the way you like it, take a snapshot of your system. You will be using this snapshot to revert back to this state if anything ever happens to your system down the road. The snapshots are cheap, and almost instant. To take the snapshot of your rootfs, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs snapshot rpool/ROOT/funtoo@install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To see if your snapshot was taken, type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs list -t snapshot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your machine ever fails and you need to get back to this state, just type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs rollback rpool/ROOT/funtoo@install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Recovery Environment ===&lt;br /&gt;
On ZFS it is extremely easy to create a recovery environment using an already working snapshot. So that's what we will be doing. &lt;br /&gt;
&lt;br /&gt;
Create a clone of the @install snapshot which you will use for recovery purposes. If something happens to your main install, you can boot into this clone and fix the main one. One of the differences (maybe the only difference) between a clone and a snapshot is that a clone is rewritable while a snapshot is only read-only.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs clone rpool/ROOT/funtoo@install rpool/ROOT/recovery&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add the clone to your extlinux.conf ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo-recovery&lt;br /&gt;
    MENU LABEL Funtoo Recovery&lt;br /&gt;
    KERNEL /boot/vmlinuz-3.7.1-ALL&lt;br /&gt;
    INITRD /boot/initrd-3.7.1-ALL.img&lt;br /&gt;
    APPEND pool_root=rpool/ROOT/recovery&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Things to watch out for ====&lt;br /&gt;
&lt;br /&gt;
Since your recovery clone will tend to get old as you use your main system, and since &lt;br /&gt;
your recovery and other stuff are on the same pool, we don't want the new pool stuff&lt;br /&gt;
to be mounted when we launch recovery. We also don't want video drivers to be&lt;br /&gt;
conflicting.&lt;br /&gt;
&lt;br /&gt;
1. Make sure that nvidia/nouveau stuff are blacklisted.&lt;br /&gt;
2. Make sure that your /boot and /lib/modules for the kernel in your 'recovery' are&lt;br /&gt;
matching.&lt;br /&gt;
3. Disable the zfs openrc script so that nothing else gets automatically mounted.&lt;br /&gt;
Only your rootfs.&lt;br /&gt;
&lt;br /&gt;
You can do the above stuff by mounting your copy and chrooting into it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Mount the recovery clone&lt;br /&gt;
# ##i##mkdir /mnt/recovery&lt;br /&gt;
# ##i##mount -t zfs -o zfsutil rpool/ROOT/recovery /mnt/recovery&lt;br /&gt;
# ##i##cd /mnt/recovery&lt;br /&gt;
&lt;br /&gt;
Mount the kernel devices&lt;br /&gt;
# ##i##mount --bind /proc ./proc&lt;br /&gt;
# ##i##mount --bind /dev ./dev&lt;br /&gt;
# ##i##mount --bind /sys ./sys&lt;br /&gt;
&lt;br /&gt;
Copy zpool.cache&lt;br /&gt;
# ##i##cp /etc/zfs/zpool.cache etc/zfs&lt;br /&gt;
&lt;br /&gt;
Chroot into the new environment&lt;br /&gt;
# ##i##env -i HOME=/root TERM=$TERM chroot . bash --login&lt;br /&gt;
&lt;br /&gt;
Disable zfs/zfs-shutdown openrc scripts&lt;br /&gt;
# ##i##rc-config delete zfs boot&lt;br /&gt;
&lt;br /&gt;
Blacklist nouveau/nvidia drivers&lt;br /&gt;
# ##i##echo &amp;quot;blacklist nouveau&amp;quot; &amp;gt;&amp;gt; /etc/modprobe.d/blacklist.conf&lt;br /&gt;
# ##i##echo &amp;quot;blacklist nvidia&amp;quot; &amp;gt;&amp;gt; /etc/modprobe.d/blacklist.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Getting into the recovery ====&lt;br /&gt;
Just start your machine and pick the '''Funtoo Recovery''' option from the Boot Menu.&lt;br /&gt;
&lt;br /&gt;
Enjoy your new install on ZFS :)&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;br /&gt;
[[Category:Filesystems]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Featured]]&lt;/div&gt;</summary>
		<author><name>Ryao</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/ZFS_Install_Guide</id>
		<title>ZFS Install Guide</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/ZFS_Install_Guide"/>
				<updated>2013-01-05T19:30:28Z</updated>
		
		<summary type="html">&lt;p&gt;Ryao: Elevate importance of note.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial will show you how to install Funtoo on ZFS (rootfs).&lt;br /&gt;
&lt;br /&gt;
This tutorial is meant to be an &amp;quot;overlay&amp;quot; over the [[Funtoo_Linux_Installation|Regular Funtoo Installation]]. Follow the normal installation and only use this guide for steps 2, 3, and 8.&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|'''Since ZFS was really designed for 64 bit systems, we are only recommending and supporting 64 bit platforms and installations. We will not be supporting 32 bit platforms'''!}}&lt;br /&gt;
&lt;br /&gt;
== Setting up your environment ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS userspace tools. We will be downloading two things, System Rescue CD 3.1.2, and the ZFS SRM (System Rescue Module). This is just a file that when combined with System Rescue CD, gives you ZFS functionality.&lt;br /&gt;
&lt;br /&gt;
[https://sourceforge.net/projects/systemrescuecd/files/sysresccd-x86/3.1.2/systemrescuecd-x86-3.1.2.iso/download Download System Rescue CD 3.1.2]&lt;br /&gt;
&lt;br /&gt;
[http://jonathanvasquez.com/files/sysresccd/ Download the ZFS System Rescue Module]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SystemRescueCd-x86-3.1.2 (350 MiB)&lt;br /&gt;
Release Date: 2012-12-05&lt;br /&gt;
&lt;br /&gt;
md5sum 3c1ddfe5f26bb2f979a2ed9dfb504ee3&lt;br /&gt;
sha1sum 217cf7a81380d894b2433c59451787c16bc0af2f&lt;br /&gt;
sha256sum ec0a995875e64ff9816a043737e5cbbb689b7f596b48679116f0a779f3dce673&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you place the ISO on your USB flash drive, extract the modules from the tarball, and place the .srm and .md5 at the root of your USB filesystem. Further instructions can be found [[Creating_System_Rescue_CD_Modules#Using_the_prebuilt_srm|here]]. &lt;br /&gt;
&lt;br /&gt;
We will now start to partition the system. Open up a terminal, and type in the following (We will assume it's a fresh drive for simplicity).&lt;br /&gt;
&lt;br /&gt;
== Creating partitions ==&lt;br /&gt;
&lt;br /&gt;
We will be creating two partitions, /boot, and the remaining disk space will be for ZFS.&lt;br /&gt;
&lt;br /&gt;
(All commands will be ran as root).&lt;br /&gt;
&lt;br /&gt;
=== fdisk (MBR Style) ===&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 1''' (boot):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition type: ##i##↵&lt;br /&gt;
Partition number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+250M ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (ZFS):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition type: ##i##↵&lt;br /&gt;
Partition number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##t ↵&lt;br /&gt;
Partition number: ##i##2 ↵&lt;br /&gt;
Hex code (type L to list codes): ##i##bf ↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##p ↵&lt;br /&gt;
&lt;br /&gt;
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes&lt;br /&gt;
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors&lt;br /&gt;
Units = sectors of 1 * 512 = 512 bytes&lt;br /&gt;
Sector size (logical/physical): 512 bytes / 512 bytes&lt;br /&gt;
I/O size (minimum/optimal): 512 bytes / 512 bytes&lt;br /&gt;
Disk identifier: 0x3e954df7&lt;br /&gt;
&lt;br /&gt;
   Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;
/dev/sda1            2048      514047      256000   83  Linux&lt;br /&gt;
/dev/sda2          514048  1953525167   976505560   bf  Solaris&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== gdisk (GPT Style) ===&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 1''' (boot):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+250M ↵&lt;br /&gt;
Hex Code: ##i##↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (BIOS Boot Partition):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+32M ↵&lt;br /&gt;
Hex Code: ##i##EF02 ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|Only make the above BIOS Boot Partition if you are using GRUB 2 on GPT. If you are using the extlinux bootloader, this partition is not necessary. The below instructions continue as if you did not create this partition and assumes you are using extlinux as the bootloader.}}&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (ZFS):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##↵&lt;br /&gt;
Hex Code: ##i##bf01 ↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##p ↵&lt;br /&gt;
Disk /dev/sda: 1953525168 sectors, 931.5 GiB&lt;br /&gt;
Logical sector size: 512 bytes&lt;br /&gt;
Disk identifier (GUID): C0C1E56A-B24F-492F-95DB-2E227676F228&lt;br /&gt;
Partition table holds up to 128 entries&lt;br /&gt;
First usable sector is 34, last usable sector is 1953525134&lt;br /&gt;
Partitions will be aligned on 2048-sector boundaries&lt;br /&gt;
Total free space is 2014 sectors (1007.0 KiB)&lt;br /&gt;
&lt;br /&gt;
Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          514047   250.0 MiB   8300  Linux filesystem&lt;br /&gt;
   2          514048      1953525134   931.3 GiB   BF01  Solaris /usr &amp;amp; Mac ZFS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Format your boot volume ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkfs.ext4 /dev/sda1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create the zpool ===&lt;br /&gt;
We will first create the pool. The pool will be named `rpool` and the disk will be aligned to 4096 (using ashift=12)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool create -f -o ashift=12 -o cachefile= -O compression=on -m none -R /mnt/funtoo rpool /dev/sda2&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the GPT partitioning instructions, you should change /dev/sda2 to /dev/sda3.}}&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have a previous pool that you would like to import, you can do a: '''zpool import -R /mnt/funtoo &amp;lt;pool_name&amp;gt;'''}}&lt;br /&gt;
&lt;br /&gt;
=== Create the zfs datasets ===&lt;br /&gt;
We will now create some datasets. For this installation, we will create a small but future proof amount of datasets. We will have a dataset for the OS (/), and your swap. We will also show you how to create some optional datasets: /home, /var, /usr/src, and /usr/portage.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Create some empty containers for organization purposes, and make the dataset that will hold /&lt;br /&gt;
# ##i##zfs create -o mountpoint=none rpool/ROOT&lt;br /&gt;
# ##i##zfs create -o mountpoint=/ rpool/ROOT/funtoo&lt;br /&gt;
&lt;br /&gt;
Optional, but recommended datasets: /home, /root &lt;br /&gt;
# ##i##zfs create -o mountpoint=/home rpool/HOME&lt;br /&gt;
# ##i##zfs create -o mountpoint=/root rpool/HOME/root&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&lt;br /&gt;
# ##i##zfs create -o mountpoint=none rpool/FUNTOO&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/src rpool/FUNTOO/src&lt;br /&gt;
# ##i##zfs create -o mountpoint=/var rpool/FUNTOO/var&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a separate portage dataset (optional) ====&lt;br /&gt;
&lt;br /&gt;
Creating a separate portage dataset could be useful if you would like to keep your portage tree, distfiles (source code files), and packages (your compiled binaries if you have FEATURES=&amp;quot;buildpkg&amp;quot; enabled) in a safe place (or if you want to back up this directory up easily).&lt;br /&gt;
&lt;br /&gt;
This requires a few extra steps because we can't just do a regular emerge --sync when we initially chroot. We will need to download a portage snapshot tarball and extract it into the directory.&lt;br /&gt;
&lt;br /&gt;
The required steps for getting and extracting the snapshot will be shown later on in the guide once you chroot into the environment. For now just create the datasets:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage -o compression=off rpool/FUNTOO/portage&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/distfiles -o compression=off rpool/FUNTOO/distfiles&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create your swap zvol ===&lt;br /&gt;
&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of RAM (This is kinda big though).'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs create -o sync=always -o primarycache=metadata -o secondarycache=none -V 9G rpool/swap&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Format your swap zvol ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkswap -f /dev/zvol/rpool/swap&lt;br /&gt;
# ##i##swapon /dev/zvol/rpool/swap&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright that finishes the creation of the zpool and zfs datasets. &lt;br /&gt;
&lt;br /&gt;
Check to make sure everything appears fine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool status&lt;br /&gt;
# ##i##zfs list&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the zpool.cache file to your new environment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkdir -p /mnt/funtoo/etc/zfs&lt;br /&gt;
# ##i##cp /etc/zfs/zpool.cache /mnt/funtoo/etc/zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make an empty mtab file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##touch /mnt/funtoo/etc/mtab&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we will continue to install funtoo.&lt;br /&gt;
&lt;br /&gt;
== Installing Funtoo ==&lt;br /&gt;
&lt;br /&gt;
[[Funtoo_Linux_Installation|Download and install the Funtoo stage3 and continue installation as normal.]]&lt;br /&gt;
&lt;br /&gt;
Then chroot into your new funtoo environment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /mnt/funtoo&lt;br /&gt;
&lt;br /&gt;
Mount your boot drive&lt;br /&gt;
# ##i##mount /dev/sda1 /mnt/funtoo/boot&lt;br /&gt;
&lt;br /&gt;
Bind the kernel related directories&lt;br /&gt;
# ##i##mount --bind /proc ./proc&lt;br /&gt;
# ##i##mount --bind /dev ./dev&lt;br /&gt;
# ##i##mount --bind /sys ./sys&lt;br /&gt;
&lt;br /&gt;
Copy network settings&lt;br /&gt;
# ##i##cp /etc/resolv.conf etc/&lt;br /&gt;
&lt;br /&gt;
chroot into your new funtoo environment&lt;br /&gt;
# ##i##env -i HOME=/root TERM=$TERM chroot . bash -l&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Syncing your portage tree ===&lt;br /&gt;
&lt;br /&gt;
==== If you didn't create a separate portage dataset, then just sync your portage tree as normal. ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge --sync&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== If you did create a separate portage dataset, let's now get the portage snapshot set up. ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Change into your /usr directory&lt;br /&gt;
# ##i##cd /usr&lt;br /&gt;
&lt;br /&gt;
Download and extract the portage snapshot&lt;br /&gt;
# ##i##wget http://ftp.osuosl.org/pub/funtoo/funtoo-current/snapshots/portage-latest.tar.xz&lt;br /&gt;
# ##i##tar xf portage-latest.tar.xz&lt;br /&gt;
&lt;br /&gt;
Change into your portage directory and checkout the funtoo branch&lt;br /&gt;
# ##i##cd portage&lt;br /&gt;
# ##i##git checkout funtoo.org&lt;br /&gt;
&lt;br /&gt;
Now sync your portage tree&lt;br /&gt;
# ##i##emerge --sync&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Kernel Configuration ==&lt;br /&gt;
&lt;br /&gt;
Tested with kernel 2.6.32, 3.2.34, 3.6.9, 3.7.1.&lt;br /&gt;
&lt;br /&gt;
When you get up to the kernel, make sure that you disable the CFQ scheduler, and turn&lt;br /&gt;
on No-op (It's the default one once you disable all schedulers). The reason for this is because ZFS has its&lt;br /&gt;
own scheduler and the CFQ one conflicts with it.&lt;br /&gt;
&lt;br /&gt;
Go to your kernel config, and make sure you have the following: (there should be a /usr/src/linux symlink as well)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ZLIB_INFLATE/DEFLATE must be compiled into the kernel (not as a module).&lt;br /&gt;
&amp;gt; ZLIB_INFLATE [=y], ZLIB_DEFLATE [=y]&lt;br /&gt;
&lt;br /&gt;
General setup ---&amp;gt;&lt;br /&gt;
&amp;gt; [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support&lt;br /&gt;
&amp;gt; () Initramfs source file(s)&lt;br /&gt;
&lt;br /&gt;
[*] Enable loadable module support ---&amp;gt;&lt;br /&gt;
[*] Module unloading&lt;br /&gt;
&lt;br /&gt;
Enable the block layer ---&amp;gt;&lt;br /&gt;
IO Schedulers ---&amp;gt;&lt;br /&gt;
&amp;lt; &amp;gt; Deadline I/O scheduler&lt;br /&gt;
&amp;lt; &amp;gt; CFQ I/O scheduler&lt;br /&gt;
Default I/O scheduler (No-op)&lt;br /&gt;
&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
&amp;gt; Generic Driver Options ---&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; [*] Maintain a devtmpfs filesystem to mount at /dev&lt;br /&gt;
&amp;gt;&amp;gt; [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Continue and compile/install your kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##make bzImage modules&lt;br /&gt;
# ##i##make install&lt;br /&gt;
# ##i##make modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installing the ZFS userspace tools ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge -av zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check to make sure that the zfs tools are working, the zpool.cache file that you copied before should be displayed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool status&lt;br /&gt;
# ##i##zfs list&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything worked, continue.&lt;br /&gt;
&lt;br /&gt;
== Create the initramfs ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to do this, you can use genkernel, or you can use my bliss initramfs creator. I will&lt;br /&gt;
show you both.&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
&lt;br /&gt;
Make sure you compile sys-apps/busybox with the static flag.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-apps/busybox static&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge -av sys-apps/busybox&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone my creator which is located at: git://github.com/fearedbliss/Bliss-Initramfs-Creator.git&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/Bliss-Initramfs-Creator.git&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then go into this new directory, run the script as root, and place it into /boot&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd Bliss-Initramfs-Creator&lt;br /&gt;
# ##i##./createInit&lt;br /&gt;
# ##i##mv initrd-&amp;lt;kernel_name&amp;gt;.img /boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;kernel_name&amp;gt;''' is the name of what you selected in the initramfs creator, and the name of the outputted file.&lt;br /&gt;
&lt;br /&gt;
Once you do this just go to your bootloader config, and add it in there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
Kernel name is: vmlinuz-3.7.1-ALL&lt;br /&gt;
initramfs name is: initrd-3.7.1-ALL.img&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
extlinux.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo&lt;br /&gt;
  MENU LABEL Funtoo 3.7.1-ALL&lt;br /&gt;
  KERNEL /boot/vmlinuz-3.7.1-ALL&lt;br /&gt;
  INITRD /boot/initrd-3.7.1-ALL.img&lt;br /&gt;
  APPEND pool_root=rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== genkernel ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge -av sys-kernel/genkernel&lt;br /&gt;
# ##i##genkernel --zfs initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
kernel name is: vmlinuz-3.7.1-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.7.1-ALL&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&lt;br /&gt;
extlinux.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo&lt;br /&gt;
  MENU LABEL Funtoo 3.7.1-ALL&lt;br /&gt;
  KERNEL /boot/vmlinuz-3.7.1-ALL&lt;br /&gt;
  INITRD /boot/initramfs-genkernel-x86_64-3.7.1-ALL&lt;br /&gt;
  APPEND real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Final configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Add the zfs tools to openrc ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##rc-update add zfs boot&lt;br /&gt;
# ##i##rc-update add zfs-shutdown shutdown&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Add filesystems to /etc/fstab ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##nano /etc/fstab&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;fs&amp;gt;                  &amp;lt;mountpoint&amp;gt;    &amp;lt;type&amp;gt;          &amp;lt;opts&amp;gt;          &amp;lt;dump/pass&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/dev/sda1               /boot           ext4            defaults        1 2&lt;br /&gt;
/dev/zvol/rpool/swap    none            swap            sw              0 0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Clean up and reboot ===&lt;br /&gt;
We are almost done, we are just going to clean up, '''set our root password''', and unmount whatever we mounted and get out.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Delete the stage3/portage tarballs you downloaded earlier so they don't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-latest.tar.xz&lt;br /&gt;
# ##i##rm /usr/portage-latest.tar.xz&lt;br /&gt;
&lt;br /&gt;
Set your root password&lt;br /&gt;
# ##i##passwd&lt;br /&gt;
&amp;gt;&amp;gt; Enter your password, you won't see what you are writing (for security reasons), but it is there!&lt;br /&gt;
&lt;br /&gt;
Get out of the chroot environment&lt;br /&gt;
# ##i##exit&lt;br /&gt;
&lt;br /&gt;
Unmount all the kernel filesystem stuff and boot&lt;br /&gt;
# ##i##cd /mnt/funtoo&lt;br /&gt;
# ##i##umount proc dev sys boot&lt;br /&gt;
&lt;br /&gt;
Turn off the swap&lt;br /&gt;
# ##i##swapoff /dev/zvol/rpool/swap&lt;br /&gt;
&lt;br /&gt;
Export the zpool&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##zpool export -f rpool&lt;br /&gt;
&lt;br /&gt;
Reboot&lt;br /&gt;
# ##i##reboot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|'''Don't forget to set your root password as stated above before exiting chroot and rebooting. If you don't set the root password, you won't be able to log into your new system.'''}}&lt;br /&gt;
and that should be enough to get your system to boot on ZFS.&lt;br /&gt;
&lt;br /&gt;
== Extra: After reboot ==&lt;br /&gt;
&lt;br /&gt;
After you restart your machine and your inside your desktop, continue to set up anything you need in terms of /etc configurations. Once you have everything the way you like it, take a snapshot of your system. You will be using this snapshot to revert back to this state if anything ever happens to your system down the road. The snapshots are cheap, and almost instant. To take the snapshot of your rootfs, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs snapshot rpool/ROOT/funtoo@install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To see if your snapshot was taken, type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs list -t snapshot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your machine ever fails and you need to get back to this state, just type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs rollback rpool/ROOT/funtoo@install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Recovery Environment ===&lt;br /&gt;
On ZFS it is extremely easy to create a recovery environment using an already working snapshot. So that's what we will be doing. &lt;br /&gt;
&lt;br /&gt;
Create a clone of the @install snapshot which you will use for recovery purposes. If something happens to your main install, you can boot into this clone and fix the main one. One of the differences (maybe the only difference) between a clone and a snapshot is that a clone is rewritable while a snapshot is only read-only.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs clone rpool/ROOT/funtoo@install rpool/ROOT/recovery&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add the clone to your extlinux.conf ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo-recovery&lt;br /&gt;
    MENU LABEL Funtoo Recovery&lt;br /&gt;
    KERNEL /boot/vmlinuz-3.7.1-ALL&lt;br /&gt;
    INITRD /boot/initrd-3.7.1-ALL.img&lt;br /&gt;
    APPEND pool_root=rpool/ROOT/recovery&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Things to watch out for ====&lt;br /&gt;
&lt;br /&gt;
Since your recovery clone will tend to get old as you use your main system, and since &lt;br /&gt;
your recovery and other stuff are on the same pool, we don't want the new pool stuff&lt;br /&gt;
to be mounted when we launch recovery. We also don't want video drivers to be&lt;br /&gt;
conflicting.&lt;br /&gt;
&lt;br /&gt;
1. Make sure that nvidia/nouveau stuff are blacklisted.&lt;br /&gt;
2. Make sure that your /boot and /lib/modules for the kernel in your 'recovery' are&lt;br /&gt;
matching.&lt;br /&gt;
3. Disable the zfs openrc script so that nothing else gets automatically mounted.&lt;br /&gt;
Only your rootfs.&lt;br /&gt;
&lt;br /&gt;
You can do the above stuff by mounting your copy and chrooting into it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Mount the recovery clone&lt;br /&gt;
# ##i##mkdir /mnt/recovery&lt;br /&gt;
# ##i##mount -t zfs -o zfsutil rpool/ROOT/recovery /mnt/recovery&lt;br /&gt;
# ##i##cd /mnt/recovery&lt;br /&gt;
&lt;br /&gt;
Mount the kernel devices&lt;br /&gt;
# ##i##mount --bind /proc ./proc&lt;br /&gt;
# ##i##mount --bind /dev ./dev&lt;br /&gt;
# ##i##mount --bind /sys ./sys&lt;br /&gt;
&lt;br /&gt;
Copy zpool.cache&lt;br /&gt;
# ##i##cp /etc/zfs/zpool.cache etc/zfs&lt;br /&gt;
&lt;br /&gt;
Chroot into the new environment&lt;br /&gt;
# ##i##env -i HOME=/root TERM=$TERM chroot . bash --login&lt;br /&gt;
&lt;br /&gt;
Disable zfs/zfs-shutdown openrc scripts&lt;br /&gt;
# ##i##rc-config delete zfs boot&lt;br /&gt;
# ##i##rc-config delete zfs-shutdown shutdown&lt;br /&gt;
&lt;br /&gt;
Blacklist nouveau/nvidia drivers&lt;br /&gt;
# ##i##echo &amp;quot;blacklist nouveau&amp;quot; &amp;gt;&amp;gt; /etc/modprobe.d/blacklist.conf&lt;br /&gt;
# ##i##echo &amp;quot;blacklist nvidia&amp;quot; &amp;gt;&amp;gt; /etc/modprobe.d/blacklist.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Getting into the recovery ====&lt;br /&gt;
Just start your machine and pick the '''Funtoo Recovery''' option from the Boot Menu.&lt;br /&gt;
&lt;br /&gt;
Enjoy your new install on ZFS :)&lt;br /&gt;
[[Category:HOWTO]]&lt;br /&gt;
[[Category:Filesystems]]&lt;/div&gt;</summary>
		<author><name>Ryao</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/ZFS_Install_Guide</id>
		<title>ZFS Install Guide</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/ZFS_Install_Guide"/>
				<updated>2013-01-05T19:29:32Z</updated>
		
		<summary type="html">&lt;p&gt;Ryao: Make note about /dev/sda3.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial will show you how to install Funtoo on ZFS (rootfs).&lt;br /&gt;
&lt;br /&gt;
This tutorial is meant to be an &amp;quot;overlay&amp;quot; over the [[Funtoo_Linux_Installation|Regular Funtoo Installation]]. Follow the normal installation and only use this guide for steps 2, 3, and 8.&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|'''Since ZFS was really designed for 64 bit systems, we are only recommending and supporting 64 bit platforms and installations. We will not be supporting 32 bit platforms'''!}}&lt;br /&gt;
&lt;br /&gt;
== Setting up your environment ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS userspace tools. We will be downloading two things, System Rescue CD 3.1.2, and the ZFS SRM (System Rescue Module). This is just a file that when combined with System Rescue CD, gives you ZFS functionality.&lt;br /&gt;
&lt;br /&gt;
[https://sourceforge.net/projects/systemrescuecd/files/sysresccd-x86/3.1.2/systemrescuecd-x86-3.1.2.iso/download Download System Rescue CD 3.1.2]&lt;br /&gt;
&lt;br /&gt;
[http://jonathanvasquez.com/files/sysresccd/ Download the ZFS System Rescue Module]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SystemRescueCd-x86-3.1.2 (350 MiB)&lt;br /&gt;
Release Date: 2012-12-05&lt;br /&gt;
&lt;br /&gt;
md5sum 3c1ddfe5f26bb2f979a2ed9dfb504ee3&lt;br /&gt;
sha1sum 217cf7a81380d894b2433c59451787c16bc0af2f&lt;br /&gt;
sha256sum ec0a995875e64ff9816a043737e5cbbb689b7f596b48679116f0a779f3dce673&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you place the ISO on your USB flash drive, extract the modules from the tarball, and place the .srm and .md5 at the root of your USB filesystem. Further instructions can be found [[Creating_System_Rescue_CD_Modules#Using_the_prebuilt_srm|here]]. &lt;br /&gt;
&lt;br /&gt;
We will now start to partition the system. Open up a terminal, and type in the following (We will assume it's a fresh drive for simplicity).&lt;br /&gt;
&lt;br /&gt;
== Creating partitions ==&lt;br /&gt;
&lt;br /&gt;
We will be creating two partitions, /boot, and the remaining disk space will be for ZFS.&lt;br /&gt;
&lt;br /&gt;
(All commands will be ran as root).&lt;br /&gt;
&lt;br /&gt;
=== fdisk (MBR Style) ===&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 1''' (boot):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition type: ##i##↵&lt;br /&gt;
Partition number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+250M ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (ZFS):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition type: ##i##↵&lt;br /&gt;
Partition number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##t ↵&lt;br /&gt;
Partition number: ##i##2 ↵&lt;br /&gt;
Hex code (type L to list codes): ##i##bf ↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##p ↵&lt;br /&gt;
&lt;br /&gt;
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes&lt;br /&gt;
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors&lt;br /&gt;
Units = sectors of 1 * 512 = 512 bytes&lt;br /&gt;
Sector size (logical/physical): 512 bytes / 512 bytes&lt;br /&gt;
I/O size (minimum/optimal): 512 bytes / 512 bytes&lt;br /&gt;
Disk identifier: 0x3e954df7&lt;br /&gt;
&lt;br /&gt;
   Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;
/dev/sda1            2048      514047      256000   83  Linux&lt;br /&gt;
/dev/sda2          514048  1953525167   976505560   bf  Solaris&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== gdisk (GPT Style) ===&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 1''' (boot):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+250M ↵&lt;br /&gt;
Hex Code: ##i##↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (BIOS Boot Partition):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+32M ↵&lt;br /&gt;
Hex Code: ##i##EF02 ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|Only make the above BIOS Boot Partition if you are using GRUB 2 on GPT. If you are using the extlinux bootloader, this partition is not necessary. The below instructions continue as if you did not create this partition and assumes you are using extlinux as the bootloader.}}&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (ZFS):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##↵&lt;br /&gt;
Hex Code: ##i##bf01 ↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##p ↵&lt;br /&gt;
Disk /dev/sda: 1953525168 sectors, 931.5 GiB&lt;br /&gt;
Logical sector size: 512 bytes&lt;br /&gt;
Disk identifier (GUID): C0C1E56A-B24F-492F-95DB-2E227676F228&lt;br /&gt;
Partition table holds up to 128 entries&lt;br /&gt;
First usable sector is 34, last usable sector is 1953525134&lt;br /&gt;
Partitions will be aligned on 2048-sector boundaries&lt;br /&gt;
Total free space is 2014 sectors (1007.0 KiB)&lt;br /&gt;
&lt;br /&gt;
Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          514047   250.0 MiB   8300  Linux filesystem&lt;br /&gt;
   2          514048      1953525134   931.3 GiB   BF01  Solaris /usr &amp;amp; Mac ZFS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Format your boot volume ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkfs.ext4 /dev/sda1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create the zpool ===&lt;br /&gt;
We will first create the pool. The pool will be named `rpool` and the disk will be aligned to 4096 (using ashift=12)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool create -f -o ashift=12 -o cachefile= -O compression=on -m none -R /mnt/funtoo rpool /dev/sda2&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you followed the GPT partitioning instructions, you should change /dev/sda2 to /dev/sda3. Also, if you have a previous pool that you would like to import, you can do a: '''zpool import -R /mnt/funtoo &amp;lt;pool_name&amp;gt;'''}}&lt;br /&gt;
&lt;br /&gt;
=== Create the zfs datasets ===&lt;br /&gt;
We will now create some datasets. For this installation, we will create a small but future proof amount of datasets. We will have a dataset for the OS (/), and your swap. We will also show you how to create some optional datasets: /home, /var, /usr/src, and /usr/portage.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Create some empty containers for organization purposes, and make the dataset that will hold /&lt;br /&gt;
# ##i##zfs create -o mountpoint=none rpool/ROOT&lt;br /&gt;
# ##i##zfs create -o mountpoint=/ rpool/ROOT/funtoo&lt;br /&gt;
&lt;br /&gt;
Optional, but recommended datasets: /home, /root &lt;br /&gt;
# ##i##zfs create -o mountpoint=/home rpool/HOME&lt;br /&gt;
# ##i##zfs create -o mountpoint=/root rpool/HOME/root&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&lt;br /&gt;
# ##i##zfs create -o mountpoint=none rpool/FUNTOO&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/src rpool/FUNTOO/src&lt;br /&gt;
# ##i##zfs create -o mountpoint=/var rpool/FUNTOO/var&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a separate portage dataset (optional) ====&lt;br /&gt;
&lt;br /&gt;
Creating a separate portage dataset could be useful if you would like to keep your portage tree, distfiles (source code files), and packages (your compiled binaries if you have FEATURES=&amp;quot;buildpkg&amp;quot; enabled) in a safe place (or if you want to back up this directory up easily).&lt;br /&gt;
&lt;br /&gt;
This requires a few extra steps because we can't just do a regular emerge --sync when we initially chroot. We will need to download a portage snapshot tarball and extract it into the directory.&lt;br /&gt;
&lt;br /&gt;
The required steps for getting and extracting the snapshot will be shown later on in the guide once you chroot into the environment. For now just create the datasets:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage -o compression=off rpool/FUNTOO/portage&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/distfiles -o compression=off rpool/FUNTOO/distfiles&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create your swap zvol ===&lt;br /&gt;
&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of RAM (This is kinda big though).'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs create -o sync=always -o primarycache=metadata -o secondarycache=none -V 9G rpool/swap&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Format your swap zvol ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkswap -f /dev/zvol/rpool/swap&lt;br /&gt;
# ##i##swapon /dev/zvol/rpool/swap&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright that finishes the creation of the zpool and zfs datasets. &lt;br /&gt;
&lt;br /&gt;
Check to make sure everything appears fine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool status&lt;br /&gt;
# ##i##zfs list&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the zpool.cache file to your new environment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkdir -p /mnt/funtoo/etc/zfs&lt;br /&gt;
# ##i##cp /etc/zfs/zpool.cache /mnt/funtoo/etc/zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make an empty mtab file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##touch /mnt/funtoo/etc/mtab&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we will continue to install funtoo.&lt;br /&gt;
&lt;br /&gt;
== Installing Funtoo ==&lt;br /&gt;
&lt;br /&gt;
[[Funtoo_Linux_Installation|Download and install the Funtoo stage3 and continue installation as normal.]]&lt;br /&gt;
&lt;br /&gt;
Then chroot into your new funtoo environment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /mnt/funtoo&lt;br /&gt;
&lt;br /&gt;
Mount your boot drive&lt;br /&gt;
# ##i##mount /dev/sda1 /mnt/funtoo/boot&lt;br /&gt;
&lt;br /&gt;
Bind the kernel related directories&lt;br /&gt;
# ##i##mount --bind /proc ./proc&lt;br /&gt;
# ##i##mount --bind /dev ./dev&lt;br /&gt;
# ##i##mount --bind /sys ./sys&lt;br /&gt;
&lt;br /&gt;
Copy network settings&lt;br /&gt;
# ##i##cp /etc/resolv.conf etc/&lt;br /&gt;
&lt;br /&gt;
chroot into your new funtoo environment&lt;br /&gt;
# ##i##env -i HOME=/root TERM=$TERM chroot . bash -l&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Syncing your portage tree ===&lt;br /&gt;
&lt;br /&gt;
==== If you didn't create a separate portage dataset, then just sync your portage tree as normal. ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge --sync&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== If you did create a separate portage dataset, let's now get the portage snapshot set up. ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Change into your /usr directory&lt;br /&gt;
# ##i##cd /usr&lt;br /&gt;
&lt;br /&gt;
Download and extract the portage snapshot&lt;br /&gt;
# ##i##wget http://ftp.osuosl.org/pub/funtoo/funtoo-current/snapshots/portage-latest.tar.xz&lt;br /&gt;
# ##i##tar xf portage-latest.tar.xz&lt;br /&gt;
&lt;br /&gt;
Change into your portage directory and checkout the funtoo branch&lt;br /&gt;
# ##i##cd portage&lt;br /&gt;
# ##i##git checkout funtoo.org&lt;br /&gt;
&lt;br /&gt;
Now sync your portage tree&lt;br /&gt;
# ##i##emerge --sync&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Kernel Configuration ==&lt;br /&gt;
&lt;br /&gt;
Tested with kernel 2.6.32, 3.2.34, 3.6.9, 3.7.1.&lt;br /&gt;
&lt;br /&gt;
When you get up to the kernel, make sure that you disable the CFQ scheduler, and turn&lt;br /&gt;
on No-op (It's the default one once you disable all schedulers). The reason for this is because ZFS has its&lt;br /&gt;
own scheduler and the CFQ one conflicts with it.&lt;br /&gt;
&lt;br /&gt;
Go to your kernel config, and make sure you have the following: (there should be a /usr/src/linux symlink as well)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ZLIB_INFLATE/DEFLATE must be compiled into the kernel (not as a module).&lt;br /&gt;
&amp;gt; ZLIB_INFLATE [=y], ZLIB_DEFLATE [=y]&lt;br /&gt;
&lt;br /&gt;
General setup ---&amp;gt;&lt;br /&gt;
&amp;gt; [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support&lt;br /&gt;
&amp;gt; () Initramfs source file(s)&lt;br /&gt;
&lt;br /&gt;
[*] Enable loadable module support ---&amp;gt;&lt;br /&gt;
[*] Module unloading&lt;br /&gt;
&lt;br /&gt;
Enable the block layer ---&amp;gt;&lt;br /&gt;
IO Schedulers ---&amp;gt;&lt;br /&gt;
&amp;lt; &amp;gt; Deadline I/O scheduler&lt;br /&gt;
&amp;lt; &amp;gt; CFQ I/O scheduler&lt;br /&gt;
Default I/O scheduler (No-op)&lt;br /&gt;
&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
&amp;gt; Generic Driver Options ---&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; [*] Maintain a devtmpfs filesystem to mount at /dev&lt;br /&gt;
&amp;gt;&amp;gt; [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Continue and compile/install your kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##make bzImage modules&lt;br /&gt;
# ##i##make install&lt;br /&gt;
# ##i##make modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installing the ZFS userspace tools ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge -av zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check to make sure that the zfs tools are working, the zpool.cache file that you copied before should be displayed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool status&lt;br /&gt;
# ##i##zfs list&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything worked, continue.&lt;br /&gt;
&lt;br /&gt;
== Create the initramfs ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to do this, you can use genkernel, or you can use my bliss initramfs creator. I will&lt;br /&gt;
show you both.&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
&lt;br /&gt;
Make sure you compile sys-apps/busybox with the static flag.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-apps/busybox static&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge -av sys-apps/busybox&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone my creator which is located at: git://github.com/fearedbliss/Bliss-Initramfs-Creator.git&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/Bliss-Initramfs-Creator.git&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then go into this new directory, run the script as root, and place it into /boot&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd Bliss-Initramfs-Creator&lt;br /&gt;
# ##i##./createInit&lt;br /&gt;
# ##i##mv initrd-&amp;lt;kernel_name&amp;gt;.img /boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;kernel_name&amp;gt;''' is the name of what you selected in the initramfs creator, and the name of the outputted file.&lt;br /&gt;
&lt;br /&gt;
Once you do this just go to your bootloader config, and add it in there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
Kernel name is: vmlinuz-3.7.1-ALL&lt;br /&gt;
initramfs name is: initrd-3.7.1-ALL.img&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
extlinux.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo&lt;br /&gt;
  MENU LABEL Funtoo 3.7.1-ALL&lt;br /&gt;
  KERNEL /boot/vmlinuz-3.7.1-ALL&lt;br /&gt;
  INITRD /boot/initrd-3.7.1-ALL.img&lt;br /&gt;
  APPEND pool_root=rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== genkernel ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge -av sys-kernel/genkernel&lt;br /&gt;
# ##i##genkernel --zfs initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
kernel name is: vmlinuz-3.7.1-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.7.1-ALL&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&lt;br /&gt;
extlinux.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo&lt;br /&gt;
  MENU LABEL Funtoo 3.7.1-ALL&lt;br /&gt;
  KERNEL /boot/vmlinuz-3.7.1-ALL&lt;br /&gt;
  INITRD /boot/initramfs-genkernel-x86_64-3.7.1-ALL&lt;br /&gt;
  APPEND real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Final configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Add the zfs tools to openrc ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##rc-update add zfs boot&lt;br /&gt;
# ##i##rc-update add zfs-shutdown shutdown&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Add filesystems to /etc/fstab ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##nano /etc/fstab&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;fs&amp;gt;                  &amp;lt;mountpoint&amp;gt;    &amp;lt;type&amp;gt;          &amp;lt;opts&amp;gt;          &amp;lt;dump/pass&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/dev/sda1               /boot           ext4            defaults        1 2&lt;br /&gt;
/dev/zvol/rpool/swap    none            swap            sw              0 0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Clean up and reboot ===&lt;br /&gt;
We are almost done, we are just going to clean up, '''set our root password''', and unmount whatever we mounted and get out.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Delete the stage3/portage tarballs you downloaded earlier so they don't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-latest.tar.xz&lt;br /&gt;
# ##i##rm /usr/portage-latest.tar.xz&lt;br /&gt;
&lt;br /&gt;
Set your root password&lt;br /&gt;
# ##i##passwd&lt;br /&gt;
&amp;gt;&amp;gt; Enter your password, you won't see what you are writing (for security reasons), but it is there!&lt;br /&gt;
&lt;br /&gt;
Get out of the chroot environment&lt;br /&gt;
# ##i##exit&lt;br /&gt;
&lt;br /&gt;
Unmount all the kernel filesystem stuff and boot&lt;br /&gt;
# ##i##cd /mnt/funtoo&lt;br /&gt;
# ##i##umount proc dev sys boot&lt;br /&gt;
&lt;br /&gt;
Turn off the swap&lt;br /&gt;
# ##i##swapoff /dev/zvol/rpool/swap&lt;br /&gt;
&lt;br /&gt;
Export the zpool&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##zpool export -f rpool&lt;br /&gt;
&lt;br /&gt;
Reboot&lt;br /&gt;
# ##i##reboot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|'''Don't forget to set your root password as stated above before exiting chroot and rebooting. If you don't set the root password, you won't be able to log into your new system.'''}}&lt;br /&gt;
and that should be enough to get your system to boot on ZFS.&lt;br /&gt;
&lt;br /&gt;
== Extra: After reboot ==&lt;br /&gt;
&lt;br /&gt;
After you restart your machine and your inside your desktop, continue to set up anything you need in terms of /etc configurations. Once you have everything the way you like it, take a snapshot of your system. You will be using this snapshot to revert back to this state if anything ever happens to your system down the road. The snapshots are cheap, and almost instant. To take the snapshot of your rootfs, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs snapshot rpool/ROOT/funtoo@install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To see if your snapshot was taken, type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs list -t snapshot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your machine ever fails and you need to get back to this state, just type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs rollback rpool/ROOT/funtoo@install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Recovery Environment ===&lt;br /&gt;
On ZFS it is extremely easy to create a recovery environment using an already working snapshot. So that's what we will be doing. &lt;br /&gt;
&lt;br /&gt;
Create a clone of the @install snapshot which you will use for recovery purposes. If something happens to your main install, you can boot into this clone and fix the main one. One of the differences (maybe the only difference) between a clone and a snapshot is that a clone is rewritable while a snapshot is only read-only.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs clone rpool/ROOT/funtoo@install rpool/ROOT/recovery&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add the clone to your extlinux.conf ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo-recovery&lt;br /&gt;
    MENU LABEL Funtoo Recovery&lt;br /&gt;
    KERNEL /boot/vmlinuz-3.7.1-ALL&lt;br /&gt;
    INITRD /boot/initrd-3.7.1-ALL.img&lt;br /&gt;
    APPEND pool_root=rpool/ROOT/recovery&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Things to watch out for ====&lt;br /&gt;
&lt;br /&gt;
Since your recovery clone will tend to get old as you use your main system, and since &lt;br /&gt;
your recovery and other stuff are on the same pool, we don't want the new pool stuff&lt;br /&gt;
to be mounted when we launch recovery. We also don't want video drivers to be&lt;br /&gt;
conflicting.&lt;br /&gt;
&lt;br /&gt;
1. Make sure that nvidia/nouveau stuff are blacklisted.&lt;br /&gt;
2. Make sure that your /boot and /lib/modules for the kernel in your 'recovery' are&lt;br /&gt;
matching.&lt;br /&gt;
3. Disable the zfs openrc script so that nothing else gets automatically mounted.&lt;br /&gt;
Only your rootfs.&lt;br /&gt;
&lt;br /&gt;
You can do the above stuff by mounting your copy and chrooting into it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Mount the recovery clone&lt;br /&gt;
# ##i##mkdir /mnt/recovery&lt;br /&gt;
# ##i##mount -t zfs -o zfsutil rpool/ROOT/recovery /mnt/recovery&lt;br /&gt;
# ##i##cd /mnt/recovery&lt;br /&gt;
&lt;br /&gt;
Mount the kernel devices&lt;br /&gt;
# ##i##mount --bind /proc ./proc&lt;br /&gt;
# ##i##mount --bind /dev ./dev&lt;br /&gt;
# ##i##mount --bind /sys ./sys&lt;br /&gt;
&lt;br /&gt;
Copy zpool.cache&lt;br /&gt;
# ##i##cp /etc/zfs/zpool.cache etc/zfs&lt;br /&gt;
&lt;br /&gt;
Chroot into the new environment&lt;br /&gt;
# ##i##env -i HOME=/root TERM=$TERM chroot . bash --login&lt;br /&gt;
&lt;br /&gt;
Disable zfs/zfs-shutdown openrc scripts&lt;br /&gt;
# ##i##rc-config delete zfs boot&lt;br /&gt;
# ##i##rc-config delete zfs-shutdown shutdown&lt;br /&gt;
&lt;br /&gt;
Blacklist nouveau/nvidia drivers&lt;br /&gt;
# ##i##echo &amp;quot;blacklist nouveau&amp;quot; &amp;gt;&amp;gt; /etc/modprobe.d/blacklist.conf&lt;br /&gt;
# ##i##echo &amp;quot;blacklist nvidia&amp;quot; &amp;gt;&amp;gt; /etc/modprobe.d/blacklist.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Getting into the recovery ====&lt;br /&gt;
Just start your machine and pick the '''Funtoo Recovery''' option from the Boot Menu.&lt;br /&gt;
&lt;br /&gt;
Enjoy your new install on ZFS :)&lt;br /&gt;
[[Category:HOWTO]]&lt;br /&gt;
[[Category:Filesystems]]&lt;/div&gt;</summary>
		<author><name>Ryao</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/User:Ryao</id>
		<title>User:Ryao</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/User:Ryao"/>
				<updated>2013-01-05T19:23:35Z</updated>
		
		<summary type="html">&lt;p&gt;Ryao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Person&lt;br /&gt;
|Full name=Richard Yao&lt;br /&gt;
|Email=ryao@gentoo.org&lt;br /&gt;
|Nick=ryao&lt;br /&gt;
|Geoloc=40.9955012, -74.3439009&lt;br /&gt;
|Location name=Stony Brook, New York, United States of America&lt;br /&gt;
|Roles=&lt;br /&gt;
|Maintains=&lt;br /&gt;
|Blogs={{Blog&lt;br /&gt;
|Name=Richard Yao's Blog&lt;br /&gt;
|URL=http://blogs.gentoo.org/ryao&lt;br /&gt;
}}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Ryao</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/User:Ryao</id>
		<title>User:Ryao</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/User:Ryao"/>
				<updated>2013-01-05T19:23:13Z</updated>
		
		<summary type="html">&lt;p&gt;Ryao: Undo revision 8528 by Ryao (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Person&lt;br /&gt;
|Full name=Richard Yao&lt;br /&gt;
|Email=ryao@gentoo.org&lt;br /&gt;
|Nick=ryao&lt;br /&gt;
|Geoloc=New York&lt;br /&gt;
|Location name=Stony Brook, New York, United States of America&lt;br /&gt;
|Roles=&lt;br /&gt;
|Maintains=&lt;br /&gt;
|Blogs={{Blog&lt;br /&gt;
|Name=Richard Yao's Blog&lt;br /&gt;
|URL=http://blogs.gentoo.org/ryao&lt;br /&gt;
}}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Ryao</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/User:Ryao</id>
		<title>User:Ryao</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/User:Ryao"/>
				<updated>2013-01-05T19:22:54Z</updated>
		
		<summary type="html">&lt;p&gt;Ryao: Undo revision 8529 by Ryao (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Person&lt;br /&gt;
|Full name=Richard Yao&lt;br /&gt;
|Email=ryao@gentoo.org&lt;br /&gt;
|Nick=ryao&lt;br /&gt;
|Geoloc=&lt;br /&gt;
|Location name=Stony Brook, New York, United States of America&lt;br /&gt;
|Roles=&lt;br /&gt;
|Maintains=&lt;br /&gt;
|Blogs={{Blog&lt;br /&gt;
|Name=Richard Yao's Blog&lt;br /&gt;
|URL=http://blogs.gentoo.org/ryao&lt;br /&gt;
}}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Ryao</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/User:Ryao</id>
		<title>User:Ryao</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/User:Ryao"/>
				<updated>2013-01-05T19:21:12Z</updated>
		
		<summary type="html">&lt;p&gt;Ryao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Person&lt;br /&gt;
|Full name=Richard Yao&lt;br /&gt;
|Email=ryao@gentoo.org&lt;br /&gt;
|Nick=ryao&lt;br /&gt;
|Geoloc=&lt;br /&gt;
|Location name=Stony Brook, New York, United States of America&lt;br /&gt;
|Roles=&lt;br /&gt;
|Maintains=&lt;br /&gt;
|Blogs={{Blog&lt;br /&gt;
|Name=Richard Yao's Blog&lt;br /&gt;
|URL=http://blogs.gentoo.org/ryao&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Ryao</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/User:Ryao</id>
		<title>User:Ryao</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/User:Ryao"/>
				<updated>2013-01-05T19:21:00Z</updated>
		
		<summary type="html">&lt;p&gt;Ryao: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Person&lt;br /&gt;
|Full name=Richard Yao&lt;br /&gt;
|Email=ryao@gentoo.org&lt;br /&gt;
|Nick=ryao&lt;br /&gt;
|Geoloc=&lt;br /&gt;
|Location name=Stony Brook, New York, United States of America&lt;br /&gt;
|Roles=&lt;br /&gt;
|Maintains=&lt;br /&gt;
|Blogs={{Blog&lt;br /&gt;
|Name=Richard Yao's Blog&lt;br /&gt;
|URL=http://blogs.gentoo.org/ryao&lt;br /&gt;
}}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Ryao</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/User:Ryao</id>
		<title>User:Ryao</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/User:Ryao"/>
				<updated>2013-01-05T19:20:34Z</updated>
		
		<summary type="html">&lt;p&gt;Ryao: Created page with &amp;quot;{{Person |Full name=Richard Yao |Email=ryao@gentoo.org |Nick=ryao |Geoloc=New York |Location name=Stony Brook, New York, United States of America |Roles= |Maintains= |Blogs={{...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Person&lt;br /&gt;
|Full name=Richard Yao&lt;br /&gt;
|Email=ryao@gentoo.org&lt;br /&gt;
|Nick=ryao&lt;br /&gt;
|Geoloc=New York&lt;br /&gt;
|Location name=Stony Brook, New York, United States of America&lt;br /&gt;
|Roles=&lt;br /&gt;
|Maintains=&lt;br /&gt;
|Blogs={{Blog&lt;br /&gt;
|Name=Richard Yao's Blog&lt;br /&gt;
|URL=http://blogs.gentoo.org/ryao&lt;br /&gt;
}}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Ryao</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/ZFS_Install_Guide</id>
		<title>ZFS Install Guide</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/ZFS_Install_Guide"/>
				<updated>2013-01-05T19:10:52Z</updated>
		
		<summary type="html">&lt;p&gt;Ryao: The proper term is zvol, not dataset.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial will show you how to install Funtoo on ZFS (rootfs).&lt;br /&gt;
&lt;br /&gt;
This tutorial is meant to be an &amp;quot;overlay&amp;quot; over the [[Funtoo_Linux_Installation|Regular Funtoo Installation]]. Follow the normal installation and only use this guide for steps 2, 3, and 8.&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|'''Since ZFS was really designed for 64 bit systems, we are only recommending and supporting 64 bit platforms and installations. We will not be supporting 32 bit platforms'''!}}&lt;br /&gt;
&lt;br /&gt;
== Setting up your environment ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS userspace tools. We will be downloading two things, System Rescue CD 3.1.2, and the ZFS SRM (System Rescue Module). This is just a file that when combined with System Rescue CD, gives you ZFS functionality.&lt;br /&gt;
&lt;br /&gt;
[https://sourceforge.net/projects/systemrescuecd/files/sysresccd-x86/3.1.2/systemrescuecd-x86-3.1.2.iso/download Download System Rescue CD 3.1.2]&lt;br /&gt;
&lt;br /&gt;
[http://jonathanvasquez.com/files/sysresccd/ Download the ZFS System Rescue Module]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SystemRescueCd-x86-3.1.2 (350 MiB)&lt;br /&gt;
Release Date: 2012-12-05&lt;br /&gt;
&lt;br /&gt;
md5sum 3c1ddfe5f26bb2f979a2ed9dfb504ee3&lt;br /&gt;
sha1sum 217cf7a81380d894b2433c59451787c16bc0af2f&lt;br /&gt;
sha256sum ec0a995875e64ff9816a043737e5cbbb689b7f596b48679116f0a779f3dce673&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you place the ISO on your USB flash drive, extract the modules from the tarball, and place the .srm and .md5 at the root of your USB filesystem. Further instructions can be found [[Creating_System_Rescue_CD_Modules#Using_the_prebuilt_srm|here]]. &lt;br /&gt;
&lt;br /&gt;
We will now start to partition the system. Open up a terminal, and type in the following (We will assume it's a fresh drive for simplicity).&lt;br /&gt;
&lt;br /&gt;
== Creating partitions ==&lt;br /&gt;
&lt;br /&gt;
We will be creating two partitions, /boot, and the remaining disk space will be for ZFS.&lt;br /&gt;
&lt;br /&gt;
(All commands will be ran as root).&lt;br /&gt;
&lt;br /&gt;
=== fdisk (MBR Style) ===&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 1''' (boot):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition type: ##i##↵&lt;br /&gt;
Partition number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+250M ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (ZFS):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition type: ##i##↵&lt;br /&gt;
Partition number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##t ↵&lt;br /&gt;
Partition number: ##i##2 ↵&lt;br /&gt;
Hex code (type L to list codes): ##i##bf ↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##p ↵&lt;br /&gt;
&lt;br /&gt;
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes&lt;br /&gt;
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors&lt;br /&gt;
Units = sectors of 1 * 512 = 512 bytes&lt;br /&gt;
Sector size (logical/physical): 512 bytes / 512 bytes&lt;br /&gt;
I/O size (minimum/optimal): 512 bytes / 512 bytes&lt;br /&gt;
Disk identifier: 0x3e954df7&lt;br /&gt;
&lt;br /&gt;
   Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;
/dev/sda1            2048      514047      256000   83  Linux&lt;br /&gt;
/dev/sda2          514048  1953525167   976505560   bf  Solaris&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== gdisk (GPT Style) ===&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 1''' (boot):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+250M ↵&lt;br /&gt;
Hex Code: ##i##↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (BIOS Boot Partition):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+32M ↵&lt;br /&gt;
Hex Code: ##i##EF02 ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|Only make the above BIOS Boot Partition if you are using GRUB 2 on GPT. If you are using the extlinux bootloader, this partition is not necessary. The below instructions continue as if you did not create this partition and assumes you are using extlinux as the bootloader.}}&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (ZFS):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##↵&lt;br /&gt;
Hex Code: ##i##bf01 ↵&lt;br /&gt;
&lt;br /&gt;
Command: ##i##p ↵&lt;br /&gt;
Disk /dev/sda: 1953525168 sectors, 931.5 GiB&lt;br /&gt;
Logical sector size: 512 bytes&lt;br /&gt;
Disk identifier (GUID): C0C1E56A-B24F-492F-95DB-2E227676F228&lt;br /&gt;
Partition table holds up to 128 entries&lt;br /&gt;
First usable sector is 34, last usable sector is 1953525134&lt;br /&gt;
Partitions will be aligned on 2048-sector boundaries&lt;br /&gt;
Total free space is 2014 sectors (1007.0 KiB)&lt;br /&gt;
&lt;br /&gt;
Number  Start (sector)    End (sector)  Size       Code  Name&lt;br /&gt;
   1            2048          514047   250.0 MiB   8300  Linux filesystem&lt;br /&gt;
   2          514048      1953525134   931.3 GiB   BF01  Solaris /usr &amp;amp; Mac ZFS&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Format your boot volume ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkfs.ext4 /dev/sda1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create the zpool ===&lt;br /&gt;
We will first create the pool. The pool will be named `rpool` and the disk will be aligned to 4096 (using ashift=12)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool create -f -o ashift=12 -o cachefile= -O compression=on -m none -R /mnt/funtoo rpool /dev/sda2&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have a previous pool that you would like to import, you can do a: '''zpool import -R /mnt/funtoo &amp;lt;pool_name&amp;gt;'''}}&lt;br /&gt;
&lt;br /&gt;
=== Create the zfs datasets ===&lt;br /&gt;
We will now create some datasets. For this installation, we will create a small but future proof amount of datasets. We will have a dataset for the OS (/), and your swap. We will also show you how to create some optional datasets: /home, /var, /usr/src, and /usr/portage.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Create some empty containers for organization purposes, and make the dataset that will hold /&lt;br /&gt;
# ##i##zfs create -o mountpoint=none rpool/ROOT&lt;br /&gt;
# ##i##zfs create -o mountpoint=/ rpool/ROOT/funtoo&lt;br /&gt;
&lt;br /&gt;
Optional, but recommended datasets: /home, /root &lt;br /&gt;
# ##i##zfs create -o mountpoint=/home rpool/HOME&lt;br /&gt;
# ##i##zfs create -o mountpoint=/root rpool/HOME/root&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&lt;br /&gt;
# ##i##zfs create -o mountpoint=none rpool/FUNTOO&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/src rpool/FUNTOO/src&lt;br /&gt;
# ##i##zfs create -o mountpoint=/var rpool/FUNTOO/var&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a separate portage dataset (optional) ====&lt;br /&gt;
&lt;br /&gt;
Creating a separate portage dataset could be useful if you would like to keep your portage tree, distfiles (source code files), and packages (your compiled binaries if you have FEATURES=&amp;quot;buildpkg&amp;quot; enabled) in a safe place (or if you want to back up this directory up easily).&lt;br /&gt;
&lt;br /&gt;
This requires a few extra steps because we can't just do a regular emerge --sync when we initially chroot. We will need to download a portage snapshot tarball and extract it into the directory.&lt;br /&gt;
&lt;br /&gt;
The required steps for getting and extracting the snapshot will be shown later on in the guide once you chroot into the environment. For now just create the datasets:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage -o compression=off rpool/FUNTOO/portage&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/distfiles -o compression=off rpool/FUNTOO/distfiles&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create your swap zvol ===&lt;br /&gt;
&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of RAM (This is kinda big though).'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs create -o sync=always -o primarycache=metadata -o secondarycache=none -V 9G rpool/swap&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Format your swap zvol ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkswap -f /dev/zvol/rpool/swap&lt;br /&gt;
# ##i##swapon /dev/zvol/rpool/swap&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alright that finishes the creation of the zpool and zfs datasets. &lt;br /&gt;
&lt;br /&gt;
Check to make sure everything appears fine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool status&lt;br /&gt;
# ##i##zfs list&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy the zpool.cache file to your new environment.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkdir -p /mnt/funtoo/etc/zfs&lt;br /&gt;
# ##i##cp /etc/zfs/zpool.cache /mnt/funtoo/etc/zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make an empty mtab file&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##touch /mnt/funtoo/etc/mtab&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we will continue to install funtoo.&lt;br /&gt;
&lt;br /&gt;
== Installing Funtoo ==&lt;br /&gt;
&lt;br /&gt;
[[Funtoo_Linux_Installation|Download and install the Funtoo stage3 and continue installation as normal.]]&lt;br /&gt;
&lt;br /&gt;
Then chroot into your new funtoo environment:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /mnt/funtoo&lt;br /&gt;
&lt;br /&gt;
Mount your boot drive&lt;br /&gt;
# ##i##mount /dev/sda1 /mnt/funtoo/boot&lt;br /&gt;
&lt;br /&gt;
Bind the kernel related directories&lt;br /&gt;
# ##i##mount --bind /proc ./proc&lt;br /&gt;
# ##i##mount --bind /dev ./dev&lt;br /&gt;
# ##i##mount --bind /sys ./sys&lt;br /&gt;
&lt;br /&gt;
Copy network settings&lt;br /&gt;
# ##i##cp /etc/resolv.conf etc/&lt;br /&gt;
&lt;br /&gt;
chroot into your new funtoo environment&lt;br /&gt;
# ##i##env -i HOME=/root TERM=$TERM chroot . bash -l&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Syncing your portage tree ===&lt;br /&gt;
&lt;br /&gt;
==== If you didn't create a separate portage dataset, then just sync your portage tree as normal. ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge --sync&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== If you did create a separate portage dataset, let's now get the portage snapshot set up. ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Change into your /usr directory&lt;br /&gt;
# ##i##cd /usr&lt;br /&gt;
&lt;br /&gt;
Download and extract the portage snapshot&lt;br /&gt;
# ##i##wget http://ftp.osuosl.org/pub/funtoo/funtoo-current/snapshots/portage-latest.tar.xz&lt;br /&gt;
# ##i##tar xf portage-latest.tar.xz&lt;br /&gt;
&lt;br /&gt;
Change into your portage directory and checkout the funtoo branch&lt;br /&gt;
# ##i##cd portage&lt;br /&gt;
# ##i##git checkout funtoo.org&lt;br /&gt;
&lt;br /&gt;
Now sync your portage tree&lt;br /&gt;
# ##i##emerge --sync&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Kernel Configuration ==&lt;br /&gt;
&lt;br /&gt;
Tested with kernel 2.6.32, 3.2.34, 3.6.9, 3.7.1.&lt;br /&gt;
&lt;br /&gt;
When you get up to the kernel, make sure that you disable the CFQ scheduler, and turn&lt;br /&gt;
on No-op (It's the default one once you disable all schedulers). The reason for this is because ZFS has its&lt;br /&gt;
own scheduler and the CFQ one conflicts with it.&lt;br /&gt;
&lt;br /&gt;
Go to your kernel config, and make sure you have the following: (there should be a /usr/src/linux symlink as well)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;ZLIB_INFLATE/DEFLATE must be compiled into the kernel (not as a module).&lt;br /&gt;
&amp;gt; ZLIB_INFLATE [=y], ZLIB_DEFLATE [=y]&lt;br /&gt;
&lt;br /&gt;
General setup ---&amp;gt;&lt;br /&gt;
&amp;gt; [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support&lt;br /&gt;
&amp;gt; () Initramfs source file(s)&lt;br /&gt;
&lt;br /&gt;
[*] Enable loadable module support ---&amp;gt;&lt;br /&gt;
[*] Module unloading&lt;br /&gt;
&lt;br /&gt;
Enable the block layer ---&amp;gt;&lt;br /&gt;
IO Schedulers ---&amp;gt;&lt;br /&gt;
&amp;lt; &amp;gt; Deadline I/O scheduler&lt;br /&gt;
&amp;lt; &amp;gt; CFQ I/O scheduler&lt;br /&gt;
Default I/O scheduler (No-op)&lt;br /&gt;
&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
&amp;gt; Generic Driver Options ---&amp;gt;&lt;br /&gt;
&amp;gt;&amp;gt; [*] Maintain a devtmpfs filesystem to mount at /dev&lt;br /&gt;
&amp;gt;&amp;gt; [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Continue and compile/install your kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##make bzImage modules&lt;br /&gt;
# ##i##make install&lt;br /&gt;
# ##i##make modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installing the ZFS userspace tools ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge -av zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check to make sure that the zfs tools are working, the zpool.cache file that you copied before should be displayed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zpool status&lt;br /&gt;
# ##i##zfs list&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If everything worked, continue.&lt;br /&gt;
&lt;br /&gt;
== Create the initramfs ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to do this, you can use genkernel, or you can use my bliss initramfs creator. I will&lt;br /&gt;
show you both.&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
&lt;br /&gt;
Make sure you compile sys-apps/busybox with the static flag.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-apps/busybox static&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge -av sys-apps/busybox&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Clone my creator which is located at: git://github.com/fearedbliss/Bliss-Initramfs-Creator.git&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/Bliss-Initramfs-Creator.git&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then go into this new directory, run the script as root, and place it into /boot&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd Bliss-Initramfs-Creator&lt;br /&gt;
# ##i##./createInit&lt;br /&gt;
# ##i##mv initrd-&amp;lt;kernel_name&amp;gt;.img /boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;kernel_name&amp;gt;''' is the name of what you selected in the initramfs creator, and the name of the outputted file.&lt;br /&gt;
&lt;br /&gt;
Once you do this just go to your bootloader config, and add it in there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
Kernel name is: vmlinuz-3.7.1-ALL&lt;br /&gt;
initramfs name is: initrd-3.7.1-ALL.img&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
extlinux.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo&lt;br /&gt;
  MENU LABEL Funtoo 3.7.1-ALL&lt;br /&gt;
  KERNEL /boot/vmlinuz-3.7.1-ALL&lt;br /&gt;
  INITRD /boot/initrd-3.7.1-ALL.img&lt;br /&gt;
  APPEND pool_root=rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== genkernel ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge -av sys-kernel/genkernel&lt;br /&gt;
# ##i##genkernel --zfs initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
kernel name is: vmlinuz-3.7.1-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.7.1-ALL&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&lt;br /&gt;
extlinux.conf:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo&lt;br /&gt;
  MENU LABEL Funtoo 3.7.1-ALL&lt;br /&gt;
  KERNEL /boot/vmlinuz-3.7.1-ALL&lt;br /&gt;
  INITRD /boot/initramfs-genkernel-x86_64-3.7.1-ALL&lt;br /&gt;
  APPEND real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Final configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Add the zfs tools to openrc ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##rc-update add zfs boot&lt;br /&gt;
# ##i##rc-update add zfs-shutdown shutdown&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Add filesystems to /etc/fstab ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##nano /etc/fstab&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;fs&amp;gt;                  &amp;lt;mountpoint&amp;gt;    &amp;lt;type&amp;gt;          &amp;lt;opts&amp;gt;          &amp;lt;dump/pass&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/dev/sda1               /boot           ext4            defaults        1 2&lt;br /&gt;
/dev/zvol/rpool/swap    none            swap            sw              0 0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Clean up and reboot ===&lt;br /&gt;
We are almost done, we are just going to clean up, '''set our root password''', and unmount whatever we mounted and get out.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Delete the stage3/portage tarballs you downloaded earlier so they don't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-latest.tar.xz&lt;br /&gt;
# ##i##rm /usr/portage-latest.tar.xz&lt;br /&gt;
&lt;br /&gt;
Set your root password&lt;br /&gt;
# ##i##passwd&lt;br /&gt;
&amp;gt;&amp;gt; Enter your password, you won't see what you are writing (for security reasons), but it is there!&lt;br /&gt;
&lt;br /&gt;
Get out of the chroot environment&lt;br /&gt;
# ##i##exit&lt;br /&gt;
&lt;br /&gt;
Unmount all the kernel filesystem stuff and boot&lt;br /&gt;
# ##i##cd /mnt/funtoo&lt;br /&gt;
# ##i##umount proc dev sys boot&lt;br /&gt;
&lt;br /&gt;
Turn off the swap&lt;br /&gt;
# ##i##swapoff /dev/zvol/rpool/swap&lt;br /&gt;
&lt;br /&gt;
Export the zpool&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##zpool export -f rpool&lt;br /&gt;
&lt;br /&gt;
Reboot&lt;br /&gt;
# ##i##reboot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|'''Don't forget to set your root password as stated above before exiting chroot and rebooting. If you don't set the root password, you won't be able to log into your new system.'''}}&lt;br /&gt;
and that should be enough to get your system to boot on ZFS.&lt;br /&gt;
&lt;br /&gt;
== Extra: After reboot ==&lt;br /&gt;
&lt;br /&gt;
After you restart your machine and your inside your desktop, continue to set up anything you need in terms of /etc configurations. Once you have everything the way you like it, take a snapshot of your system. You will be using this snapshot to revert back to this state if anything ever happens to your system down the road. The snapshots are cheap, and almost instant. To take the snapshot of your rootfs, type the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs snapshot rpool/ROOT/funtoo@install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To see if your snapshot was taken, type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs list -t snapshot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your machine ever fails and you need to get back to this state, just type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs rollback rpool/ROOT/funtoo@install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Recovery Environment ===&lt;br /&gt;
On ZFS it is extremely easy to create a recovery environment using an already working snapshot. So that's what we will be doing. &lt;br /&gt;
&lt;br /&gt;
Create a clone of the @install snapshot which you will use for recovery purposes. If something happens to your main install, you can boot into this clone and fix the main one. One of the differences (maybe the only difference) between a clone and a snapshot is that a clone is rewritable while a snapshot is only read-only.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##zfs clone rpool/ROOT/funtoo@install rpool/ROOT/recovery&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add the clone to your extlinux.conf ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
LABEL funtoo-recovery&lt;br /&gt;
    MENU LABEL Funtoo Recovery&lt;br /&gt;
    KERNEL /boot/vmlinuz-3.7.1-ALL&lt;br /&gt;
    INITRD /boot/initrd-3.7.1-ALL.img&lt;br /&gt;
    APPEND pool_root=rpool/ROOT/recovery&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Things to watch out for ====&lt;br /&gt;
&lt;br /&gt;
Since your recovery clone will tend to get old as you use your main system, and since &lt;br /&gt;
your recovery and other stuff are on the same pool, we don't want the new pool stuff&lt;br /&gt;
to be mounted when we launch recovery. We also don't want video drivers to be&lt;br /&gt;
conflicting.&lt;br /&gt;
&lt;br /&gt;
1. Make sure that nvidia/nouveau stuff are blacklisted.&lt;br /&gt;
2. Make sure that your /boot and /lib/modules for the kernel in your 'recovery' are&lt;br /&gt;
matching.&lt;br /&gt;
3. Disable the zfs openrc script so that nothing else gets automatically mounted.&lt;br /&gt;
Only your rootfs.&lt;br /&gt;
&lt;br /&gt;
You can do the above stuff by mounting your copy and chrooting into it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Mount the recovery clone&lt;br /&gt;
# ##i##mkdir /mnt/recovery&lt;br /&gt;
# ##i##mount -t zfs -o zfsutil rpool/ROOT/recovery /mnt/recovery&lt;br /&gt;
# ##i##cd /mnt/recovery&lt;br /&gt;
&lt;br /&gt;
Mount the kernel devices&lt;br /&gt;
# ##i##mount --bind /proc ./proc&lt;br /&gt;
# ##i##mount --bind /dev ./dev&lt;br /&gt;
# ##i##mount --bind /sys ./sys&lt;br /&gt;
&lt;br /&gt;
Copy zpool.cache&lt;br /&gt;
# ##i##cp /etc/zfs/zpool.cache etc/zfs&lt;br /&gt;
&lt;br /&gt;
Chroot into the new environment&lt;br /&gt;
# ##i##env -i HOME=/root TERM=$TERM chroot . bash --login&lt;br /&gt;
&lt;br /&gt;
Disable zfs/zfs-shutdown openrc scripts&lt;br /&gt;
# ##i##rc-config delete zfs boot&lt;br /&gt;
# ##i##rc-config delete zfs-shutdown shutdown&lt;br /&gt;
&lt;br /&gt;
Blacklist nouveau/nvidia drivers&lt;br /&gt;
# ##i##echo &amp;quot;blacklist nouveau&amp;quot; &amp;gt;&amp;gt; /etc/modprobe.d/blacklist.conf&lt;br /&gt;
# ##i##echo &amp;quot;blacklist nvidia&amp;quot; &amp;gt;&amp;gt; /etc/modprobe.d/blacklist.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Getting into the recovery ====&lt;br /&gt;
Just start your machine and pick the '''Funtoo Recovery''' option from the Boot Menu.&lt;br /&gt;
&lt;br /&gt;
Enjoy your new install on ZFS :)&lt;br /&gt;
[[Category:HOWTO]]&lt;br /&gt;
[[Category:Filesystems]]&lt;/div&gt;</summary>
		<author><name>Ryao</name></author>	</entry>

	</feed>