
<?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=Fearedbliss&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=Fearedbliss&amp;feedformat=atom"/>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Special:Contributions/Fearedbliss"/>
		<updated>2013-06-18T05:05:54Z</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-06-17T20:03:33Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Create the zfs datasets */ - removed rpool/HOME/root&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=kxEdSXwU0ZI|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download a customized version of SLAX with ZFS SBs (SLAX Bundle) already included.&lt;br /&gt;
&lt;br /&gt;
This is just a file that when combined with SLAX, gives you those tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SLAX-English-US-7.0.8-x86_64_ZFS.iso (229 MB)&lt;br /&gt;
Release Date: 2013-06-15&lt;br /&gt;
md5sum 358e4b3cbec9110de83e5d1779200eeb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/slax/SLAX-English-US-7.0.8-x86_64_ZFS.iso Download SLAX 7.0.8 with ZFS]'''&amp;lt;br /&amp;gt;&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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 rpool/ROOT&lt;br /&gt;
# ##i##zfs create -o mountpoint=/ rpool/ROOT/funtoo&lt;br /&gt;
&lt;br /&gt;
Optional, but recommended dataset: /home&lt;br /&gt;
# ##i##zfs create -o mountpoint=/home rpool/HOME&lt;br /&gt;
&lt;br /&gt;
Optional, portage tree, distfiles, and binary packages:&lt;br /&gt;
# ##i##zfs create rpool/FUNTOO&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 rpool/FUNTOO/portage/distfiles&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/packages rpool/FUNTOO/portage/packages&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&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;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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;
Make a directory for /boot&lt;br /&gt;
# ##i##mkdir /mnt/funtoo/boot&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 --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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet refresh&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|We are using the 'refresh' option because the current cachefile that was generated in SLAX won't work when the system is live. We will generate a new cachefile on the fly. You will need to recreate the initramfs once you are in the system so that the initramfs can have the new cachefile inside of it!}}&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           ext2            defaults        0 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 tarball that you downloaded earlier so it doesn't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-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##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 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;
== After reboot ==&lt;br /&gt;
&lt;br /&gt;
=== Recreate initramfs ===&lt;br /&gt;
After you restart your machine and your inside the live system, remake a new initrd if you are using &amp;quot;Bliss Initramfs Creator&amp;quot;. This is because the old cachefile that was used inside SLAX won't work for booting (At least not the first time). Now that our system is up, we will recreate the cache.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-initramfs&lt;br /&gt;
# ##i##./createInit&lt;br /&gt;
&lt;br /&gt;
Pick your desired option&lt;br /&gt;
&lt;br /&gt;
Once your initrd is made, move it to /boot&lt;br /&gt;
# ##i##mv initrd* /boot&lt;br /&gt;
&lt;br /&gt;
Now edit grub.cfg and remove the &amp;quot;refresh&amp;quot; option&lt;br /&gt;
nano /boot/grub/grub.cfg&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create initial ZFS Snapshot ===&lt;br /&gt;
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 system, type the following:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##zfs snapshot -r rpool@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 (This will only revert your / dataset while keeping the rest of your data intact):&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;
[[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>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Welcome</id>
		<title>Welcome</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Welcome"/>
				<updated>2013-06-16T07:32:12Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: funtoo zfs install video v3&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float:right; width: 35%&amp;quot;&amp;gt;&lt;br /&gt;
{{#widget:Donate|blurb=Your support helps Funtoo grow! Donate Today.}}&lt;br /&gt;
&amp;lt;div class=&amp;quot;boxy&amp;quot;&amp;gt;&lt;br /&gt;
== Get on the UserMap! ==&lt;br /&gt;
{{#compound_query:[[Category:People]] [[Role type::Staff]];?Geoloc;icon=Purplemarker.png;limit=9999&lt;br /&gt;
    |[[Category:People]][[Role type::Contributor]];?Geoloc;icon=Orangemarker.png;limit=9999&lt;br /&gt;
    |[[Category:People]][[Role type::User]];?Geoloc;icon=Greenmarker.png;limit=9999&lt;br /&gt;
    |format=googlemaps3|height=275|zoom=1|type=hybrid|markercluster=yes}}&lt;br /&gt;
See our full-size [[Usermap]] and find out how to become part of the Funtoo Universe!&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
{{Litecoin|blurb=Check it out: Mine litecoins for Funtoo!}}&lt;br /&gt;
&amp;lt;div class=&amp;quot;boxy&amp;quot;&amp;gt;&lt;br /&gt;
=== Latest Commits: ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;feed entries=7 url=&amp;quot;https://github.com/funtoo/funtoo-overlay/commits/master.atom&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[{PERMALINK} &amp;lt;nowiki&amp;gt;{TITLE}&amp;lt;/nowiki&amp;gt;]&lt;br /&gt;
&amp;lt;/feed&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;boxy&amp;quot;&amp;gt;&lt;br /&gt;
=== Featured Resources: ===&lt;br /&gt;
&amp;lt;DynamicPageList&amp;gt;&lt;br /&gt;
category = Featured&lt;br /&gt;
&amp;lt;/DynamicPageList&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;boxy2&amp;quot;&amp;gt;&lt;br /&gt;
=== [[image:Feed-icon-28x28.png|link=http://forums.funtoo.org/extern.php?action=feed&amp;amp;type=atom]] Latest Forum Posts ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;feed entries=6 url=&amp;quot;http://forums.funtoo.org/extern.php?action=feed&amp;amp;type=atom&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[{PERMALINK} &amp;lt;nowiki&amp;gt;{TITLE}&amp;lt;/nowiki&amp;gt;]&lt;br /&gt;
&amp;lt;/feed&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;boxy2&amp;quot;&amp;gt;&lt;br /&gt;
=== [[image:Feed-icon-28x28.png|link=http://feeds.feedburner.com/planet_larry]] Planet Larry ===&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;feed type=&amp;quot;planet&amp;quot; entries=6 url=&amp;quot;http://feeds.feedburner.com/planet_larry&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;[{PERMALINK} &amp;lt;nowiki&amp;gt;{TITLE}&amp;lt;/nowiki&amp;gt;]&lt;br /&gt;
&amp;lt;/feed&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Welcome to the Funtoo Wiki! =&lt;br /&gt;
&lt;br /&gt;
[[Funtoo Linux]] is a Linux-based operating system created by [[user:Drobbins|Daniel Robbins]], the creator and former Chief Architect of Gentoo Linux. Funtoo Linux is a Free software, or &amp;quot;Open Source&amp;quot; operating system. All distribution source code is freely available, and it can be used and distributed free of charge.&lt;br /&gt;
&lt;br /&gt;
Who develops and improves Funtoo Linux? '''You do.''' We are a completely open meta-distribution that is run by our users and a small group of support staff. Our development centers around the needs of our users. Any user can contribute code and help improve Funtoo Linux functionality on our [http://bugs.funtoo.org bug tracker]. &lt;br /&gt;
&lt;br /&gt;
== Featured Video ==&lt;br /&gt;
&lt;br /&gt;
In this video, Jonathan Vasquez ([[User:Fearedbliss|fearedbliss]]) walks you through the process of installing Funtoo Linux with ZFS. See the [[ZFS Install Guide]] for detailed instructions.&lt;br /&gt;
&lt;br /&gt;
{{#widget:YouTube|id=kxEdSXwU0ZI|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Meta-Distribution, Optimized ==&lt;br /&gt;
&lt;br /&gt;
Funtoo Linux is also a ''meta''-distribution, which means that it is built automatically from source code and is customized with the functionality that ''you'' want it to have, and ''without'' the unnecessary features and &amp;quot;bloat&amp;quot; that you want to avoid. &lt;br /&gt;
&lt;br /&gt;
In addition, a Funtoo Linux system is [[Download|optimized for your CPU]], and we offer optimized versions for ''Intel Core i7'', ''Intel Atom'', ''AMD Opteron'', and other processors and architectures. &lt;br /&gt;
&lt;br /&gt;
These combination of factors work together to create an extremely high-performance and flexible computing platform -- a platform where ''you'' are in control, and your system performs optimally. We believe that Funtoo Linux is the most ideal expression of how operating system technology &amp;quot;should&amp;quot; work, and we continually strive to make it better.&lt;br /&gt;
&lt;br /&gt;
== The Gentoo Ecosystem ==&lt;br /&gt;
&lt;br /&gt;
We are committed to maintaining high-levels of compatibility and collaboration with the Gentoo Linux project, and challenge ourselves to innovate while providing new approaches that can be easily leveraged by the Gentoo Community. We appreciate the support we receive from members of the Gentoo Community and strive to contribute back to the larger [[Gentoo Ecosystem]].&lt;br /&gt;
&lt;br /&gt;
== Ultimate Flexibility for Developers ==&lt;br /&gt;
&lt;br /&gt;
Does your Linux distribution allow multiple versions of &amp;lt;tt&amp;gt;php&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;[[python]]&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;ruby&amp;lt;/tt&amp;gt; installed happily alongside each other? Funtoo Linux does. Are you tired of hand-building key packages from source to configure them exactly the way you want? Funtoo Linux allows you to tweak the build-time features of packages using handy things called USE variables. Other distributions are forced to either leave stuff out that you want, or include stuff you don't want.&lt;br /&gt;
&lt;br /&gt;
== Virtualization ==&lt;br /&gt;
&lt;br /&gt;
We support the [[OpenVZ]] project and build up-to-date Funtoo Linux OpenVZ containers that you can [[Download|download]]. Also see [[VagrantUp]] for a nice way to deploy VirtualBox-based Funtoo Linux systems. [[Metro]], our automated distro build tool, is capable of building OpenVZ, Linux VServer and [[Linux Containers]] (LXC) images. Funtoo Linux also makes an excellent virtualization host system for [[Xen]].&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
[[Funtoo Linux]] features native [[wikipedia:UTF-8|UTF-8]] support enabled by default, a [[wikipedia:Git (software)|git]]-based, [[Portage Tree|distributed Portage Tree]] and funtoo overlay, an enhanced [[Portage]] with more compact mini-manifest tree, automated imports of new [http://www.gentoo.org Gentoo] changes every 12 hours, [[GUID Booting Guide|GPT/GUID boot support]] and [[Boot-Update|streamlined boot configuration]], [[Funtoo Linux Networking|enhanced network configuration]], up-to-date [http://ftp.osuosl.org/pub/funtoo/funtoo-stable/ stable] and [http://ftp.osuosl.org/pub/funtoo/funtoo-current/ current] Funtoo [[Stage Tarball|stages]], all built using Funtoo's [[Metro]] build tool. We also offer Ubuntu Server, Debian, RHEL and Fedora-based [[Funtoo Linux Kernels|kernels]].&lt;br /&gt;
&lt;br /&gt;
Funtoo is currently supported on the following processor families :&lt;br /&gt;
* PC-compatible, both 32 and 64-bit (''x86-32bit'', ''x86-64bit'')&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
&lt;br /&gt;
* Learn more about [[Funtoo Linux]].&lt;br /&gt;
* Why you should [[Choose Funtoo]]: ...and how its different than other distros.&lt;br /&gt;
* Visit [[:Category:Projects|Funtoo Linux Projects]] and also look at the stuff online for [[Metro]].&lt;br /&gt;
* Learn [[:Category:Linux Core Concepts| Core Linux concepts]] from articles originally written by Daniel Robbins.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__NOTOC__&lt;br /&gt;
__NOTITLE__&lt;br /&gt;
__NOEDITSECTION__&lt;br /&gt;
&lt;br /&gt;
[[Category:Funtoo|*]]&lt;/div&gt;</summary>
		<author><name>Fearedbliss</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-06-16T07:31:43Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: funtoo install video v3&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=kxEdSXwU0ZI|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download a customized version of SLAX with ZFS SBs (SLAX Bundle) already included.&lt;br /&gt;
&lt;br /&gt;
This is just a file that when combined with SLAX, gives you those tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SLAX-English-US-7.0.8-x86_64_ZFS.iso (229 MB)&lt;br /&gt;
Release Date: 2013-06-15&lt;br /&gt;
md5sum 358e4b3cbec9110de83e5d1779200eeb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/slax/SLAX-English-US-7.0.8-x86_64_ZFS.iso Download SLAX 7.0.8 with ZFS]'''&amp;lt;br /&amp;gt;&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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 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, portage tree, distfiles, and binary packages:&lt;br /&gt;
# ##i##zfs create rpool/FUNTOO&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 rpool/FUNTOO/portage/distfiles&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/packages rpool/FUNTOO/portage/packages&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&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;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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;
Make a directory for /boot&lt;br /&gt;
# ##i##mkdir /mnt/funtoo/boot&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 --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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet refresh&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|We are using the 'refresh' option because the current cachefile that was generated in SLAX won't work when the system is live. We will generate a new cachefile on the fly. You will need to recreate the initramfs once you are in the system so that the initramfs can have the new cachefile inside of it!}}&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           ext2            defaults        0 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 tarball that you downloaded earlier so it doesn't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-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##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 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;
== After reboot ==&lt;br /&gt;
&lt;br /&gt;
=== Recreate initramfs ===&lt;br /&gt;
After you restart your machine and your inside the live system, remake a new initrd if you are using &amp;quot;Bliss Initramfs Creator&amp;quot;. This is because the old cachefile that was used inside SLAX won't work for booting (At least not the first time). Now that our system is up, we will recreate the cache.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-initramfs&lt;br /&gt;
# ##i##./createInit&lt;br /&gt;
&lt;br /&gt;
Pick your desired option&lt;br /&gt;
&lt;br /&gt;
Once your initrd is made, move it to /boot&lt;br /&gt;
# ##i##mv initrd* /boot&lt;br /&gt;
&lt;br /&gt;
Now edit grub.cfg and remove the &amp;quot;refresh&amp;quot; option&lt;br /&gt;
nano /boot/grub/grub.cfg&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create initial ZFS Snapshot ===&lt;br /&gt;
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 system, type the following:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##zfs snapshot -r rpool@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 (This will only revert your / dataset while keeping the rest of your data intact):&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;
[[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>Fearedbliss</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-06-16T05:31:53Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Installing Funtoo */&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download a customized version of SLAX with ZFS SBs (SLAX Bundle) already included.&lt;br /&gt;
&lt;br /&gt;
This is just a file that when combined with SLAX, gives you those tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SLAX-English-US-7.0.8-x86_64_ZFS.iso (229 MB)&lt;br /&gt;
Release Date: 2013-06-15&lt;br /&gt;
md5sum 358e4b3cbec9110de83e5d1779200eeb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/slax/SLAX-English-US-7.0.8-x86_64_ZFS.iso Download SLAX 7.0.8 with ZFS]'''&amp;lt;br /&amp;gt;&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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 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, portage tree, distfiles, and binary packages:&lt;br /&gt;
# ##i##zfs create rpool/FUNTOO&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 rpool/FUNTOO/portage/distfiles&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/packages rpool/FUNTOO/portage/packages&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&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;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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;
Make a directory for /boot&lt;br /&gt;
# ##i##mkdir /mnt/funtoo/boot&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 --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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet refresh&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|We are using the 'refresh' option because the current cachefile that was generated in SLAX won't work when the system is live. We will generate a new cachefile on the fly. You will need to recreate the initramfs once you are in the system so that the initramfs can have the new cachefile inside of it!}}&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           ext2            defaults        0 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 tarball that you downloaded earlier so it doesn't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-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##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 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;
== After reboot ==&lt;br /&gt;
&lt;br /&gt;
=== Recreate initramfs ===&lt;br /&gt;
After you restart your machine and your inside the live system, remake a new initrd if you are using &amp;quot;Bliss Initramfs Creator&amp;quot;. This is because the old cachefile that was used inside SLAX won't work for booting (At least not the first time). Now that our system is up, we will recreate the cache.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-initramfs&lt;br /&gt;
# ##i##./createInit&lt;br /&gt;
&lt;br /&gt;
Pick your desired option&lt;br /&gt;
&lt;br /&gt;
Once your initrd is made, move it to /boot&lt;br /&gt;
# ##i##mv initrd* /boot&lt;br /&gt;
&lt;br /&gt;
Now edit grub.cfg and remove the &amp;quot;refresh&amp;quot; option&lt;br /&gt;
nano /boot/grub/grub.cfg&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create initial ZFS Snapshot ===&lt;br /&gt;
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 system, type the following:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##zfs snapshot -r rpool@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 (This will only revert your / dataset while keeping the rest of your data intact):&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;
[[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>Fearedbliss</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-06-16T04:28:52Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* After reboot */ nocache -&amp;gt; refresh option&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download a customized version of SLAX with ZFS SBs (SLAX Bundle) already included.&lt;br /&gt;
&lt;br /&gt;
This is just a file that when combined with SLAX, gives you those tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SLAX-English-US-7.0.8-x86_64_ZFS.iso (229 MB)&lt;br /&gt;
Release Date: 2013-06-15&lt;br /&gt;
md5sum 358e4b3cbec9110de83e5d1779200eeb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/slax/SLAX-English-US-7.0.8-x86_64_ZFS.iso Download SLAX 7.0.8 with ZFS]'''&amp;lt;br /&amp;gt;&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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 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, portage tree, distfiles, and binary packages:&lt;br /&gt;
# ##i##zfs create rpool/FUNTOO&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 rpool/FUNTOO/portage/distfiles&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/packages rpool/FUNTOO/portage/packages&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&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;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet refresh&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|We are using the 'refresh' option because the current cachefile that was generated in SLAX won't work when the system is live. We will generate a new cachefile on the fly. You will need to recreate the initramfs once you are in the system so that the initramfs can have the new cachefile inside of it!}}&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           ext2            defaults        0 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 tarball that you downloaded earlier so it doesn't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-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##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 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;
== After reboot ==&lt;br /&gt;
&lt;br /&gt;
=== Recreate initramfs ===&lt;br /&gt;
After you restart your machine and your inside the live system, remake a new initrd if you are using &amp;quot;Bliss Initramfs Creator&amp;quot;. This is because the old cachefile that was used inside SLAX won't work for booting (At least not the first time). Now that our system is up, we will recreate the cache.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-initramfs&lt;br /&gt;
# ##i##./createInit&lt;br /&gt;
&lt;br /&gt;
Pick your desired option&lt;br /&gt;
&lt;br /&gt;
Once your initrd is made, move it to /boot&lt;br /&gt;
# ##i##mv initrd* /boot&lt;br /&gt;
&lt;br /&gt;
Now edit grub.cfg and remove the &amp;quot;refresh&amp;quot; option&lt;br /&gt;
nano /boot/grub/grub.cfg&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create initial ZFS Snapshot ===&lt;br /&gt;
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 system, type the following:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##zfs snapshot -r rpool@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 (This will only revert your / dataset while keeping the rest of your data intact):&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;
[[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>Fearedbliss</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-06-16T04:27:28Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Bliss Initramfs Creator */&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download a customized version of SLAX with ZFS SBs (SLAX Bundle) already included.&lt;br /&gt;
&lt;br /&gt;
This is just a file that when combined with SLAX, gives you those tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SLAX-English-US-7.0.8-x86_64_ZFS.iso (229 MB)&lt;br /&gt;
Release Date: 2013-06-15&lt;br /&gt;
md5sum 358e4b3cbec9110de83e5d1779200eeb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/slax/SLAX-English-US-7.0.8-x86_64_ZFS.iso Download SLAX 7.0.8 with ZFS]'''&amp;lt;br /&amp;gt;&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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 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, portage tree, distfiles, and binary packages:&lt;br /&gt;
# ##i##zfs create rpool/FUNTOO&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 rpool/FUNTOO/portage/distfiles&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/packages rpool/FUNTOO/portage/packages&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&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;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet refresh&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|We are using the 'refresh' option because the current cachefile that was generated in SLAX won't work when the system is live. We will generate a new cachefile on the fly. You will need to recreate the initramfs once you are in the system so that the initramfs can have the new cachefile inside of it!}}&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           ext2            defaults        0 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 tarball that you downloaded earlier so it doesn't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-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##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 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;
== After reboot ==&lt;br /&gt;
&lt;br /&gt;
=== Recreate initramfs ===&lt;br /&gt;
After you restart your machine and your inside the live system, remake a new initrd if you are using &amp;quot;Bliss Initramfs Creator&amp;quot;. This is because the old cachefile that was used inside SLAX won't work for booting (At least not the first time). Now that our system is up, we will recreate the cache.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-initramfs&lt;br /&gt;
# ##i##./createInit&lt;br /&gt;
&lt;br /&gt;
Pick your desired option&lt;br /&gt;
&lt;br /&gt;
Once your initrd is made, move it to /boot&lt;br /&gt;
# ##i##mv initrd* /boot&lt;br /&gt;
&lt;br /&gt;
Now edit grub.cfg and remove the &amp;quot;nocache&amp;quot; option&lt;br /&gt;
nano /boot/grub/grub.cfg&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create initial ZFS Snapshot ===&lt;br /&gt;
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 system, type the following:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##zfs snapshot -r rpool@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 (This will only revert your / dataset while keeping the rest of your data intact):&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;
[[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>Fearedbliss</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-06-16T03:31:23Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Extra: After reboot */&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download a customized version of SLAX with ZFS SBs (SLAX Bundle) already included.&lt;br /&gt;
&lt;br /&gt;
This is just a file that when combined with SLAX, gives you those tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SLAX-English-US-7.0.8-x86_64_ZFS.iso (229 MB)&lt;br /&gt;
Release Date: 2013-06-15&lt;br /&gt;
md5sum 358e4b3cbec9110de83e5d1779200eeb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/slax/SLAX-English-US-7.0.8-x86_64_ZFS.iso Download SLAX 7.0.8 with ZFS]'''&amp;lt;br /&amp;gt;&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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 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, portage tree, distfiles, and binary packages:&lt;br /&gt;
# ##i##zfs create rpool/FUNTOO&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 rpool/FUNTOO/portage/distfiles&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/packages rpool/FUNTOO/portage/packages&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&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;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet nocache&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|We are using the 'nocache' option because the current cachefile that was generated in SLAX won't work when the system is live. We will ignore the cachefile and make a new one once we are fully booted.}}&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           ext2            defaults        0 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 tarball that you downloaded earlier so it doesn't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-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##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 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;
== After reboot ==&lt;br /&gt;
&lt;br /&gt;
=== Recreate initramfs ===&lt;br /&gt;
After you restart your machine and your inside the live system, remake a new initrd if you are using &amp;quot;Bliss Initramfs Creator&amp;quot;. This is because the old cachefile that was used inside SLAX won't work for booting (At least not the first time). Now that our system is up, we will recreate the cache.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-initramfs&lt;br /&gt;
# ##i##./createInit&lt;br /&gt;
&lt;br /&gt;
Pick your desired option&lt;br /&gt;
&lt;br /&gt;
Once your initrd is made, move it to /boot&lt;br /&gt;
# ##i##mv initrd* /boot&lt;br /&gt;
&lt;br /&gt;
Now edit grub.cfg and remove the &amp;quot;nocache&amp;quot; option&lt;br /&gt;
nano /boot/grub/grub.cfg&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Create initial ZFS Snapshot ===&lt;br /&gt;
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 system, type the following:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##zfs snapshot -r rpool@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 (This will only revert your / dataset while keeping the rest of your data intact):&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;
[[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>Fearedbliss</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-06-16T03:26:40Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Create the initramfs */ - warning about old cachefile&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download a customized version of SLAX with ZFS SBs (SLAX Bundle) already included.&lt;br /&gt;
&lt;br /&gt;
This is just a file that when combined with SLAX, gives you those tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SLAX-English-US-7.0.8-x86_64_ZFS.iso (229 MB)&lt;br /&gt;
Release Date: 2013-06-15&lt;br /&gt;
md5sum 358e4b3cbec9110de83e5d1779200eeb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/slax/SLAX-English-US-7.0.8-x86_64_ZFS.iso Download SLAX 7.0.8 with ZFS]'''&amp;lt;br /&amp;gt;&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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 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, portage tree, distfiles, and binary packages:&lt;br /&gt;
# ##i##zfs create rpool/FUNTOO&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 rpool/FUNTOO/portage/distfiles&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/packages rpool/FUNTOO/portage/packages&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&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;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet nocache&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|We are using the 'nocache' option because the current cachefile that was generated in SLAX won't work when the system is live. We will ignore the cachefile and make a new one once we are fully booted.}}&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           ext2            defaults        0 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 tarball that you downloaded earlier so it doesn't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-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##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 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;
[[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>Fearedbliss</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-06-16T03:19:10Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Clean up and reboot */&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download a customized version of SLAX with ZFS SBs (SLAX Bundle) already included.&lt;br /&gt;
&lt;br /&gt;
This is just a file that when combined with SLAX, gives you those tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SLAX-English-US-7.0.8-x86_64_ZFS.iso (229 MB)&lt;br /&gt;
Release Date: 2013-06-15&lt;br /&gt;
md5sum 358e4b3cbec9110de83e5d1779200eeb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/slax/SLAX-English-US-7.0.8-x86_64_ZFS.iso Download SLAX 7.0.8 with ZFS]'''&amp;lt;br /&amp;gt;&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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 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, portage tree, distfiles, and binary packages:&lt;br /&gt;
# ##i##zfs create rpool/FUNTOO&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 rpool/FUNTOO/portage/distfiles&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/packages rpool/FUNTOO/portage/packages&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&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;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&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           ext2            defaults        0 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 tarball that you downloaded earlier so it doesn't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-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##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 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;
[[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>Fearedbliss</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-06-16T03:13:40Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: removed depmod bullshit. No longer needed.&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download a customized version of SLAX with ZFS SBs (SLAX Bundle) already included.&lt;br /&gt;
&lt;br /&gt;
This is just a file that when combined with SLAX, gives you those tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SLAX-English-US-7.0.8-x86_64_ZFS.iso (229 MB)&lt;br /&gt;
Release Date: 2013-06-15&lt;br /&gt;
md5sum 358e4b3cbec9110de83e5d1779200eeb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/slax/SLAX-English-US-7.0.8-x86_64_ZFS.iso Download SLAX 7.0.8 with ZFS]'''&amp;lt;br /&amp;gt;&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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 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, portage tree, distfiles, and binary packages:&lt;br /&gt;
# ##i##zfs create rpool/FUNTOO&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 rpool/FUNTOO/portage/distfiles&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/packages rpool/FUNTOO/portage/packages&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&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;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&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           ext2            defaults        0 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 tarball that you downloaded earlier so it doesn't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-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;
[[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>Fearedbliss</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-06-16T03:12:09Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Downloading the ISO (With ZFS) */ - switched to slax&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: SLAX-English-US-7.0.8-x86_64_ZFS.iso (229 MB)&lt;br /&gt;
Release Date: 2013-06-15&lt;br /&gt;
md5sum 358e4b3cbec9110de83e5d1779200eeb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/slax/SLAX-English-US-7.0.8-x86_64_ZFS.iso Download SLAX 7.0.8 with ZFS]'''&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Inside the ISO (Loading the ZFS Modules) ==&lt;br /&gt;
Once you boot into your System Rescue CD environment, you will need to update the kernel's dependency list so that the kernel knows that the zfs modules are available. This is extremely easy and it only takes one second. Just type the following two commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
# ##i##modprobe -v zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see 6 modules load. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##depmod&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/spl/spl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/nvpair/znvpair.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zcommon/zcommon.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/avl/zavl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/unicode/zunicode.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zfs/zfs.ko.gz&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don't do the depmod first, you will see the following error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
modprobe: FATAL: Module zfs not found.&lt;br /&gt;
&lt;br /&gt;
# OR You will see this if you try to run a zfs command without having the modules loaded&lt;br /&gt;
&lt;br /&gt;
root@sysresccd /root % ##i##zpool status&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So make sure to run '''depmod''' first!&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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 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, portage tree, distfiles, and binary packages:&lt;br /&gt;
# ##i##zfs create rpool/FUNTOO&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 rpool/FUNTOO/portage/distfiles&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/packages rpool/FUNTOO/portage/packages&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&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;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&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           ext2            defaults        0 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 tarball that you downloaded earlier so it doesn't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-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;
[[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>Fearedbliss</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-06-16T03:06:48Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Clean up and reboot */ - removed portage_tarball from instruction.&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: systemrescuecd-x86-3.7.0-zfs (402 MiB)&lt;br /&gt;
Release Date: 2013-06-09&lt;br /&gt;
md5sum 62605474641ce2b1a07fec8330377208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/systemrescuecd-x86-3.7.0-zfs.iso Download System Rescue CD 3.7.0 with ZFS]'''&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Inside the ISO (Loading the ZFS Modules) ==&lt;br /&gt;
Once you boot into your System Rescue CD environment, you will need to update the kernel's dependency list so that the kernel knows that the zfs modules are available. This is extremely easy and it only takes one second. Just type the following two commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
# ##i##modprobe -v zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see 6 modules load. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##depmod&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/spl/spl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/nvpair/znvpair.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zcommon/zcommon.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/avl/zavl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/unicode/zunicode.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zfs/zfs.ko.gz&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don't do the depmod first, you will see the following error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
modprobe: FATAL: Module zfs not found.&lt;br /&gt;
&lt;br /&gt;
# OR You will see this if you try to run a zfs command without having the modules loaded&lt;br /&gt;
&lt;br /&gt;
root@sysresccd /root % ##i##zpool status&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So make sure to run '''depmod''' first!&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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 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, portage tree, distfiles, and binary packages:&lt;br /&gt;
# ##i##zfs create rpool/FUNTOO&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 rpool/FUNTOO/portage/distfiles&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/packages rpool/FUNTOO/portage/packages&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&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;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&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           ext2            defaults        0 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 tarball that you downloaded earlier so it doesn't take up space.&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##rm stage3-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;
[[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>Fearedbliss</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-06-16T02:14:29Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Create the zfs datasets */&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: systemrescuecd-x86-3.7.0-zfs (402 MiB)&lt;br /&gt;
Release Date: 2013-06-09&lt;br /&gt;
md5sum 62605474641ce2b1a07fec8330377208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/systemrescuecd-x86-3.7.0-zfs.iso Download System Rescue CD 3.7.0 with ZFS]'''&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Inside the ISO (Loading the ZFS Modules) ==&lt;br /&gt;
Once you boot into your System Rescue CD environment, you will need to update the kernel's dependency list so that the kernel knows that the zfs modules are available. This is extremely easy and it only takes one second. Just type the following two commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
# ##i##modprobe -v zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see 6 modules load. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##depmod&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/spl/spl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/nvpair/znvpair.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zcommon/zcommon.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/avl/zavl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/unicode/zunicode.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zfs/zfs.ko.gz&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don't do the depmod first, you will see the following error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
modprobe: FATAL: Module zfs not found.&lt;br /&gt;
&lt;br /&gt;
# OR You will see this if you try to run a zfs command without having the modules loaded&lt;br /&gt;
&lt;br /&gt;
root@sysresccd /root % ##i##zpool status&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So make sure to run '''depmod''' first!&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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 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, portage tree, distfiles, and binary packages:&lt;br /&gt;
# ##i##zfs create rpool/FUNTOO&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 rpool/FUNTOO/portage/distfiles&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/packages rpool/FUNTOO/portage/packages&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&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;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&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           ext2            defaults        0 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;
[[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>Fearedbliss</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-06-16T02:13:12Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Create the zfs datasets */ - removed portage section, added it on top, taking advantage of inheritance properties for -m none and compression.&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: systemrescuecd-x86-3.7.0-zfs (402 MiB)&lt;br /&gt;
Release Date: 2013-06-09&lt;br /&gt;
md5sum 62605474641ce2b1a07fec8330377208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/systemrescuecd-x86-3.7.0-zfs.iso Download System Rescue CD 3.7.0 with ZFS]'''&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Inside the ISO (Loading the ZFS Modules) ==&lt;br /&gt;
Once you boot into your System Rescue CD environment, you will need to update the kernel's dependency list so that the kernel knows that the zfs modules are available. This is extremely easy and it only takes one second. Just type the following two commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
# ##i##modprobe -v zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see 6 modules load. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##depmod&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/spl/spl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/nvpair/znvpair.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zcommon/zcommon.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/avl/zavl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/unicode/zunicode.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zfs/zfs.ko.gz&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don't do the depmod first, you will see the following error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
modprobe: FATAL: Module zfs not found.&lt;br /&gt;
&lt;br /&gt;
# OR You will see this if you try to run a zfs command without having the modules loaded&lt;br /&gt;
&lt;br /&gt;
root@sysresccd /root % ##i##zpool status&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So make sure to run '''depmod''' first!&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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 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, Portage Tree, distfiles, and binary packages:&lt;br /&gt;
# ##i##zfs create rpool/FUNTOO&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 rpool/FUNTOO/portage/distfiles&lt;br /&gt;
# ##i##zfs create -o mountpoint=/usr/portage/packages rpool/FUNTOO/portage/packages&lt;br /&gt;
&lt;br /&gt;
Optional datasets: /usr/src, /var&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;
=== Create your swap zvol ===&lt;br /&gt;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&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           ext2            defaults        0 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;
[[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>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules</id>
		<title>Creating System Rescue CD ZFS Modules</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules"/>
				<updated>2013-06-15T21:25:41Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Using the prebuilt srm */ - removed more overlay leftovers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will show you how to create your own zfs srm or download the prebuilt zfs srm module from my website.&lt;br /&gt;
&lt;br /&gt;
== Compiling a compatible kernel ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is decide for which version of System Rescue CD you will be building for. Each System Rescue CD version has a different set of kernels. Specifically each version has a Stable kernel and an Alternate Kernel. The stable kernels get minor version increments every release (Sometimes major ones but usually doesn't happen too quickly), the Alternate kernels tend to move up much faster. For example System Rescue CD had the following stable/alternate kernels:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Version !! Stable !! Alternate&lt;br /&gt;
|-&lt;br /&gt;
| 3.7.0 || 3.4.47 || 3.9.4&lt;br /&gt;
|-&lt;br /&gt;
| 3.5.0 || 3.4.37 || 3.8.4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Download kernel and patches===&lt;br /&gt;
Once you decide which version you want to use, you can go to http://kernel.sysresccd.org/ and pick the version you want. After you do this, download all the stuff in that directory and put them in their own folder (a work directory). The files that are named std-sources are the patches for the regular stable kernel, the patches named alt-sources are the patches for the alternate kernel. Once you have the patches, go to kernel.org and also download the initial release of the kernel sources you want. For example, if you want to build an srm for 3.4.2 which uses the 3.4.35 kernel, just download the 3.4 (3.4.0) kernel. You just need to download the initial release because one of the patches you downloaded earlier is the patch to update the 3.4.0 to 3.4.35.&lt;br /&gt;
&lt;br /&gt;
Once you download the kernel you want, let's extract and patch it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##tar xf linux-3.4.tar.bz2&lt;br /&gt;
# ##i##mv linux-3.4 linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-01-stable-3.4.35.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-02-fc16.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-03-aufs.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Retrieve kernel configuration===&lt;br /&gt;
Once that is complete, you will need to get the kernel config specifically for the kernel and architecture you want. The easiest way I found to do this was to download the System Rescue CD you want, and then boot it inside a VM. Once you are inside the VM, go to the /root directory, and it will be a file named kernel-&amp;lt;version&amp;gt;.conf. Copy this file over SSH and put it in a safe location. Also copy it over into the linux kernel directory and rename it to .config.&lt;br /&gt;
&lt;br /&gt;
===Build the kernel===&lt;br /&gt;
Once you copy the kernel config over, do a make menuconfig to begin. You will only need to change two settings inside the config, add the proper kernel name, and remove the old initramfs source files directory. This directory doesn't exist locally. This is a remnant of upstream's build process.&lt;br /&gt;
&lt;br /&gt;
Follow the below tree structure, and make it equal to what is below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
General Setup -&amp;gt;&lt;br /&gt;
 (-std342-amd64) Local version - append to kernel release&lt;br /&gt;
 [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support  ()    Initramfs source file(s)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Local version above will end up making the kernel modules directory be 3.4.35-std342-amd64. The reason the kernel modules directory has to be equal to this is because our directory will be merged into the System Rescue CD later on, so the names need to be exactly the same so that the System Rescue CD system can find our kernel modules.&lt;br /&gt;
&lt;br /&gt;
If you want to build an srm (which you do), you also need to change the following inside the kernel config so that squashfs-tools can work later on:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
File Systems -&amp;gt;&lt;br /&gt;
Miscellaneous Filesystems -&amp;gt;&lt;br /&gt;
 &amp;lt;*&amp;gt;   SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  [*]     Squashfs XATTR support&lt;br /&gt;
  [*]     Include support for ZLIB compressed file systems&lt;br /&gt;
  [*]     Include support for LZO compressed file systems&lt;br /&gt;
  [*]     Include support for XZ compressed file systems&lt;br /&gt;
  [ ]     Use 4K device block size?&lt;br /&gt;
  [ ]     Additional option for memory-constrained systems&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now save and exit, and continue to build 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 modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have multiple cores, do a make -j&amp;lt;# of processors+1&amp;gt; to build faster. Example: '''make -j9''' for an 8 core machine.}}&lt;br /&gt;
&lt;br /&gt;
=== Using the portage tree ===&lt;br /&gt;
Inside the portage tree, there are ebuilds already prepared that will download the kernel, patch it, and perform any required substitutions. Afterwards you literally just go into your /usr/src/&amp;lt;kernel&amp;gt; directory, and run make. To see the available versions, run the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Versions available for standard kernel&lt;br /&gt;
# ##i##equery y std-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.4.37-r1 | o ~ o o o o o o o o o o o | o 3.4.37 | gentoo&lt;br /&gt;
&lt;br /&gt;
Versions available for alternate kernel&lt;br /&gt;
# ##i##equery y alt-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.8.4 | o ~ o o o o o o o o o o o | o 3.8.4 | gentoo&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I haven't written the ebuilds in a way where it's easy to tell (at first glance) what System Rescue CD version you need. However, you can check the ebuild and you will see the version of the CD inside there. You can also check the chart above.&lt;br /&gt;
&lt;br /&gt;
If you wanted to install the standard kernel sources, you just emerge it like any other application:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge std-sources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the kernel and the kernel module are installed, you need to make the SRM.&lt;br /&gt;
&lt;br /&gt;
== Creating the SRM ==&lt;br /&gt;
It's time to gather the required files and pack them together in order for it to become an SRM. An SRM is nothing more than a directory that has been compressed with squashfs. You can emerge the &amp;quot;Bliss Initramfs Creator&amp;quot; which has a feature that will automagically build the srm for you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You also need to have spl, zfs, and zfs-kmod installed on your system before you try to make the srm. Emerging '''&amp;quot;bliss-initramfs&amp;quot;''' should automatically pull those packages. If it doesn't, make sure you install them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs srm&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should now have the following directory layout inside the '''/opt/bliss-initramfs''' folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-initramfs # ls -l&lt;br /&gt;
total 117&lt;br /&gt;
-rw-r--r-- 1 root root 6718 May 23 18:05 CHANGES&lt;br /&gt;
-rw-r--r-- 1 root root  176 May 23 18:05 CREDITS&lt;br /&gt;
-rw-r--r-- 1 root root  431 May 23 18:05 HELP&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 23 18:05 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root 1852 May 23 18:05 README&lt;br /&gt;
-rw-r--r-- 1 root root 3194 May 23 18:05 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 2891 May 23 18:05 createInit&lt;br /&gt;
drwxr-xr-x 3 root root    4 May 23 18:11 files&lt;br /&gt;
drwxr-xr-x 3 root root    6 May 23 18:11 hooks&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 23 22:01 resources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run the '''createInit''' script and follow the instructions for the kernel you want to make the srm for (In this case it's '''3.4.37-std350-amd64'''):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-----------------------------------&lt;br /&gt;
| Bliss Initramfs Creator - v1.8.1&lt;br /&gt;
| Author: Jonathan Vasquez &amp;lt;jvasquez1011@gmail.com&amp;gt;&lt;br /&gt;
| Distributed under the Simplified BSD License&lt;br /&gt;
-----------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Which initramfs would you like to generate:&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS&lt;br /&gt;
&amp;gt;&amp;gt; 2. Encrypted ZFS (LUKS + ZFS)&lt;br /&gt;
&amp;gt;&amp;gt; 3. More Options&lt;br /&gt;
&amp;gt;&amp;gt; 4. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##3 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; More Options:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS - System Rescue Module&lt;br /&gt;
&amp;gt;&amp;gt; 2. Back&lt;br /&gt;
&amp;gt;&amp;gt; 3. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating a ZFS System Rescue Module!&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Do you want to use the current kernel: 3.8.13-ALL? [Y/n]: ##i##n ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Please enter the kernel name: ##i##3.4.37-std350-amd64 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Detected 64 bit platform&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking to see if modules directory exists for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating SRMs for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating directory structure for initramfs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking preliminary binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Using ZFS&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying documentation...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying udev rules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Compressing kernel modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Getting dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Configuring files...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating and Packing SRMs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Complete :)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you should have two new files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-rw-r--r-- 1 root root 2068480 May 24 01:05 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rw-r--r-- 1 root root  483328 May 24 01:05 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now all you need to do is put those two files in the root of your USB directory.&lt;br /&gt;
&lt;br /&gt;
If you are making srms for both the standard and alternate kernels, you will end up with two zfs-core files and two zfs-kmod files (1 set for each kernel). You don't need to put the zfs-core that it makes for one of the kernels. The zfs-core srm only has zfs program binaries, man pages, udev rules, and a few other things. The zfs-kmod is the srm that has the kernel modules (and only the kernel modules). So you can easily just put two zfs-kmods (one for each kernel version) and just re-use the same zfs-core for both of them.&lt;br /&gt;
&lt;br /&gt;
== Using the prebuilt srm ==&lt;br /&gt;
&lt;br /&gt;
=== Download the SRM ===&lt;br /&gt;
If you didn't build your own srm and want to use the prebuilt one, just emerge '''&amp;quot;zfs-srm&amp;quot;''' from the tree:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge zfs-srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check available versions just as you did above for the kernels:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Available versions of the zfs-srm&lt;br /&gt;
# ##i##equery y zfs-srm&lt;br /&gt;
&lt;br /&gt;
[I]3.5.0 | o ~ o o o o o o o o o o o | o 3.5.0 | gentoo&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(These versions match the version of the System Rescue CD).&lt;br /&gt;
&lt;br /&gt;
Installing the zfs-srm will automatically pull the '''&amp;quot;bliss-isomaker&amp;quot;''' package which is just a script that assists you with rebuilding the System Rescue CD ISO so that the ISO includes the ZFS srms. The script lets you make a bootable ISO or a bootable USB.&lt;br /&gt;
&lt;br /&gt;
Once it's installed, switch to the /opt/bliss-isomaker folder &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-isomaker&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see a directory layout that looks similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-isomaker # ls -l&lt;br /&gt;
total 100&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 24 01:41 3.5.0&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 24 01:31 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root  312 May 24 01:31 README&lt;br /&gt;
-rw-r--r-- 1 root root  576 May 24 01:31 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 3228 May 24 01:31 create&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 iso&lt;br /&gt;
drwxr-xr-x 2 root root    4 May 24 01:41 resources&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The layout is as follows:&lt;br /&gt;
* 3.5.0 - This folder contains the System Rescue CD 3.5.0 specific srms for both the standard and alternate kernel that were installed by emerge.&lt;br /&gt;
* create - A script to automatically recreate the system rescue cd iso or usb with the zfs stuff included&lt;br /&gt;
* iso - directory to place your system rescue cd iso in&lt;br /&gt;
* srm - directory that has the srms&lt;br /&gt;
* resources - the files in this folder contain function calls that the 'create' script uses. You don't need to worry about these.&lt;br /&gt;
&lt;br /&gt;
=== Installing the SRM ===&lt;br /&gt;
There are a few ways to do this, you can either use one of the scripts, or you can do it manually. Before anything, make sure to copy the SRMs from the &amp;lt;Version&amp;gt; folder to the srm folder if you are using a prebuilt one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp 3.5.0/* srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Generating a new iso ====&lt;br /&gt;
If you just want to remake a new iso so that you can burn onto a cd or use in a virtual machine, just copy your iso over to the iso directory, and run the 'create' script. The new iso will be located in the iso directory as well with a -zfs ending. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 1 (or iso) chooses to make an iso. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 1&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create iso 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a fresh usb ====&lt;br /&gt;
If you want to have zfs on a usb with system rescue cd, put the iso in your iso dir, and then run the usb script. It will ask you what usb you want to format (This will delete everything), and then install system rescue cd onto it. Once that is done it will copy the zfs stuff over.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 2 (or usb) chooses to make an usb. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 2&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create usb 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Manual installation onto a usb ====&lt;br /&gt;
Assuming that your installing to a flash drive and that the flash drive is mounted in /mnt&lt;br /&gt;
&lt;br /&gt;
1. Mount your usb drive&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mount /dev/sdX# /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Where X# is the letter and number of your device. Immediately after you plug your usb in, type `dmesg | tail` in the console and you should see it.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Copy the zfs .srms to /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp zfs-core-3.4.37-std350-amd64.srm zfs-kmod-3.4.37-std350-amd64.srm zfs-kmod-3.8.4-alt350-amd64.srm /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. List your /mnt/usbstick directory and you should see something similar to the following in your /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus 3.5.0 # ls -l /mnt/usbstick&lt;br /&gt;
total 305028&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 boot&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootdisk&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootprog&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 efi&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 ntpasswd&lt;br /&gt;
-rwxr-xr-x 1 root root      2349 May 23 20:51 readme.txt&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:52 syslinux&lt;br /&gt;
-rwxr-xr-x 1 root root 309252096 May 23 20:51 sysrcd.dat&lt;br /&gt;
-rwxr-xr-x 1 root root        45 May 23 20:51 sysrcd.md5&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 usb_inst&lt;br /&gt;
-rwxr-xr-x 1 root root     15889 May 23 20:51 usb_inst.sh&lt;br /&gt;
-rwxr-xr-x 1 root root       877 May 23 20:51 usbstick.htm&lt;br /&gt;
-rwxr-xr-x 1 root root         6 May 23 20:51 version&lt;br /&gt;
-rwxr-xr-x 1 root root   2068480 May 23 20:51 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.8.4-alt350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now un-mount your flash drive and boot it into the machine that you want to use ZFS on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##umount /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Booting into the correct kernel ==&lt;br /&gt;
'''If you are using the standard srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
C) Standard 64bit kernel (rescue64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''If you are using the alternative srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
E) Alternative 64bit kernel (altker64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Run 'depmod' so that the new modules can be seen by the kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|You must run '''depmod'''. If you don't, then you will get failed to load the ZFS stack error!}}&lt;br /&gt;
&lt;br /&gt;
3. Use ZFS as usual. If you type '''zpool status''' and then type '''dmesg | tail''',&lt;br /&gt;
&lt;br /&gt;
you should see something that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
ZFS: Loaded module v0.6.1-1, ZFS pool version 5000, ZFS filesystem version 5&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see the above, then the modules loaded successfully!&lt;br /&gt;
&lt;br /&gt;
Enjoy System Rescue CD with ZFS :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the premade iso ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;If you don't want to do any of the above stuff but just want the ISO with the ZFS SRMs already included, simply [http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/systemrescuecd-x86-3.7.0-zfs.iso/ Download the ISO].&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules</id>
		<title>Creating System Rescue CD ZFS Modules</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules"/>
				<updated>2013-06-15T21:24:05Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: removed overlay stuff&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will show you how to create your own zfs srm or download the prebuilt zfs srm module from my website.&lt;br /&gt;
&lt;br /&gt;
== Compiling a compatible kernel ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is decide for which version of System Rescue CD you will be building for. Each System Rescue CD version has a different set of kernels. Specifically each version has a Stable kernel and an Alternate Kernel. The stable kernels get minor version increments every release (Sometimes major ones but usually doesn't happen too quickly), the Alternate kernels tend to move up much faster. For example System Rescue CD had the following stable/alternate kernels:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Version !! Stable !! Alternate&lt;br /&gt;
|-&lt;br /&gt;
| 3.7.0 || 3.4.47 || 3.9.4&lt;br /&gt;
|-&lt;br /&gt;
| 3.5.0 || 3.4.37 || 3.8.4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Download kernel and patches===&lt;br /&gt;
Once you decide which version you want to use, you can go to http://kernel.sysresccd.org/ and pick the version you want. After you do this, download all the stuff in that directory and put them in their own folder (a work directory). The files that are named std-sources are the patches for the regular stable kernel, the patches named alt-sources are the patches for the alternate kernel. Once you have the patches, go to kernel.org and also download the initial release of the kernel sources you want. For example, if you want to build an srm for 3.4.2 which uses the 3.4.35 kernel, just download the 3.4 (3.4.0) kernel. You just need to download the initial release because one of the patches you downloaded earlier is the patch to update the 3.4.0 to 3.4.35.&lt;br /&gt;
&lt;br /&gt;
Once you download the kernel you want, let's extract and patch it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##tar xf linux-3.4.tar.bz2&lt;br /&gt;
# ##i##mv linux-3.4 linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-01-stable-3.4.35.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-02-fc16.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-03-aufs.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Retrieve kernel configuration===&lt;br /&gt;
Once that is complete, you will need to get the kernel config specifically for the kernel and architecture you want. The easiest way I found to do this was to download the System Rescue CD you want, and then boot it inside a VM. Once you are inside the VM, go to the /root directory, and it will be a file named kernel-&amp;lt;version&amp;gt;.conf. Copy this file over SSH and put it in a safe location. Also copy it over into the linux kernel directory and rename it to .config.&lt;br /&gt;
&lt;br /&gt;
===Build the kernel===&lt;br /&gt;
Once you copy the kernel config over, do a make menuconfig to begin. You will only need to change two settings inside the config, add the proper kernel name, and remove the old initramfs source files directory. This directory doesn't exist locally. This is a remnant of upstream's build process.&lt;br /&gt;
&lt;br /&gt;
Follow the below tree structure, and make it equal to what is below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
General Setup -&amp;gt;&lt;br /&gt;
 (-std342-amd64) Local version - append to kernel release&lt;br /&gt;
 [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support  ()    Initramfs source file(s)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Local version above will end up making the kernel modules directory be 3.4.35-std342-amd64. The reason the kernel modules directory has to be equal to this is because our directory will be merged into the System Rescue CD later on, so the names need to be exactly the same so that the System Rescue CD system can find our kernel modules.&lt;br /&gt;
&lt;br /&gt;
If you want to build an srm (which you do), you also need to change the following inside the kernel config so that squashfs-tools can work later on:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
File Systems -&amp;gt;&lt;br /&gt;
Miscellaneous Filesystems -&amp;gt;&lt;br /&gt;
 &amp;lt;*&amp;gt;   SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  [*]     Squashfs XATTR support&lt;br /&gt;
  [*]     Include support for ZLIB compressed file systems&lt;br /&gt;
  [*]     Include support for LZO compressed file systems&lt;br /&gt;
  [*]     Include support for XZ compressed file systems&lt;br /&gt;
  [ ]     Use 4K device block size?&lt;br /&gt;
  [ ]     Additional option for memory-constrained systems&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now save and exit, and continue to build 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 modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have multiple cores, do a make -j&amp;lt;# of processors+1&amp;gt; to build faster. Example: '''make -j9''' for an 8 core machine.}}&lt;br /&gt;
&lt;br /&gt;
=== Using the portage tree ===&lt;br /&gt;
Inside the portage tree, there are ebuilds already prepared that will download the kernel, patch it, and perform any required substitutions. Afterwards you literally just go into your /usr/src/&amp;lt;kernel&amp;gt; directory, and run make. To see the available versions, run the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Versions available for standard kernel&lt;br /&gt;
# ##i##equery y std-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.4.37-r1 | o ~ o o o o o o o o o o o | o 3.4.37 | gentoo&lt;br /&gt;
&lt;br /&gt;
Versions available for alternate kernel&lt;br /&gt;
# ##i##equery y alt-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.8.4 | o ~ o o o o o o o o o o o | o 3.8.4 | gentoo&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I haven't written the ebuilds in a way where it's easy to tell (at first glance) what System Rescue CD version you need. However, you can check the ebuild and you will see the version of the CD inside there. You can also check the chart above.&lt;br /&gt;
&lt;br /&gt;
If you wanted to install the standard kernel sources, you just emerge it like any other application:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge std-sources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the kernel and the kernel module are installed, you need to make the SRM.&lt;br /&gt;
&lt;br /&gt;
== Creating the SRM ==&lt;br /&gt;
It's time to gather the required files and pack them together in order for it to become an SRM. An SRM is nothing more than a directory that has been compressed with squashfs. You can emerge the &amp;quot;Bliss Initramfs Creator&amp;quot; which has a feature that will automagically build the srm for you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You also need to have spl, zfs, and zfs-kmod installed on your system before you try to make the srm. Emerging '''&amp;quot;bliss-initramfs&amp;quot;''' should automatically pull those packages. If it doesn't, make sure you install them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs srm&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should now have the following directory layout inside the '''/opt/bliss-initramfs''' folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-initramfs # ls -l&lt;br /&gt;
total 117&lt;br /&gt;
-rw-r--r-- 1 root root 6718 May 23 18:05 CHANGES&lt;br /&gt;
-rw-r--r-- 1 root root  176 May 23 18:05 CREDITS&lt;br /&gt;
-rw-r--r-- 1 root root  431 May 23 18:05 HELP&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 23 18:05 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root 1852 May 23 18:05 README&lt;br /&gt;
-rw-r--r-- 1 root root 3194 May 23 18:05 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 2891 May 23 18:05 createInit&lt;br /&gt;
drwxr-xr-x 3 root root    4 May 23 18:11 files&lt;br /&gt;
drwxr-xr-x 3 root root    6 May 23 18:11 hooks&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 23 22:01 resources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run the '''createInit''' script and follow the instructions for the kernel you want to make the srm for (In this case it's '''3.4.37-std350-amd64'''):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-----------------------------------&lt;br /&gt;
| Bliss Initramfs Creator - v1.8.1&lt;br /&gt;
| Author: Jonathan Vasquez &amp;lt;jvasquez1011@gmail.com&amp;gt;&lt;br /&gt;
| Distributed under the Simplified BSD License&lt;br /&gt;
-----------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Which initramfs would you like to generate:&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS&lt;br /&gt;
&amp;gt;&amp;gt; 2. Encrypted ZFS (LUKS + ZFS)&lt;br /&gt;
&amp;gt;&amp;gt; 3. More Options&lt;br /&gt;
&amp;gt;&amp;gt; 4. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##3 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; More Options:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS - System Rescue Module&lt;br /&gt;
&amp;gt;&amp;gt; 2. Back&lt;br /&gt;
&amp;gt;&amp;gt; 3. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating a ZFS System Rescue Module!&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Do you want to use the current kernel: 3.8.13-ALL? [Y/n]: ##i##n ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Please enter the kernel name: ##i##3.4.37-std350-amd64 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Detected 64 bit platform&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking to see if modules directory exists for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating SRMs for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating directory structure for initramfs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking preliminary binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Using ZFS&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying documentation...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying udev rules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Compressing kernel modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Getting dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Configuring files...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating and Packing SRMs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Complete :)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you should have two new files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-rw-r--r-- 1 root root 2068480 May 24 01:05 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rw-r--r-- 1 root root  483328 May 24 01:05 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now all you need to do is put those two files in the root of your USB directory.&lt;br /&gt;
&lt;br /&gt;
If you are making srms for both the standard and alternate kernels, you will end up with two zfs-core files and two zfs-kmod files (1 set for each kernel). You don't need to put the zfs-core that it makes for one of the kernels. The zfs-core srm only has zfs program binaries, man pages, udev rules, and a few other things. The zfs-kmod is the srm that has the kernel modules (and only the kernel modules). So you can easily just put two zfs-kmods (one for each kernel version) and just re-use the same zfs-core for both of them.&lt;br /&gt;
&lt;br /&gt;
== Using the prebuilt srm ==&lt;br /&gt;
&lt;br /&gt;
=== Download the SRM ===&lt;br /&gt;
If you didn't build your own srm and want to use the prebuilt one, just emerge '''&amp;quot;zfs-srm&amp;quot;''' from the overlay:&lt;br /&gt;
&lt;br /&gt;
(Instructions on [[Creating_System_Rescue_CD_ZFS_Modules#Adding_the_overlay|adding the overlay]] can be found at the top of this page)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge zfs-srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check available versions just as you did above for the kernels:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Available versions of the zfs-srm&lt;br /&gt;
# ##i##equery y -O zfs-srm&lt;br /&gt;
&lt;br /&gt;
[I]3.5.0 | o ~ o o o o o o o o o o o | o 3.5.0 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(These versions match the version of the System Rescue CD).&lt;br /&gt;
&lt;br /&gt;
Installing the zfs-srm will automatically pull the '''&amp;quot;bliss-isomaker&amp;quot;''' package which is just a script that assists you with rebuilding the System Rescue CD ISO so that the ISO includes the ZFS srms. The script lets you make a bootable ISO or a bootable USB.&lt;br /&gt;
&lt;br /&gt;
Once it's installed, switch to the /opt/bliss-isomaker folder &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-isomaker&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see a directory layout that looks similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-isomaker # ls -l&lt;br /&gt;
total 100&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 24 01:41 3.5.0&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 24 01:31 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root  312 May 24 01:31 README&lt;br /&gt;
-rw-r--r-- 1 root root  576 May 24 01:31 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 3228 May 24 01:31 create&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 iso&lt;br /&gt;
drwxr-xr-x 2 root root    4 May 24 01:41 resources&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The layout is as follows:&lt;br /&gt;
* 3.5.0 - This folder contains the System Rescue CD 3.5.0 specific srms for both the standard and alternate kernel that were installed by emerge.&lt;br /&gt;
* create - A script to automatically recreate the system rescue cd iso or usb with the zfs stuff included&lt;br /&gt;
* iso - directory to place your system rescue cd iso in&lt;br /&gt;
* srm - directory that has the srms&lt;br /&gt;
* resources - the files in this folder contain function calls that the 'create' script uses. You don't need to worry about these.&lt;br /&gt;
&lt;br /&gt;
=== Installing the SRM ===&lt;br /&gt;
There are a few ways to do this, you can either use one of the scripts, or you can do it manually. Before anything, make sure to copy the SRMs from the &amp;lt;Version&amp;gt; folder to the srm folder if you are using a prebuilt one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp 3.5.0/* srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Generating a new iso ====&lt;br /&gt;
If you just want to remake a new iso so that you can burn onto a cd or use in a virtual machine, just copy your iso over to the iso directory, and run the 'create' script. The new iso will be located in the iso directory as well with a -zfs ending. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 1 (or iso) chooses to make an iso. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 1&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create iso 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a fresh usb ====&lt;br /&gt;
If you want to have zfs on a usb with system rescue cd, put the iso in your iso dir, and then run the usb script. It will ask you what usb you want to format (This will delete everything), and then install system rescue cd onto it. Once that is done it will copy the zfs stuff over.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 2 (or usb) chooses to make an usb. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 2&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create usb 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Manual installation onto a usb ====&lt;br /&gt;
Assuming that your installing to a flash drive and that the flash drive is mounted in /mnt&lt;br /&gt;
&lt;br /&gt;
1. Mount your usb drive&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mount /dev/sdX# /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Where X# is the letter and number of your device. Immediately after you plug your usb in, type `dmesg | tail` in the console and you should see it.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Copy the zfs .srms to /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp zfs-core-3.4.37-std350-amd64.srm zfs-kmod-3.4.37-std350-amd64.srm zfs-kmod-3.8.4-alt350-amd64.srm /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. List your /mnt/usbstick directory and you should see something similar to the following in your /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus 3.5.0 # ls -l /mnt/usbstick&lt;br /&gt;
total 305028&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 boot&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootdisk&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootprog&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 efi&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 ntpasswd&lt;br /&gt;
-rwxr-xr-x 1 root root      2349 May 23 20:51 readme.txt&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:52 syslinux&lt;br /&gt;
-rwxr-xr-x 1 root root 309252096 May 23 20:51 sysrcd.dat&lt;br /&gt;
-rwxr-xr-x 1 root root        45 May 23 20:51 sysrcd.md5&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 usb_inst&lt;br /&gt;
-rwxr-xr-x 1 root root     15889 May 23 20:51 usb_inst.sh&lt;br /&gt;
-rwxr-xr-x 1 root root       877 May 23 20:51 usbstick.htm&lt;br /&gt;
-rwxr-xr-x 1 root root         6 May 23 20:51 version&lt;br /&gt;
-rwxr-xr-x 1 root root   2068480 May 23 20:51 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.8.4-alt350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now un-mount your flash drive and boot it into the machine that you want to use ZFS on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##umount /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Booting into the correct kernel ==&lt;br /&gt;
'''If you are using the standard srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
C) Standard 64bit kernel (rescue64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''If you are using the alternative srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
E) Alternative 64bit kernel (altker64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Run 'depmod' so that the new modules can be seen by the kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|You must run '''depmod'''. If you don't, then you will get failed to load the ZFS stack error!}}&lt;br /&gt;
&lt;br /&gt;
3. Use ZFS as usual. If you type '''zpool status''' and then type '''dmesg | tail''',&lt;br /&gt;
&lt;br /&gt;
you should see something that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
ZFS: Loaded module v0.6.1-1, ZFS pool version 5000, ZFS filesystem version 5&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see the above, then the modules loaded successfully!&lt;br /&gt;
&lt;br /&gt;
Enjoy System Rescue CD with ZFS :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the premade iso ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;If you don't want to do any of the above stuff but just want the ISO with the ZFS SRMs already included, simply [http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/systemrescuecd-x86-3.7.0-zfs.iso/ Download the ISO].&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Fearedbliss</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-06-15T21:19:52Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Bliss Initramfs Creator */ - removed overlay stuff&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: systemrescuecd-x86-3.7.0-zfs (402 MiB)&lt;br /&gt;
Release Date: 2013-06-09&lt;br /&gt;
md5sum 62605474641ce2b1a07fec8330377208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/systemrescuecd-x86-3.7.0-zfs.iso Download System Rescue CD 3.7.0 with ZFS]'''&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Inside the ISO (Loading the ZFS Modules) ==&lt;br /&gt;
Once you boot into your System Rescue CD environment, you will need to update the kernel's dependency list so that the kernel knows that the zfs modules are available. This is extremely easy and it only takes one second. Just type the following two commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
# ##i##modprobe -v zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see 6 modules load. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##depmod&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/spl/spl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/nvpair/znvpair.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zcommon/zcommon.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/avl/zavl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/unicode/zunicode.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zfs/zfs.ko.gz&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don't do the depmod first, you will see the following error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
modprobe: FATAL: Module zfs not found.&lt;br /&gt;
&lt;br /&gt;
# OR You will see this if you try to run a zfs command without having the modules loaded&lt;br /&gt;
&lt;br /&gt;
root@sysresccd /root % ##i##zpool status&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So make sure to run '''depmod''' first!&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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). &lt;br /&gt;
&lt;br /&gt;
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;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
If you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use before emerging:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&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           ext2            defaults        0 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;
[[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>Fearedbliss</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-06-14T05:00:55Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Inside the ISO */&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: systemrescuecd-x86-3.7.0-zfs (402 MiB)&lt;br /&gt;
Release Date: 2013-06-09&lt;br /&gt;
md5sum 62605474641ce2b1a07fec8330377208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/systemrescuecd-x86-3.7.0-zfs.iso Download System Rescue CD 3.7.0 with ZFS]'''&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Inside the ISO (Loading the ZFS Modules) ==&lt;br /&gt;
Once you boot into your System Rescue CD environment, you will need to update the kernel's dependency list so that the kernel knows that the zfs modules are available. This is extremely easy and it only takes one second. Just type the following two commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
# ##i##modprobe -v zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see 6 modules load. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##depmod&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/spl/spl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/nvpair/znvpair.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zcommon/zcommon.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/avl/zavl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/unicode/zunicode.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zfs/zfs.ko.gz&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don't do the depmod first, you will see the following error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
modprobe: FATAL: Module zfs not found.&lt;br /&gt;
&lt;br /&gt;
# OR You will see this if you try to run a zfs command without having the modules loaded&lt;br /&gt;
&lt;br /&gt;
root@sysresccd /root % ##i##zpool status&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So make sure to run '''depmod''' first!&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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). &lt;br /&gt;
&lt;br /&gt;
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;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
I've written an ebuild to install the creator for you on your machine. The ebuild is in my overlay so we will first add my overlay to your machine. &lt;br /&gt;
&lt;br /&gt;
First we will clone it to a directory on your machine, let's say &amp;quot;/home/example/overlays/fearedbliss&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can install the creator, but before we do that, if you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&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           ext2            defaults        0 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;
[[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>Fearedbliss</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-06-14T05:00:34Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Inside the ISO */&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: systemrescuecd-x86-3.7.0-zfs (402 MiB)&lt;br /&gt;
Release Date: 2013-06-09&lt;br /&gt;
md5sum 62605474641ce2b1a07fec8330377208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/systemrescuecd-x86-3.7.0-zfs.iso Download System Rescue CD 3.7.0 with ZFS]'''&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Inside the ISO ==&lt;br /&gt;
Once you boot into your System Rescue CD environment, you will need to update the kernel's dependency list so that the kernel knows that the zfs modules are available. This is extremely easy and it only takes one second. Just type the following two commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
# ##i##modprobe -v zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see 6 modules load. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##depmod&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/spl/spl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/nvpair/znvpair.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zcommon/zcommon.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/avl/zavl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/unicode/zunicode.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zfs/zfs.ko.gz&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don't do the depmod first, you will see the following error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
modprobe: FATAL: Module zfs not found.&lt;br /&gt;
&lt;br /&gt;
# OR You will see this if you try to run a zfs command without having the modules loaded&lt;br /&gt;
&lt;br /&gt;
root@sysresccd /root % ##i##zpool status&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
Failed to load ZFS module stack.&lt;br /&gt;
Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So make sure to run '''depmod''' first!&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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). &lt;br /&gt;
&lt;br /&gt;
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;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
I've written an ebuild to install the creator for you on your machine. The ebuild is in my overlay so we will first add my overlay to your machine. &lt;br /&gt;
&lt;br /&gt;
First we will clone it to a directory on your machine, let's say &amp;quot;/home/example/overlays/fearedbliss&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can install the creator, but before we do that, if you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&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           ext2            defaults        0 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;
[[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>Fearedbliss</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-06-14T04:59:16Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: added how to load zfs modules section&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: systemrescuecd-x86-3.7.0-zfs (402 MiB)&lt;br /&gt;
Release Date: 2013-06-09&lt;br /&gt;
md5sum 62605474641ce2b1a07fec8330377208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/systemrescuecd-x86-3.7.0-zfs.iso Download System Rescue CD 3.7.0 with ZFS]'''&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Inside the ISO ==&lt;br /&gt;
Once you boot into your System Rescue CD environment, you will need to update the kernel's dependency list so that the kernel knows that the zfs modules are available. This is extremely easy and it only takes one second. Just type the following two commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
# ##i##modprobe -v zfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see 6 modules load. Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % ##i##depmod&lt;br /&gt;
root@sysresccd /root % ##i##modprobe -v zfs&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/spl/spl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/nvpair/znvpair.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zcommon/zcommon.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/avl/zavl.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/unicode/zunicode.ko.gz&lt;br /&gt;
insmod /lib/modules/3.9.4-alt370-amd64/extra/zfs/zfs.ko.gz&lt;br /&gt;
root@sysresccd /root %&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you don't do the depmod first, you will see the following error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
root@sysresccd /root % modprobe -v zfs&lt;br /&gt;
modprobe: FATAL: Module zfs not found.&lt;br /&gt;
root@sysresccd /root %&lt;br /&gt;
OR You will see this if you try to run a zfs command without having the modules loaded&lt;br /&gt;
root@sysresccd /root % zpool statusFailed to load ZFS module stack.Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.Failed to load ZFS module stack.Load the module manually by running 'insmod &amp;lt;location&amp;gt;/zfs.ko' as root.root@sysresccd /root %&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So make sure to run '''depmod''' first!&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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). &lt;br /&gt;
&lt;br /&gt;
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;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
I've written an ebuild to install the creator for you on your machine. The ebuild is in my overlay so we will first add my overlay to your machine. &lt;br /&gt;
&lt;br /&gt;
First we will clone it to a directory on your machine, let's say &amp;quot;/home/example/overlays/fearedbliss&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can install the creator, but before we do that, if you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&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           ext2            defaults        0 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;
[[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>Fearedbliss</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-06-14T04:20:34Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Create the initramfs */ - removed extlinux sections&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: systemrescuecd-x86-3.7.0-zfs (402 MiB)&lt;br /&gt;
Release Date: 2013-06-09&lt;br /&gt;
md5sum 62605474641ce2b1a07fec8330377208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/systemrescuecd-x86-3.7.0-zfs.iso Download System Rescue CD 3.7.0 with ZFS]'''&amp;lt;br /&amp;gt;&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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). &lt;br /&gt;
&lt;br /&gt;
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;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
I've written an ebuild to install the creator for you on your machine. The ebuild is in my overlay so we will first add my overlay to your machine. &lt;br /&gt;
&lt;br /&gt;
First we will clone it to a directory on your machine, let's say &amp;quot;/home/example/overlays/fearedbliss&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can install the creator, but before we do that, if you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&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           ext2            defaults        0 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;
[[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>Fearedbliss</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-06-14T04:19:54Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Install the bootloader */ - removed extlinux section&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: systemrescuecd-x86-3.7.0-zfs (402 MiB)&lt;br /&gt;
Release Date: 2013-06-09&lt;br /&gt;
md5sum 62605474641ce2b1a07fec8330377208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/systemrescuecd-x86-3.7.0-zfs.iso Download System Rescue CD 3.7.0 with ZFS]'''&amp;lt;br /&amp;gt;&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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). &lt;br /&gt;
&lt;br /&gt;
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;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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.8.5-ALL&lt;br /&gt;
  KERNEL /vmlinuz-3.8.5-ALL&lt;br /&gt;
  INITRD /initramfs-genkernel-x86_64-3.8.5-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;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
I've written an ebuild to install the creator for you on your machine. The ebuild is in my overlay so we will first add my overlay to your machine. &lt;br /&gt;
&lt;br /&gt;
First we will clone it to a directory on your machine, let's say &amp;quot;/home/example/overlays/fearedbliss&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can install the creator, but before we do that, if you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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.8.5-ALL  &lt;br /&gt;
  KERNEL /vmlinuz-3.8.5-ALL  &lt;br /&gt;
  INITRD /initrd-3.8.5-ALL.img  &lt;br /&gt;
  APPEND root=rpool/ROOT/funtoo quiet&lt;br /&gt;
  # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
  # APPEND root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&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           ext2            defaults        0 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;
[[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>Fearedbliss</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-06-11T01:02:52Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Video Tutorial */ - updated video to zfs install v2&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=SuCjLjVV800|width=640|height=360}}&lt;br /&gt;
&lt;br /&gt;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: systemrescuecd-x86-3.7.0-zfs (402 MiB)&lt;br /&gt;
Release Date: 2013-06-09&lt;br /&gt;
md5sum 62605474641ce2b1a07fec8330377208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/systemrescuecd-x86-3.7.0-zfs.iso Download System Rescue CD 3.7.0 with ZFS]'''&amp;lt;br /&amp;gt;&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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). &lt;br /&gt;
&lt;br /&gt;
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;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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.8.5-ALL&lt;br /&gt;
  KERNEL /vmlinuz-3.8.5-ALL&lt;br /&gt;
  INITRD /initramfs-genkernel-x86_64-3.8.5-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;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
I've written an ebuild to install the creator for you on your machine. The ebuild is in my overlay so we will first add my overlay to your machine. &lt;br /&gt;
&lt;br /&gt;
First we will clone it to a directory on your machine, let's say &amp;quot;/home/example/overlays/fearedbliss&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can install the creator, but before we do that, if you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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.8.5-ALL  &lt;br /&gt;
  KERNEL /vmlinuz-3.8.5-ALL  &lt;br /&gt;
  INITRD /initrd-3.8.5-ALL.img  &lt;br /&gt;
  APPEND root=rpool/ROOT/funtoo quiet&lt;br /&gt;
  # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
  # APPEND root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&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           ext2            defaults        0 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;
[[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>Fearedbliss</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-06-10T04:32:20Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Create the initramfs */&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;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: systemrescuecd-x86-3.7.0-zfs (402 MiB)&lt;br /&gt;
Release Date: 2013-06-09&lt;br /&gt;
md5sum 62605474641ce2b1a07fec8330377208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://jonathanvasquez.com/files/sysresccd/3.7.0/iso/systemrescuecd-x86-3.7.0-zfs.iso Download System Rescue CD 3.7.0 with ZFS]'''&amp;lt;br /&amp;gt;&lt;br /&gt;
&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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). &lt;br /&gt;
&lt;br /&gt;
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;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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.8.5-ALL&lt;br /&gt;
  KERNEL /vmlinuz-3.8.5-ALL&lt;br /&gt;
  INITRD /initramfs-genkernel-x86_64-3.8.5-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;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
I've written an ebuild to install the creator for you on your machine. The ebuild is in my overlay so we will first add my overlay to your machine. &lt;br /&gt;
&lt;br /&gt;
First we will clone it to a directory on your machine, let's say &amp;quot;/home/example/overlays/fearedbliss&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can install the creator, but before we do that, if you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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.8.5-ALL  &lt;br /&gt;
  KERNEL /vmlinuz-3.8.5-ALL  &lt;br /&gt;
  INITRD /initrd-3.8.5-ALL.img  &lt;br /&gt;
  APPEND root=rpool/ROOT/funtoo quiet&lt;br /&gt;
  # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
  # APPEND root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&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           ext2            defaults        0 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;
[[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>Fearedbliss</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-06-10T04:25:01Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Create the initramfs */ removed /boot prefix from boot lines&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;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: systemrescuecd-x86-3.7.0-zfs (402 MiB)&lt;br /&gt;
Release Date: 2013-06-09&lt;br /&gt;
md5sum 62605474641ce2b1a07fec8330377208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://jonathanvasquez.com/files/sysresccd/3.7.0/iso/systemrescuecd-x86-3.7.0-zfs.iso Download System Rescue CD 3.7.0 with ZFS]'''&amp;lt;br /&amp;gt;&lt;br /&gt;
&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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). &lt;br /&gt;
&lt;br /&gt;
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;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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.8.5-ALL&lt;br /&gt;
  KERNEL /vmlinuz-3.8.5-ALL&lt;br /&gt;
  INITRD /initramfs-genkernel-x86_64-3.8.5-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;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
I've written an ebuild to install the creator for you on your machine. The ebuild is in my overlay so we will first add my overlay to your machine. &lt;br /&gt;
&lt;br /&gt;
First we will clone it to a directory on your machine, let's say &amp;quot;/home/example/overlays/fearedbliss&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can install the creator, but before we do that, if you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /boot/vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /initrd-3.8.5-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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.8.5-ALL  &lt;br /&gt;
  KERNEL /vmlinuz-3.8.5-ALL  &lt;br /&gt;
  INITRD /initrd-3.8.5-ALL.img  &lt;br /&gt;
  APPEND root=rpool/ROOT/funtoo quiet&lt;br /&gt;
  # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
  # APPEND root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&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           ext2            defaults        0 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;
[[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>Fearedbliss</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-06-10T00:37:23Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: cleaned up and renamed the &amp;quot;downloading the iso&amp;quot; section&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;
== Downloading the ISO (With ZFS) ==&lt;br /&gt;
In order for us to install Funtoo on ZFS, you will need an environment that provides the ZFS tools. Therefore we will download the premade System Rescue CD with ZFS SRMs (System Rescue Modules) already included.&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;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Name: systemrescuecd-x86-3.7.0-zfs (402 MiB)&lt;br /&gt;
Release Date: 2013-06-09&lt;br /&gt;
md5sum 62605474641ce2b1a07fec8330377208&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''[http://jonathanvasquez.com/files/sysresccd/3.7.0/iso/systemrescuecd-x86-3.7.0-zfs.iso Download System Rescue CD 3.7.0 with ZFS]'''&amp;lt;br /&amp;gt;&lt;br /&gt;
&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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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). &lt;br /&gt;
&lt;br /&gt;
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;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /boot/vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /boot/initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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.8.5-ALL&lt;br /&gt;
  KERNEL /boot/vmlinuz-3.8.5-ALL&lt;br /&gt;
  INITRD /boot/initramfs-genkernel-x86_64-3.8.5-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;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
I've written an ebuild to install the creator for you on your machine. The ebuild is in my overlay so we will first add my overlay to your machine. &lt;br /&gt;
&lt;br /&gt;
First we will clone it to a directory on your machine, let's say &amp;quot;/home/example/overlays/fearedbliss&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can install the creator, but before we do that, if you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /boot/vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /boot/vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /boot/initrd-3.8.5-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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.8.5-ALL  &lt;br /&gt;
  KERNEL /boot/vmlinuz-3.8.5-ALL  &lt;br /&gt;
  INITRD /boot/initrd-3.8.5-ALL.img  &lt;br /&gt;
  APPEND root=rpool/ROOT/funtoo quiet&lt;br /&gt;
  # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
  # APPEND root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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           ext2            defaults        0 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;
[[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>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules</id>
		<title>Creating System Rescue CD ZFS Modules</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules"/>
				<updated>2013-06-10T00:29:17Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will show you how to create your own zfs srm or download the prebuilt zfs srm module from my website.&lt;br /&gt;
&lt;br /&gt;
== Adding the overlay ==&lt;br /&gt;
There are scripts that I've written that will make this process much easier for you. So we will first set up the overlay to a directory on your machine, let's say '''&amp;quot;/home/example/overlays/fearedbliss&amp;quot;''':&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that the overlay has been added, let's continue.&lt;br /&gt;
&lt;br /&gt;
== Compiling a compatible kernel ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is decide for which version of System Rescue CD you will be building for. Each System Rescue CD version has a different set of kernels. Specifically each version has a Stable kernel and an Alternate Kernel. The stable kernels get minor version increments every release (Sometimes major ones but usually doesn't happen too quickly), the Alternate kernels tend to move up much faster. For example System Rescue CD had the following stable/alternate kernels:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Version !! Stable !! Alternate&lt;br /&gt;
|-&lt;br /&gt;
| 3.7.0 || 3.4.47 || 3.9.4&lt;br /&gt;
|-&lt;br /&gt;
| 3.5.0 || 3.4.37 || 3.8.4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Download kernel and patches===&lt;br /&gt;
Once you decide which version you want to use, you can go to http://kernel.sysresccd.org/ and pick the version you want. After you do this, download all the stuff in that directory and put them in their own folder (a work directory). The files that are named std-sources are the patches for the regular stable kernel, the patches named alt-sources are the patches for the alternate kernel. Once you have the patches, go to kernel.org and also download the initial release of the kernel sources you want. For example, if you want to build an srm for 3.4.2 which uses the 3.4.35 kernel, just download the 3.4 (3.4.0) kernel. You just need to download the initial release because one of the patches you downloaded earlier is the patch to update the 3.4.0 to 3.4.35.&lt;br /&gt;
&lt;br /&gt;
Once you download the kernel you want, let's extract and patch it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##tar xf linux-3.4.tar.bz2&lt;br /&gt;
# ##i##mv linux-3.4 linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-01-stable-3.4.35.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-02-fc16.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-03-aufs.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Retrieve kernel configuration===&lt;br /&gt;
Once that is complete, you will need to get the kernel config specifically for the kernel and architecture you want. The easiest way I found to do this was to download the System Rescue CD you want, and then boot it inside a VM. Once you are inside the VM, go to the /root directory, and it will be a file named kernel-&amp;lt;version&amp;gt;.conf. Copy this file over SSH and put it in a safe location. Also copy it over into the linux kernel directory and rename it to .config.&lt;br /&gt;
&lt;br /&gt;
===Build the kernel===&lt;br /&gt;
Once you copy the kernel config over, do a make menuconfig to begin. You will only need to change two settings inside the config, add the proper kernel name, and remove the old initramfs source files directory. This directory doesn't exist locally. This is a remnant of upstream's build process.&lt;br /&gt;
&lt;br /&gt;
Follow the below tree structure, and make it equal to what is below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
General Setup -&amp;gt;&lt;br /&gt;
 (-std342-amd64) Local version - append to kernel release&lt;br /&gt;
 [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support  ()    Initramfs source file(s)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Local version above will end up making the kernel modules directory be 3.4.35-std342-amd64. The reason the kernel modules directory has to be equal to this is because our directory will be merged into the System Rescue CD later on, so the names need to be exactly the same so that the System Rescue CD system can find our kernel modules.&lt;br /&gt;
&lt;br /&gt;
If you want to build an srm (which you do), you also need to change the following inside the kernel config so that squashfs-tools can work later on:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
File Systems -&amp;gt;&lt;br /&gt;
Miscellaneous Filesystems -&amp;gt;&lt;br /&gt;
 &amp;lt;*&amp;gt;   SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  [*]     Squashfs XATTR support&lt;br /&gt;
  [*]     Include support for ZLIB compressed file systems&lt;br /&gt;
  [*]     Include support for LZO compressed file systems&lt;br /&gt;
  [*]     Include support for XZ compressed file systems&lt;br /&gt;
  [ ]     Use 4K device block size?&lt;br /&gt;
  [ ]     Additional option for memory-constrained systems&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now save and exit, and continue to build 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 modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have multiple cores, do a make -j&amp;lt;# of processors+1&amp;gt; to build faster. Example: '''make -j9''' for an 8 core machine.}}&lt;br /&gt;
&lt;br /&gt;
=== Using the overlay ===&lt;br /&gt;
Inside the overlay, there are ebuilds already prepared that will download the kernel, patch it, and perform any required substitutions. Afterwards you literally just go into your /usr/src/&amp;lt;kernel&amp;gt; directory, and run make. To see the available versions, run the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Versions available for standard kernel&lt;br /&gt;
# ##i##equery y -O std-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.4.37-r1 | o ~ o o o o o o o o o o o | o 3.4.37 | fearedbliss&lt;br /&gt;
&lt;br /&gt;
Versions available for alternate kernel&lt;br /&gt;
# ##i##equery y -O alt-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.8.4 | o ~ o o o o o o o o o o o | o 3.8.4 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I haven't written the ebuilds in a way where it's easy to tell (at first glance) what System Rescue CD version you need. However, you can check the ebuild and you will see the version of the CD inside there. You can also check the chart above.&lt;br /&gt;
&lt;br /&gt;
If you wanted to install the standard kernel sources, you just emerge it like any other application:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge std-sources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the kernel and the kernel module are installed, you need to make the SRM.&lt;br /&gt;
&lt;br /&gt;
== Creating the SRM ==&lt;br /&gt;
It's time to gather the required files and pack them together in order for it to become an SRM. An SRM is nothing more than a directory that has been compressed with squashfs. Thankfully I've written a script that will build it for you, and you can install it from the overlay.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You also need to have spl, zfs, and zfs-kmod installed on your system before you try to make the srm. Emerging '''&amp;quot;bliss-initramfs&amp;quot;''' should automatically pull those packages. If it doesn't, make sure you install them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs srm&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should now have the following directory layout inside the '''/opt/bliss-initramfs''' folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-initramfs # ls -l&lt;br /&gt;
total 117&lt;br /&gt;
-rw-r--r-- 1 root root 6718 May 23 18:05 CHANGES&lt;br /&gt;
-rw-r--r-- 1 root root  176 May 23 18:05 CREDITS&lt;br /&gt;
-rw-r--r-- 1 root root  431 May 23 18:05 HELP&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 23 18:05 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root 1852 May 23 18:05 README&lt;br /&gt;
-rw-r--r-- 1 root root 3194 May 23 18:05 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 2891 May 23 18:05 createInit&lt;br /&gt;
drwxr-xr-x 3 root root    4 May 23 18:11 files&lt;br /&gt;
drwxr-xr-x 3 root root    6 May 23 18:11 hooks&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 23 22:01 resources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run the '''createInit''' script and follow the instructions for the kernel you want to make the srm for (In this case it's '''3.4.37-std350-amd64'''):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-----------------------------------&lt;br /&gt;
| Bliss Initramfs Creator - v1.8.1&lt;br /&gt;
| Author: Jonathan Vasquez &amp;lt;jvasquez1011@gmail.com&amp;gt;&lt;br /&gt;
| Distributed under the Simplified BSD License&lt;br /&gt;
-----------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Which initramfs would you like to generate:&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS&lt;br /&gt;
&amp;gt;&amp;gt; 2. Encrypted ZFS (LUKS + ZFS)&lt;br /&gt;
&amp;gt;&amp;gt; 3. More Options&lt;br /&gt;
&amp;gt;&amp;gt; 4. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##3 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; More Options:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS - System Rescue Module&lt;br /&gt;
&amp;gt;&amp;gt; 2. Back&lt;br /&gt;
&amp;gt;&amp;gt; 3. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating a ZFS System Rescue Module!&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Do you want to use the current kernel: 3.8.13-ALL? [Y/n]: ##i##n ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Please enter the kernel name: ##i##3.4.37-std350-amd64 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Detected 64 bit platform&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking to see if modules directory exists for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating SRMs for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating directory structure for initramfs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking preliminary binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Using ZFS&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying documentation...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying udev rules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Compressing kernel modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Getting dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Configuring files...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating and Packing SRMs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Complete :)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you should have two new files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-rw-r--r-- 1 root root 2068480 May 24 01:05 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rw-r--r-- 1 root root  483328 May 24 01:05 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now all you need to do is put those two files in the root of your USB directory.&lt;br /&gt;
&lt;br /&gt;
If you are making srms for both the standard and alternate kernels, you will end up with two zfs-core files and two zfs-kmod files (1 set for each kernel). You don't need to put the zfs-core that it makes for one of the kernels. The zfs-core srm only has zfs program binaries, man pages, udev rules, and a few other things. The zfs-kmod is the srm that has the kernel modules (and only the kernel modules). So you can easily just put two zfs-kmods (one for each kernel version) and just re-use the same zfs-core for both of them.&lt;br /&gt;
&lt;br /&gt;
== Using the prebuilt srm ==&lt;br /&gt;
&lt;br /&gt;
=== Download the SRM ===&lt;br /&gt;
If you didn't build your own srm and want to use the prebuilt one, just emerge '''&amp;quot;zfs-srm&amp;quot;''' from the overlay:&lt;br /&gt;
&lt;br /&gt;
(Instructions on [[Creating_System_Rescue_CD_ZFS_Modules#Adding_the_overlay|adding the overlay]] can be found at the top of this page)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge zfs-srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check available versions just as you did above for the kernels:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Available versions of the zfs-srm&lt;br /&gt;
# ##i##equery y -O zfs-srm&lt;br /&gt;
&lt;br /&gt;
[I]3.5.0 | o ~ o o o o o o o o o o o | o 3.5.0 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(These versions match the version of the System Rescue CD).&lt;br /&gt;
&lt;br /&gt;
Installing the zfs-srm will automatically pull the '''&amp;quot;bliss-isomaker&amp;quot;''' package which is just a script that assists you with rebuilding the System Rescue CD ISO so that the ISO includes the ZFS srms. The script lets you make a bootable ISO or a bootable USB.&lt;br /&gt;
&lt;br /&gt;
Once it's installed, switch to the /opt/bliss-isomaker folder &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-isomaker&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see a directory layout that looks similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-isomaker # ls -l&lt;br /&gt;
total 100&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 24 01:41 3.5.0&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 24 01:31 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root  312 May 24 01:31 README&lt;br /&gt;
-rw-r--r-- 1 root root  576 May 24 01:31 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 3228 May 24 01:31 create&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 iso&lt;br /&gt;
drwxr-xr-x 2 root root    4 May 24 01:41 resources&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The layout is as follows:&lt;br /&gt;
* 3.5.0 - This folder contains the System Rescue CD 3.5.0 specific srms for both the standard and alternate kernel that were installed by emerge.&lt;br /&gt;
* create - A script to automatically recreate the system rescue cd iso or usb with the zfs stuff included&lt;br /&gt;
* iso - directory to place your system rescue cd iso in&lt;br /&gt;
* srm - directory that has the srms&lt;br /&gt;
* resources - the files in this folder contain function calls that the 'create' script uses. You don't need to worry about these.&lt;br /&gt;
&lt;br /&gt;
=== Installing the SRM ===&lt;br /&gt;
There are a few ways to do this, you can either use one of the scripts, or you can do it manually. Before anything, make sure to copy the SRMs from the &amp;lt;Version&amp;gt; folder to the srm folder if you are using a prebuilt one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp 3.5.0/* srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Generating a new iso ====&lt;br /&gt;
If you just want to remake a new iso so that you can burn onto a cd or use in a virtual machine, just copy your iso over to the iso directory, and run the 'create' script. The new iso will be located in the iso directory as well with a -zfs ending. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 1 (or iso) chooses to make an iso. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 1&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create iso 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a fresh usb ====&lt;br /&gt;
If you want to have zfs on a usb with system rescue cd, put the iso in your iso dir, and then run the usb script. It will ask you what usb you want to format (This will delete everything), and then install system rescue cd onto it. Once that is done it will copy the zfs stuff over.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 2 (or usb) chooses to make an usb. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 2&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create usb 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Manual installation onto a usb ====&lt;br /&gt;
Assuming that your installing to a flash drive and that the flash drive is mounted in /mnt&lt;br /&gt;
&lt;br /&gt;
1. Mount your usb drive&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mount /dev/sdX# /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Where X# is the letter and number of your device. Immediately after you plug your usb in, type `dmesg | tail` in the console and you should see it.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Copy the zfs .srms to /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp zfs-core-3.4.37-std350-amd64.srm zfs-kmod-3.4.37-std350-amd64.srm zfs-kmod-3.8.4-alt350-amd64.srm /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. List your /mnt/usbstick directory and you should see something similar to the following in your /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus 3.5.0 # ls -l /mnt/usbstick&lt;br /&gt;
total 305028&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 boot&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootdisk&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootprog&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 efi&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 ntpasswd&lt;br /&gt;
-rwxr-xr-x 1 root root      2349 May 23 20:51 readme.txt&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:52 syslinux&lt;br /&gt;
-rwxr-xr-x 1 root root 309252096 May 23 20:51 sysrcd.dat&lt;br /&gt;
-rwxr-xr-x 1 root root        45 May 23 20:51 sysrcd.md5&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 usb_inst&lt;br /&gt;
-rwxr-xr-x 1 root root     15889 May 23 20:51 usb_inst.sh&lt;br /&gt;
-rwxr-xr-x 1 root root       877 May 23 20:51 usbstick.htm&lt;br /&gt;
-rwxr-xr-x 1 root root         6 May 23 20:51 version&lt;br /&gt;
-rwxr-xr-x 1 root root   2068480 May 23 20:51 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.8.4-alt350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now un-mount your flash drive and boot it into the machine that you want to use ZFS on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##umount /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Booting into the correct kernel ==&lt;br /&gt;
'''If you are using the standard srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
C) Standard 64bit kernel (rescue64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''If you are using the alternative srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
E) Alternative 64bit kernel (altker64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Run 'depmod' so that the new modules can be seen by the kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|You must run '''depmod'''. If you don't, then you will get failed to load the ZFS stack error!}}&lt;br /&gt;
&lt;br /&gt;
3. Use ZFS as usual. If you type '''zpool status''' and then type '''dmesg | tail''',&lt;br /&gt;
&lt;br /&gt;
you should see something that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
ZFS: Loaded module v0.6.1-1, ZFS pool version 5000, ZFS filesystem version 5&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see the above, then the modules loaded successfully!&lt;br /&gt;
&lt;br /&gt;
Enjoy System Rescue CD with ZFS :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Using the premade iso ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;If you don't want to do any of the above stuff but just want the ISO with the ZFS SRMs already included, simply [http://jonathanvasquez.com/files/sysresccd/3.7.0/iso/ Download the ISO].&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules</id>
		<title>Creating System Rescue CD ZFS Modules</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules"/>
				<updated>2013-06-10T00:26:42Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: added &amp;quot;Download the prebuilt iso link and info&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will show you how to create your own zfs srm or download the prebuilt zfs srm module from my website.&lt;br /&gt;
&lt;br /&gt;
== Adding the overlay ==&lt;br /&gt;
There are scripts that I've written that will make this process much easier for you. So we will first set up the overlay to a directory on your machine, let's say '''&amp;quot;/home/example/overlays/fearedbliss&amp;quot;''':&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that the overlay has been added, let's continue.&lt;br /&gt;
&lt;br /&gt;
== Compiling a compatible kernel ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is decide for which version of System Rescue CD you will be building for. Each System Rescue CD version has a different set of kernels. Specifically each version has a Stable kernel and an Alternate Kernel. The stable kernels get minor version increments every release (Sometimes major ones but usually doesn't happen too quickly), the Alternate kernels tend to move up much faster. For example System Rescue CD had the following stable/alternate kernels:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Version !! Stable !! Alternate&lt;br /&gt;
|-&lt;br /&gt;
| 3.7.0 || 3.4.47 || 3.9.4&lt;br /&gt;
|-&lt;br /&gt;
| 3.5.0 || 3.4.37 || 3.8.4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Download kernel and patches===&lt;br /&gt;
Once you decide which version you want to use, you can go to http://kernel.sysresccd.org/ and pick the version you want. After you do this, download all the stuff in that directory and put them in their own folder (a work directory). The files that are named std-sources are the patches for the regular stable kernel, the patches named alt-sources are the patches for the alternate kernel. Once you have the patches, go to kernel.org and also download the initial release of the kernel sources you want. For example, if you want to build an srm for 3.4.2 which uses the 3.4.35 kernel, just download the 3.4 (3.4.0) kernel. You just need to download the initial release because one of the patches you downloaded earlier is the patch to update the 3.4.0 to 3.4.35.&lt;br /&gt;
&lt;br /&gt;
Once you download the kernel you want, let's extract and patch it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##tar xf linux-3.4.tar.bz2&lt;br /&gt;
# ##i##mv linux-3.4 linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-01-stable-3.4.35.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-02-fc16.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-03-aufs.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Retrieve kernel configuration===&lt;br /&gt;
Once that is complete, you will need to get the kernel config specifically for the kernel and architecture you want. The easiest way I found to do this was to download the System Rescue CD you want, and then boot it inside a VM. Once you are inside the VM, go to the /root directory, and it will be a file named kernel-&amp;lt;version&amp;gt;.conf. Copy this file over SSH and put it in a safe location. Also copy it over into the linux kernel directory and rename it to .config.&lt;br /&gt;
&lt;br /&gt;
===Build the kernel===&lt;br /&gt;
Once you copy the kernel config over, do a make menuconfig to begin. You will only need to change two settings inside the config, add the proper kernel name, and remove the old initramfs source files directory. This directory doesn't exist locally. This is a remnant of upstream's build process.&lt;br /&gt;
&lt;br /&gt;
Follow the below tree structure, and make it equal to what is below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
General Setup -&amp;gt;&lt;br /&gt;
 (-std342-amd64) Local version - append to kernel release&lt;br /&gt;
 [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support  ()    Initramfs source file(s)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Local version above will end up making the kernel modules directory be 3.4.35-std342-amd64. The reason the kernel modules directory has to be equal to this is because our directory will be merged into the System Rescue CD later on, so the names need to be exactly the same so that the System Rescue CD system can find our kernel modules.&lt;br /&gt;
&lt;br /&gt;
If you want to build an srm (which you do), you also need to change the following inside the kernel config so that squashfs-tools can work later on:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
File Systems -&amp;gt;&lt;br /&gt;
Miscellaneous Filesystems -&amp;gt;&lt;br /&gt;
 &amp;lt;*&amp;gt;   SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  [*]     Squashfs XATTR support&lt;br /&gt;
  [*]     Include support for ZLIB compressed file systems&lt;br /&gt;
  [*]     Include support for LZO compressed file systems&lt;br /&gt;
  [*]     Include support for XZ compressed file systems&lt;br /&gt;
  [ ]     Use 4K device block size?&lt;br /&gt;
  [ ]     Additional option for memory-constrained systems&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now save and exit, and continue to build 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 modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have multiple cores, do a make -j&amp;lt;# of processors+1&amp;gt; to build faster. Example: '''make -j9''' for an 8 core machine.}}&lt;br /&gt;
&lt;br /&gt;
=== Using the overlay ===&lt;br /&gt;
Inside the overlay, there are ebuilds already prepared that will download the kernel, patch it, and perform any required substitutions. Afterwards you literally just go into your /usr/src/&amp;lt;kernel&amp;gt; directory, and run make. To see the available versions, run the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Versions available for standard kernel&lt;br /&gt;
# ##i##equery y -O std-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.4.37-r1 | o ~ o o o o o o o o o o o | o 3.4.37 | fearedbliss&lt;br /&gt;
&lt;br /&gt;
Versions available for alternate kernel&lt;br /&gt;
# ##i##equery y -O alt-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.8.4 | o ~ o o o o o o o o o o o | o 3.8.4 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I haven't written the ebuilds in a way where it's easy to tell (at first glance) what System Rescue CD version you need. However, you can check the ebuild and you will see the version of the CD inside there. You can also check the chart above.&lt;br /&gt;
&lt;br /&gt;
If you wanted to install the standard kernel sources, you just emerge it like any other application:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge std-sources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the kernel and the kernel module are installed, you need to make the SRM.&lt;br /&gt;
&lt;br /&gt;
== Creating the SRM ==&lt;br /&gt;
It's time to gather the required files and pack them together in order for it to become an SRM. An SRM is nothing more than a directory that has been compressed with squashfs. Thankfully I've written a script that will build it for you, and you can install it from the overlay.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You also need to have spl, zfs, and zfs-kmod installed on your system before you try to make the srm. Emerging '''&amp;quot;bliss-initramfs&amp;quot;''' should automatically pull those packages. If it doesn't, make sure you install them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs srm&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should now have the following directory layout inside the '''/opt/bliss-initramfs''' folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-initramfs # ls -l&lt;br /&gt;
total 117&lt;br /&gt;
-rw-r--r-- 1 root root 6718 May 23 18:05 CHANGES&lt;br /&gt;
-rw-r--r-- 1 root root  176 May 23 18:05 CREDITS&lt;br /&gt;
-rw-r--r-- 1 root root  431 May 23 18:05 HELP&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 23 18:05 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root 1852 May 23 18:05 README&lt;br /&gt;
-rw-r--r-- 1 root root 3194 May 23 18:05 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 2891 May 23 18:05 createInit&lt;br /&gt;
drwxr-xr-x 3 root root    4 May 23 18:11 files&lt;br /&gt;
drwxr-xr-x 3 root root    6 May 23 18:11 hooks&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 23 22:01 resources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run the '''createInit''' script and follow the instructions for the kernel you want to make the srm for (In this case it's '''3.4.37-std350-amd64'''):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-----------------------------------&lt;br /&gt;
| Bliss Initramfs Creator - v1.8.1&lt;br /&gt;
| Author: Jonathan Vasquez &amp;lt;jvasquez1011@gmail.com&amp;gt;&lt;br /&gt;
| Distributed under the Simplified BSD License&lt;br /&gt;
-----------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Which initramfs would you like to generate:&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS&lt;br /&gt;
&amp;gt;&amp;gt; 2. Encrypted ZFS (LUKS + ZFS)&lt;br /&gt;
&amp;gt;&amp;gt; 3. More Options&lt;br /&gt;
&amp;gt;&amp;gt; 4. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##3 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; More Options:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS - System Rescue Module&lt;br /&gt;
&amp;gt;&amp;gt; 2. Back&lt;br /&gt;
&amp;gt;&amp;gt; 3. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating a ZFS System Rescue Module!&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Do you want to use the current kernel: 3.8.13-ALL? [Y/n]: ##i##n ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Please enter the kernel name: ##i##3.4.37-std350-amd64 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Detected 64 bit platform&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking to see if modules directory exists for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating SRMs for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating directory structure for initramfs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking preliminary binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Using ZFS&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying documentation...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying udev rules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Compressing kernel modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Getting dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Configuring files...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating and Packing SRMs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Complete :)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you should have two new files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-rw-r--r-- 1 root root 2068480 May 24 01:05 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rw-r--r-- 1 root root  483328 May 24 01:05 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now all you need to do is put those two files in the root of your USB directory.&lt;br /&gt;
&lt;br /&gt;
If you are making srms for both the standard and alternate kernels, you will end up with two zfs-core files and two zfs-kmod files (1 set for each kernel). You don't need to put the zfs-core that it makes for one of the kernels. The zfs-core srm only has zfs program binaries, man pages, udev rules, and a few other things. The zfs-kmod is the srm that has the kernel modules (and only the kernel modules). So you can easily just put two zfs-kmods (one for each kernel version) and just re-use the same zfs-core for both of them.&lt;br /&gt;
&lt;br /&gt;
== Using the prebuilt srm ==&lt;br /&gt;
&lt;br /&gt;
=== Download the SRM ===&lt;br /&gt;
If you didn't build your own srm and want to use the prebuilt one, just emerge '''&amp;quot;zfs-srm&amp;quot;''' from the overlay:&lt;br /&gt;
&lt;br /&gt;
(Instructions on [[Creating_System_Rescue_CD_ZFS_Modules#Adding_the_overlay|adding the overlay]] can be found at the top of this page)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge zfs-srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check available versions just as you did above for the kernels:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Available versions of the zfs-srm&lt;br /&gt;
# ##i##equery y -O zfs-srm&lt;br /&gt;
&lt;br /&gt;
[I]3.5.0 | o ~ o o o o o o o o o o o | o 3.5.0 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(These versions match the version of the System Rescue CD).&lt;br /&gt;
&lt;br /&gt;
Installing the zfs-srm will automatically pull the '''&amp;quot;bliss-isomaker&amp;quot;''' package which is just a script that assists you with rebuilding the System Rescue CD ISO so that the ISO includes the ZFS srms. The script lets you make a bootable ISO or a bootable USB.&lt;br /&gt;
&lt;br /&gt;
Once it's installed, switch to the /opt/bliss-isomaker folder &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-isomaker&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see a directory layout that looks similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-isomaker # ls -l&lt;br /&gt;
total 100&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 24 01:41 3.5.0&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 24 01:31 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root  312 May 24 01:31 README&lt;br /&gt;
-rw-r--r-- 1 root root  576 May 24 01:31 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 3228 May 24 01:31 create&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 iso&lt;br /&gt;
drwxr-xr-x 2 root root    4 May 24 01:41 resources&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The layout is as follows:&lt;br /&gt;
* 3.5.0 - This folder contains the System Rescue CD 3.5.0 specific srms for both the standard and alternate kernel that were installed by emerge.&lt;br /&gt;
* create - A script to automatically recreate the system rescue cd iso or usb with the zfs stuff included&lt;br /&gt;
* iso - directory to place your system rescue cd iso in&lt;br /&gt;
* srm - directory that has the srms&lt;br /&gt;
* resources - the files in this folder contain function calls that the 'create' script uses. You don't need to worry about these.&lt;br /&gt;
&lt;br /&gt;
=== Installing the SRM ===&lt;br /&gt;
There are a few ways to do this, you can either use one of the scripts, or you can do it manually. Before anything, make sure to copy the SRMs from the &amp;lt;Version&amp;gt; folder to the srm folder if you are using a prebuilt one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp 3.5.0/* srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Generating a new iso ====&lt;br /&gt;
If you just want to remake a new iso so that you can burn onto a cd or use in a virtual machine, just copy your iso over to the iso directory, and run the 'create' script. The new iso will be located in the iso directory as well with a -zfs ending. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 1 (or iso) chooses to make an iso. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 1&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create iso 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a fresh usb ====&lt;br /&gt;
If you want to have zfs on a usb with system rescue cd, put the iso in your iso dir, and then run the usb script. It will ask you what usb you want to format (This will delete everything), and then install system rescue cd onto it. Once that is done it will copy the zfs stuff over.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 2 (or usb) chooses to make an usb. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 2&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create usb 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Manual installation onto a usb ====&lt;br /&gt;
Assuming that your installing to a flash drive and that the flash drive is mounted in /mnt&lt;br /&gt;
&lt;br /&gt;
1. Mount your usb drive&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mount /dev/sdX# /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Where X# is the letter and number of your device. Immediately after you plug your usb in, type `dmesg | tail` in the console and you should see it.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Copy the zfs .srms to /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp zfs-core-3.4.37-std350-amd64.srm zfs-kmod-3.4.37-std350-amd64.srm zfs-kmod-3.8.4-alt350-amd64.srm /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. List your /mnt/usbstick directory and you should see something similar to the following in your /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus 3.5.0 # ls -l /mnt/usbstick&lt;br /&gt;
total 305028&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 boot&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootdisk&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootprog&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 efi&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 ntpasswd&lt;br /&gt;
-rwxr-xr-x 1 root root      2349 May 23 20:51 readme.txt&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:52 syslinux&lt;br /&gt;
-rwxr-xr-x 1 root root 309252096 May 23 20:51 sysrcd.dat&lt;br /&gt;
-rwxr-xr-x 1 root root        45 May 23 20:51 sysrcd.md5&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 usb_inst&lt;br /&gt;
-rwxr-xr-x 1 root root     15889 May 23 20:51 usb_inst.sh&lt;br /&gt;
-rwxr-xr-x 1 root root       877 May 23 20:51 usbstick.htm&lt;br /&gt;
-rwxr-xr-x 1 root root         6 May 23 20:51 version&lt;br /&gt;
-rwxr-xr-x 1 root root   2068480 May 23 20:51 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.8.4-alt350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now un-mount your flash drive and boot it into the machine that you want to use ZFS on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##umount /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Booting into the correct kernel ==&lt;br /&gt;
'''If you are using the standard srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
C) Standard 64bit kernel (rescue64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''If you are using the alternative srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
E) Alternative 64bit kernel (altker64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Run 'depmod' so that the new modules can be seen by the kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|You must run '''depmod'''. If you don't, then you will get failed to load the ZFS stack error!}}&lt;br /&gt;
&lt;br /&gt;
3. Use ZFS as usual. If you type '''zpool status''' and then type '''dmesg | tail''',&lt;br /&gt;
&lt;br /&gt;
you should see something that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
ZFS: Loaded module v0.6.1-1, ZFS pool version 5000, ZFS filesystem version 5&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see the above, then the modules loaded successfully!&lt;br /&gt;
&lt;br /&gt;
Enjoy System Rescue CD with ZFS :)&lt;br /&gt;
&lt;br /&gt;
== Using the premade iso ==&lt;br /&gt;
If you don't want to do any of the above stuff but you just want the iso with the zfs srms already included, simply [http://jonathanvasquez.com/files/sysresccd/3.7.0/iso/ Download the ISO].&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules</id>
		<title>Creating System Rescue CD ZFS Modules</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules"/>
				<updated>2013-06-10T00:18:12Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Compiling a compatible kernel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will show you how to create your own zfs srm or download the prebuilt zfs srm module from my website.&lt;br /&gt;
&lt;br /&gt;
== Adding the overlay ==&lt;br /&gt;
There are scripts that I've written that will make this process much easier for you. So we will first set up the overlay to a directory on your machine, let's say '''&amp;quot;/home/example/overlays/fearedbliss&amp;quot;''':&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that the overlay has been added, let's continue.&lt;br /&gt;
&lt;br /&gt;
== Compiling a compatible kernel ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is decide for which version of System Rescue CD you will be building for. Each System Rescue CD version has a different set of kernels. Specifically each version has a Stable kernel and an Alternate Kernel. The stable kernels get minor version increments every release (Sometimes major ones but usually doesn't happen too quickly), the Alternate kernels tend to move up much faster. For example System Rescue CD had the following stable/alternate kernels:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Version !! Stable !! Alternate&lt;br /&gt;
|-&lt;br /&gt;
| 3.7.0 || 3.4.47 || 3.9.4&lt;br /&gt;
|-&lt;br /&gt;
| 3.5.0 || 3.4.37 || 3.8.4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Download kernel and patches===&lt;br /&gt;
Once you decide which version you want to use, you can go to http://kernel.sysresccd.org/ and pick the version you want. After you do this, download all the stuff in that directory and put them in their own folder (a work directory). The files that are named std-sources are the patches for the regular stable kernel, the patches named alt-sources are the patches for the alternate kernel. Once you have the patches, go to kernel.org and also download the initial release of the kernel sources you want. For example, if you want to build an srm for 3.4.2 which uses the 3.4.35 kernel, just download the 3.4 (3.4.0) kernel. You just need to download the initial release because one of the patches you downloaded earlier is the patch to update the 3.4.0 to 3.4.35.&lt;br /&gt;
&lt;br /&gt;
Once you download the kernel you want, let's extract and patch it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##tar xf linux-3.4.tar.bz2&lt;br /&gt;
# ##i##mv linux-3.4 linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-01-stable-3.4.35.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-02-fc16.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-03-aufs.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Retrieve kernel configuration===&lt;br /&gt;
Once that is complete, you will need to get the kernel config specifically for the kernel and architecture you want. The easiest way I found to do this was to download the System Rescue CD you want, and then boot it inside a VM. Once you are inside the VM, go to the /root directory, and it will be a file named kernel-&amp;lt;version&amp;gt;.conf. Copy this file over SSH and put it in a safe location. Also copy it over into the linux kernel directory and rename it to .config.&lt;br /&gt;
&lt;br /&gt;
===Build the kernel===&lt;br /&gt;
Once you copy the kernel config over, do a make menuconfig to begin. You will only need to change two settings inside the config, add the proper kernel name, and remove the old initramfs source files directory. This directory doesn't exist locally. This is a remnant of upstream's build process.&lt;br /&gt;
&lt;br /&gt;
Follow the below tree structure, and make it equal to what is below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
General Setup -&amp;gt;&lt;br /&gt;
 (-std342-amd64) Local version - append to kernel release&lt;br /&gt;
 [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support  ()    Initramfs source file(s)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Local version above will end up making the kernel modules directory be 3.4.35-std342-amd64. The reason the kernel modules directory has to be equal to this is because our directory will be merged into the System Rescue CD later on, so the names need to be exactly the same so that the System Rescue CD system can find our kernel modules.&lt;br /&gt;
&lt;br /&gt;
If you want to build an srm (which you do), you also need to change the following inside the kernel config so that squashfs-tools can work later on:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
File Systems -&amp;gt;&lt;br /&gt;
Miscellaneous Filesystems -&amp;gt;&lt;br /&gt;
 &amp;lt;*&amp;gt;   SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  [*]     Squashfs XATTR support&lt;br /&gt;
  [*]     Include support for ZLIB compressed file systems&lt;br /&gt;
  [*]     Include support for LZO compressed file systems&lt;br /&gt;
  [*]     Include support for XZ compressed file systems&lt;br /&gt;
  [ ]     Use 4K device block size?&lt;br /&gt;
  [ ]     Additional option for memory-constrained systems&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now save and exit, and continue to build 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 modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have multiple cores, do a make -j&amp;lt;# of processors+1&amp;gt; to build faster. Example: '''make -j9''' for an 8 core machine.}}&lt;br /&gt;
&lt;br /&gt;
=== Using the overlay ===&lt;br /&gt;
Inside the overlay, there are ebuilds already prepared that will download the kernel, patch it, and perform any required substitutions. Afterwards you literally just go into your /usr/src/&amp;lt;kernel&amp;gt; directory, and run make. To see the available versions, run the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Versions available for standard kernel&lt;br /&gt;
# ##i##equery y -O std-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.4.37-r1 | o ~ o o o o o o o o o o o | o 3.4.37 | fearedbliss&lt;br /&gt;
&lt;br /&gt;
Versions available for alternate kernel&lt;br /&gt;
# ##i##equery y -O alt-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.8.4 | o ~ o o o o o o o o o o o | o 3.8.4 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I haven't written the ebuilds in a way where it's easy to tell (at first glance) what System Rescue CD version you need. However, you can check the ebuild and you will see the version of the CD inside there. You can also check the chart above.&lt;br /&gt;
&lt;br /&gt;
If you wanted to install the standard kernel sources, you just emerge it like any other application:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge std-sources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the kernel and the kernel module are installed, you need to make the SRM.&lt;br /&gt;
&lt;br /&gt;
== Creating the SRM ==&lt;br /&gt;
It's time to gather the required files and pack them together in order for it to become an SRM. An SRM is nothing more than a directory that has been compressed with squashfs. Thankfully I've written a script that will build it for you, and you can install it from the overlay.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You also need to have spl, zfs, and zfs-kmod installed on your system before you try to make the srm. Emerging '''&amp;quot;bliss-initramfs&amp;quot;''' should automatically pull those packages. If it doesn't, make sure you install them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs srm&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should now have the following directory layout inside the '''/opt/bliss-initramfs''' folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-initramfs # ls -l&lt;br /&gt;
total 117&lt;br /&gt;
-rw-r--r-- 1 root root 6718 May 23 18:05 CHANGES&lt;br /&gt;
-rw-r--r-- 1 root root  176 May 23 18:05 CREDITS&lt;br /&gt;
-rw-r--r-- 1 root root  431 May 23 18:05 HELP&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 23 18:05 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root 1852 May 23 18:05 README&lt;br /&gt;
-rw-r--r-- 1 root root 3194 May 23 18:05 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 2891 May 23 18:05 createInit&lt;br /&gt;
drwxr-xr-x 3 root root    4 May 23 18:11 files&lt;br /&gt;
drwxr-xr-x 3 root root    6 May 23 18:11 hooks&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 23 22:01 resources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run the '''createInit''' script and follow the instructions for the kernel you want to make the srm for (In this case it's '''3.4.37-std350-amd64'''):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-----------------------------------&lt;br /&gt;
| Bliss Initramfs Creator - v1.8.1&lt;br /&gt;
| Author: Jonathan Vasquez &amp;lt;jvasquez1011@gmail.com&amp;gt;&lt;br /&gt;
| Distributed under the Simplified BSD License&lt;br /&gt;
-----------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Which initramfs would you like to generate:&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS&lt;br /&gt;
&amp;gt;&amp;gt; 2. Encrypted ZFS (LUKS + ZFS)&lt;br /&gt;
&amp;gt;&amp;gt; 3. More Options&lt;br /&gt;
&amp;gt;&amp;gt; 4. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##3 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; More Options:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS - System Rescue Module&lt;br /&gt;
&amp;gt;&amp;gt; 2. Back&lt;br /&gt;
&amp;gt;&amp;gt; 3. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating a ZFS System Rescue Module!&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Do you want to use the current kernel: 3.8.13-ALL? [Y/n]: ##i##n ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Please enter the kernel name: ##i##3.4.37-std350-amd64 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Detected 64 bit platform&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking to see if modules directory exists for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating SRMs for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating directory structure for initramfs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking preliminary binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Using ZFS&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying documentation...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying udev rules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Compressing kernel modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Getting dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Configuring files...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating and Packing SRMs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Complete :)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you should have two new files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-rw-r--r-- 1 root root 2068480 May 24 01:05 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rw-r--r-- 1 root root  483328 May 24 01:05 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now all you need to do is put those two files in the root of your USB directory.&lt;br /&gt;
&lt;br /&gt;
If you are making srms for both the standard and alternate kernels, you will end up with two zfs-core files and two zfs-kmod files (1 set for each kernel). You don't need to put the zfs-core that it makes for one of the kernels. The zfs-core srm only has zfs program binaries, man pages, udev rules, and a few other things. The zfs-kmod is the srm that has the kernel modules (and only the kernel modules). So you can easily just put two zfs-kmods (one for each kernel version) and just re-use the same zfs-core for both of them.&lt;br /&gt;
&lt;br /&gt;
== Using the prebuilt srm ==&lt;br /&gt;
&lt;br /&gt;
=== Download the SRM ===&lt;br /&gt;
If you didn't build your own srm and want to use the prebuilt one, just emerge '''&amp;quot;zfs-srm&amp;quot;''' from the overlay:&lt;br /&gt;
&lt;br /&gt;
(Instructions on [[Creating_System_Rescue_CD_ZFS_Modules#Adding_the_overlay|adding the overlay]] can be found at the top of this page)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge zfs-srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check available versions just as you did above for the kernels:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Available versions of the zfs-srm&lt;br /&gt;
# ##i##equery y -O zfs-srm&lt;br /&gt;
&lt;br /&gt;
[I]3.5.0 | o ~ o o o o o o o o o o o | o 3.5.0 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(These versions match the version of the System Rescue CD).&lt;br /&gt;
&lt;br /&gt;
Installing the zfs-srm will automatically pull the '''&amp;quot;bliss-isomaker&amp;quot;''' package which is just a script that assists you with rebuilding the System Rescue CD ISO so that the ISO includes the ZFS srms. The script lets you make a bootable ISO or a bootable USB.&lt;br /&gt;
&lt;br /&gt;
Once it's installed, switch to the /opt/bliss-isomaker folder &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-isomaker&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see a directory layout that looks similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-isomaker # ls -l&lt;br /&gt;
total 100&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 24 01:41 3.5.0&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 24 01:31 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root  312 May 24 01:31 README&lt;br /&gt;
-rw-r--r-- 1 root root  576 May 24 01:31 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 3228 May 24 01:31 create&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 iso&lt;br /&gt;
drwxr-xr-x 2 root root    4 May 24 01:41 resources&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The layout is as follows:&lt;br /&gt;
* 3.5.0 - This folder contains the System Rescue CD 3.5.0 specific srms for both the standard and alternate kernel that were installed by emerge.&lt;br /&gt;
* create - A script to automatically recreate the system rescue cd iso or usb with the zfs stuff included&lt;br /&gt;
* iso - directory to place your system rescue cd iso in&lt;br /&gt;
* srm - directory that has the srms&lt;br /&gt;
* resources - the files in this folder contain function calls that the 'create' script uses. You don't need to worry about these.&lt;br /&gt;
&lt;br /&gt;
=== Installing the SRM ===&lt;br /&gt;
There are a few ways to do this, you can either use one of the scripts, or you can do it manually. Before anything, make sure to copy the SRMs from the &amp;lt;Version&amp;gt; folder to the srm folder if you are using a prebuilt one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp 3.5.0/* srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Generating a new iso ====&lt;br /&gt;
If you just want to remake a new iso so that you can burn onto a cd or use in a virtual machine, just copy your iso over to the iso directory, and run the 'create' script. The new iso will be located in the iso directory as well with a -zfs ending. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 1 (or iso) chooses to make an iso. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 1&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create iso 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a fresh usb ====&lt;br /&gt;
If you want to have zfs on a usb with system rescue cd, put the iso in your iso dir, and then run the usb script. It will ask you what usb you want to format (This will delete everything), and then install system rescue cd onto it. Once that is done it will copy the zfs stuff over.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 2 (or usb) chooses to make an usb. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 2&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create usb 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Manual installation onto a usb ====&lt;br /&gt;
Assuming that your installing to a flash drive and that the flash drive is mounted in /mnt&lt;br /&gt;
&lt;br /&gt;
1. Mount your usb drive&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mount /dev/sdX# /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Where X# is the letter and number of your device. Immediately after you plug your usb in, type `dmesg | tail` in the console and you should see it.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Copy the zfs .srms to /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp zfs-core-3.4.37-std350-amd64.srm zfs-kmod-3.4.37-std350-amd64.srm zfs-kmod-3.8.4-alt350-amd64.srm /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. List your /mnt/usbstick directory and you should see something similar to the following in your /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus 3.5.0 # ls -l /mnt/usbstick&lt;br /&gt;
total 305028&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 boot&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootdisk&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootprog&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 efi&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 ntpasswd&lt;br /&gt;
-rwxr-xr-x 1 root root      2349 May 23 20:51 readme.txt&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:52 syslinux&lt;br /&gt;
-rwxr-xr-x 1 root root 309252096 May 23 20:51 sysrcd.dat&lt;br /&gt;
-rwxr-xr-x 1 root root        45 May 23 20:51 sysrcd.md5&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 usb_inst&lt;br /&gt;
-rwxr-xr-x 1 root root     15889 May 23 20:51 usb_inst.sh&lt;br /&gt;
-rwxr-xr-x 1 root root       877 May 23 20:51 usbstick.htm&lt;br /&gt;
-rwxr-xr-x 1 root root         6 May 23 20:51 version&lt;br /&gt;
-rwxr-xr-x 1 root root   2068480 May 23 20:51 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.8.4-alt350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now un-mount your flash drive and boot it into the machine that you want to use ZFS on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##umount /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Booting into the correct kernel ==&lt;br /&gt;
'''If you are using the standard srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
C) Standard 64bit kernel (rescue64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''If you are using the alternative srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
E) Alternative 64bit kernel (altker64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Run 'depmod' so that the new modules can be seen by the kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|You must run '''depmod'''. If you don't, then you will get failed to load the ZFS stack error!}}&lt;br /&gt;
&lt;br /&gt;
3. Use ZFS as usual. If you type '''zpool status''' and then type '''dmesg | tail''',&lt;br /&gt;
&lt;br /&gt;
you should see something that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
ZFS: Loaded module v0.6.1-1, ZFS pool version 5000, ZFS filesystem version 5&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see the above, then the modules loaded successfully!&lt;br /&gt;
&lt;br /&gt;
Enjoy System Rescue CD with ZFS :)&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules</id>
		<title>Creating System Rescue CD ZFS Modules</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules"/>
				<updated>2013-06-10T00:17:36Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Compiling a compatible kernel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will show you how to create your own zfs srm or download the prebuilt zfs srm module from my website.&lt;br /&gt;
&lt;br /&gt;
== Adding the overlay ==&lt;br /&gt;
There are scripts that I've written that will make this process much easier for you. So we will first set up the overlay to a directory on your machine, let's say '''&amp;quot;/home/example/overlays/fearedbliss&amp;quot;''':&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that the overlay has been added, let's continue.&lt;br /&gt;
&lt;br /&gt;
== Compiling a compatible kernel ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is decide for which version of System Rescue CD you will be building for. Each System Rescue CD version has a different set of kernels. Specifically each version has a Stable kernel and an Alternate Kernel. The stable kernels get minor version increments every release (Sometimes major ones but usually doesn't happen too quickly), the Alternate kernels tend to move up much faster. For example System Rescue CD had the following stable/alternate kernels:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Version !! Stable !! Alternate&lt;br /&gt;
|-&lt;br /&gt;
| 3.7.0 || 3.4.47 || 3.9.4&lt;br /&gt;
|-&lt;br /&gt;
| 3.5.0 || 3.4.37 || 3.8.4&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.2 || 3.4.35 || 3.7.10&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.1 || 3.4.32 || 3.7.9&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.0 || 3.4.30 || 3.7.8&lt;br /&gt;
|-&lt;br /&gt;
| 3.3.0 || 3.4.27 || 3.7.4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Download kernel and patches===&lt;br /&gt;
Once you decide which version you want to use, you can go to http://kernel.sysresccd.org/ and pick the version you want. After you do this, download all the stuff in that directory and put them in their own folder (a work directory). The files that are named std-sources are the patches for the regular stable kernel, the patches named alt-sources are the patches for the alternate kernel. Once you have the patches, go to kernel.org and also download the initial release of the kernel sources you want. For example, if you want to build an srm for 3.4.2 which uses the 3.4.35 kernel, just download the 3.4 (3.4.0) kernel. You just need to download the initial release because one of the patches you downloaded earlier is the patch to update the 3.4.0 to 3.4.35.&lt;br /&gt;
&lt;br /&gt;
Once you download the kernel you want, let's extract and patch it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##tar xf linux-3.4.tar.bz2&lt;br /&gt;
# ##i##mv linux-3.4 linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-01-stable-3.4.35.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-02-fc16.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-03-aufs.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Retrieve kernel configuration===&lt;br /&gt;
Once that is complete, you will need to get the kernel config specifically for the kernel and architecture you want. The easiest way I found to do this was to download the System Rescue CD you want, and then boot it inside a VM. Once you are inside the VM, go to the /root directory, and it will be a file named kernel-&amp;lt;version&amp;gt;.conf. Copy this file over SSH and put it in a safe location. Also copy it over into the linux kernel directory and rename it to .config.&lt;br /&gt;
&lt;br /&gt;
===Build the kernel===&lt;br /&gt;
Once you copy the kernel config over, do a make menuconfig to begin. You will only need to change two settings inside the config, add the proper kernel name, and remove the old initramfs source files directory. This directory doesn't exist locally. This is a remnant of upstream's build process.&lt;br /&gt;
&lt;br /&gt;
Follow the below tree structure, and make it equal to what is below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
General Setup -&amp;gt;&lt;br /&gt;
 (-std342-amd64) Local version - append to kernel release&lt;br /&gt;
 [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support  ()    Initramfs source file(s)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Local version above will end up making the kernel modules directory be 3.4.35-std342-amd64. The reason the kernel modules directory has to be equal to this is because our directory will be merged into the System Rescue CD later on, so the names need to be exactly the same so that the System Rescue CD system can find our kernel modules.&lt;br /&gt;
&lt;br /&gt;
If you want to build an srm (which you do), you also need to change the following inside the kernel config so that squashfs-tools can work later on:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
File Systems -&amp;gt;&lt;br /&gt;
Miscellaneous Filesystems -&amp;gt;&lt;br /&gt;
 &amp;lt;*&amp;gt;   SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  [*]     Squashfs XATTR support&lt;br /&gt;
  [*]     Include support for ZLIB compressed file systems&lt;br /&gt;
  [*]     Include support for LZO compressed file systems&lt;br /&gt;
  [*]     Include support for XZ compressed file systems&lt;br /&gt;
  [ ]     Use 4K device block size?&lt;br /&gt;
  [ ]     Additional option for memory-constrained systems&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now save and exit, and continue to build 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 modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have multiple cores, do a make -j&amp;lt;# of processors+1&amp;gt; to build faster. Example: '''make -j9''' for an 8 core machine.}}&lt;br /&gt;
&lt;br /&gt;
=== Using the overlay ===&lt;br /&gt;
Inside the overlay, there are ebuilds already prepared that will download the kernel, patch it, and perform any required substitutions. Afterwards you literally just go into your /usr/src/&amp;lt;kernel&amp;gt; directory, and run make. To see the available versions, run the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Versions available for standard kernel&lt;br /&gt;
# ##i##equery y -O std-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.4.37-r1 | o ~ o o o o o o o o o o o | o 3.4.37 | fearedbliss&lt;br /&gt;
&lt;br /&gt;
Versions available for alternate kernel&lt;br /&gt;
# ##i##equery y -O alt-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.8.4 | o ~ o o o o o o o o o o o | o 3.8.4 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I haven't written the ebuilds in a way where it's easy to tell (at first glance) what System Rescue CD version you need. However, you can check the ebuild and you will see the version of the CD inside there. You can also check the chart above.&lt;br /&gt;
&lt;br /&gt;
If you wanted to install the standard kernel sources, you just emerge it like any other application:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge std-sources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the kernel and the kernel module are installed, you need to make the SRM.&lt;br /&gt;
&lt;br /&gt;
== Creating the SRM ==&lt;br /&gt;
It's time to gather the required files and pack them together in order for it to become an SRM. An SRM is nothing more than a directory that has been compressed with squashfs. Thankfully I've written a script that will build it for you, and you can install it from the overlay.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You also need to have spl, zfs, and zfs-kmod installed on your system before you try to make the srm. Emerging '''&amp;quot;bliss-initramfs&amp;quot;''' should automatically pull those packages. If it doesn't, make sure you install them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs srm&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should now have the following directory layout inside the '''/opt/bliss-initramfs''' folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-initramfs # ls -l&lt;br /&gt;
total 117&lt;br /&gt;
-rw-r--r-- 1 root root 6718 May 23 18:05 CHANGES&lt;br /&gt;
-rw-r--r-- 1 root root  176 May 23 18:05 CREDITS&lt;br /&gt;
-rw-r--r-- 1 root root  431 May 23 18:05 HELP&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 23 18:05 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root 1852 May 23 18:05 README&lt;br /&gt;
-rw-r--r-- 1 root root 3194 May 23 18:05 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 2891 May 23 18:05 createInit&lt;br /&gt;
drwxr-xr-x 3 root root    4 May 23 18:11 files&lt;br /&gt;
drwxr-xr-x 3 root root    6 May 23 18:11 hooks&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 23 22:01 resources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run the '''createInit''' script and follow the instructions for the kernel you want to make the srm for (In this case it's '''3.4.37-std350-amd64'''):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-----------------------------------&lt;br /&gt;
| Bliss Initramfs Creator - v1.8.1&lt;br /&gt;
| Author: Jonathan Vasquez &amp;lt;jvasquez1011@gmail.com&amp;gt;&lt;br /&gt;
| Distributed under the Simplified BSD License&lt;br /&gt;
-----------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Which initramfs would you like to generate:&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS&lt;br /&gt;
&amp;gt;&amp;gt; 2. Encrypted ZFS (LUKS + ZFS)&lt;br /&gt;
&amp;gt;&amp;gt; 3. More Options&lt;br /&gt;
&amp;gt;&amp;gt; 4. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##3 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; More Options:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS - System Rescue Module&lt;br /&gt;
&amp;gt;&amp;gt; 2. Back&lt;br /&gt;
&amp;gt;&amp;gt; 3. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating a ZFS System Rescue Module!&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Do you want to use the current kernel: 3.8.13-ALL? [Y/n]: ##i##n ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Please enter the kernel name: ##i##3.4.37-std350-amd64 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Detected 64 bit platform&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking to see if modules directory exists for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating SRMs for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating directory structure for initramfs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking preliminary binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Using ZFS&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying documentation...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying udev rules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Compressing kernel modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Getting dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Configuring files...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating and Packing SRMs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Complete :)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you should have two new files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-rw-r--r-- 1 root root 2068480 May 24 01:05 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rw-r--r-- 1 root root  483328 May 24 01:05 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now all you need to do is put those two files in the root of your USB directory.&lt;br /&gt;
&lt;br /&gt;
If you are making srms for both the standard and alternate kernels, you will end up with two zfs-core files and two zfs-kmod files (1 set for each kernel). You don't need to put the zfs-core that it makes for one of the kernels. The zfs-core srm only has zfs program binaries, man pages, udev rules, and a few other things. The zfs-kmod is the srm that has the kernel modules (and only the kernel modules). So you can easily just put two zfs-kmods (one for each kernel version) and just re-use the same zfs-core for both of them.&lt;br /&gt;
&lt;br /&gt;
== Using the prebuilt srm ==&lt;br /&gt;
&lt;br /&gt;
=== Download the SRM ===&lt;br /&gt;
If you didn't build your own srm and want to use the prebuilt one, just emerge '''&amp;quot;zfs-srm&amp;quot;''' from the overlay:&lt;br /&gt;
&lt;br /&gt;
(Instructions on [[Creating_System_Rescue_CD_ZFS_Modules#Adding_the_overlay|adding the overlay]] can be found at the top of this page)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge zfs-srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check available versions just as you did above for the kernels:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Available versions of the zfs-srm&lt;br /&gt;
# ##i##equery y -O zfs-srm&lt;br /&gt;
&lt;br /&gt;
[I]3.5.0 | o ~ o o o o o o o o o o o | o 3.5.0 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(These versions match the version of the System Rescue CD).&lt;br /&gt;
&lt;br /&gt;
Installing the zfs-srm will automatically pull the '''&amp;quot;bliss-isomaker&amp;quot;''' package which is just a script that assists you with rebuilding the System Rescue CD ISO so that the ISO includes the ZFS srms. The script lets you make a bootable ISO or a bootable USB.&lt;br /&gt;
&lt;br /&gt;
Once it's installed, switch to the /opt/bliss-isomaker folder &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-isomaker&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see a directory layout that looks similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-isomaker # ls -l&lt;br /&gt;
total 100&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 24 01:41 3.5.0&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 24 01:31 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root  312 May 24 01:31 README&lt;br /&gt;
-rw-r--r-- 1 root root  576 May 24 01:31 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 3228 May 24 01:31 create&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 iso&lt;br /&gt;
drwxr-xr-x 2 root root    4 May 24 01:41 resources&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The layout is as follows:&lt;br /&gt;
* 3.5.0 - This folder contains the System Rescue CD 3.5.0 specific srms for both the standard and alternate kernel that were installed by emerge.&lt;br /&gt;
* create - A script to automatically recreate the system rescue cd iso or usb with the zfs stuff included&lt;br /&gt;
* iso - directory to place your system rescue cd iso in&lt;br /&gt;
* srm - directory that has the srms&lt;br /&gt;
* resources - the files in this folder contain function calls that the 'create' script uses. You don't need to worry about these.&lt;br /&gt;
&lt;br /&gt;
=== Installing the SRM ===&lt;br /&gt;
There are a few ways to do this, you can either use one of the scripts, or you can do it manually. Before anything, make sure to copy the SRMs from the &amp;lt;Version&amp;gt; folder to the srm folder if you are using a prebuilt one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp 3.5.0/* srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Generating a new iso ====&lt;br /&gt;
If you just want to remake a new iso so that you can burn onto a cd or use in a virtual machine, just copy your iso over to the iso directory, and run the 'create' script. The new iso will be located in the iso directory as well with a -zfs ending. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 1 (or iso) chooses to make an iso. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 1&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create iso 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a fresh usb ====&lt;br /&gt;
If you want to have zfs on a usb with system rescue cd, put the iso in your iso dir, and then run the usb script. It will ask you what usb you want to format (This will delete everything), and then install system rescue cd onto it. Once that is done it will copy the zfs stuff over.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 2 (or usb) chooses to make an usb. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 2&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create usb 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Manual installation onto a usb ====&lt;br /&gt;
Assuming that your installing to a flash drive and that the flash drive is mounted in /mnt&lt;br /&gt;
&lt;br /&gt;
1. Mount your usb drive&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mount /dev/sdX# /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Where X# is the letter and number of your device. Immediately after you plug your usb in, type `dmesg | tail` in the console and you should see it.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Copy the zfs .srms to /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp zfs-core-3.4.37-std350-amd64.srm zfs-kmod-3.4.37-std350-amd64.srm zfs-kmod-3.8.4-alt350-amd64.srm /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. List your /mnt/usbstick directory and you should see something similar to the following in your /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus 3.5.0 # ls -l /mnt/usbstick&lt;br /&gt;
total 305028&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 boot&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootdisk&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootprog&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 efi&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 ntpasswd&lt;br /&gt;
-rwxr-xr-x 1 root root      2349 May 23 20:51 readme.txt&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:52 syslinux&lt;br /&gt;
-rwxr-xr-x 1 root root 309252096 May 23 20:51 sysrcd.dat&lt;br /&gt;
-rwxr-xr-x 1 root root        45 May 23 20:51 sysrcd.md5&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 usb_inst&lt;br /&gt;
-rwxr-xr-x 1 root root     15889 May 23 20:51 usb_inst.sh&lt;br /&gt;
-rwxr-xr-x 1 root root       877 May 23 20:51 usbstick.htm&lt;br /&gt;
-rwxr-xr-x 1 root root         6 May 23 20:51 version&lt;br /&gt;
-rwxr-xr-x 1 root root   2068480 May 23 20:51 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.8.4-alt350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now un-mount your flash drive and boot it into the machine that you want to use ZFS on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##umount /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Booting into the correct kernel ==&lt;br /&gt;
'''If you are using the standard srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
C) Standard 64bit kernel (rescue64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''If you are using the alternative srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
E) Alternative 64bit kernel (altker64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Run 'depmod' so that the new modules can be seen by the kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|You must run '''depmod'''. If you don't, then you will get failed to load the ZFS stack error!}}&lt;br /&gt;
&lt;br /&gt;
3. Use ZFS as usual. If you type '''zpool status''' and then type '''dmesg | tail''',&lt;br /&gt;
&lt;br /&gt;
you should see something that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
ZFS: Loaded module v0.6.1-1, ZFS pool version 5000, ZFS filesystem version 5&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see the above, then the modules loaded successfully!&lt;br /&gt;
&lt;br /&gt;
Enjoy System Rescue CD with ZFS :)&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules</id>
		<title>Creating System Rescue CD ZFS Modules</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules"/>
				<updated>2013-06-10T00:17:05Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Extra */ - removed this section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will show you how to create your own zfs srm or download the prebuilt zfs srm module from my website.&lt;br /&gt;
&lt;br /&gt;
== Adding the overlay ==&lt;br /&gt;
There are scripts that I've written that will make this process much easier for you. So we will first set up the overlay to a directory on your machine, let's say '''&amp;quot;/home/example/overlays/fearedbliss&amp;quot;''':&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that the overlay has been added, let's continue.&lt;br /&gt;
&lt;br /&gt;
== Compiling a compatible kernel ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is decide for which version of System Rescue CD you will be building for. Each System Rescue CD version has a different set of kernels. Specifically each version has a Stable kernel and an Alternate Kernel. The stable kernels get minor version increments every release (Sometimes major ones but usually doesn't happen too quickly), the Alternate kernels tend to move up much faster. For example System Rescue CD had the following stable/alternate kernels:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Version !! Stable !! Alternate&lt;br /&gt;
|-&lt;br /&gt;
| 3.5.0 || 3.4.37 || 3.8.4&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.2 || 3.4.35 || 3.7.10&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.1 || 3.4.32 || 3.7.9&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.0 || 3.4.30 || 3.7.8&lt;br /&gt;
|-&lt;br /&gt;
| 3.3.0 || 3.4.27 || 3.7.4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Download kernel and patches===&lt;br /&gt;
Once you decide which version you want to use, you can go to http://kernel.sysresccd.org/ and pick the version you want. After you do this, download all the stuff in that directory and put them in their own folder (a work directory). The files that are named std-sources are the patches for the regular stable kernel, the patches named alt-sources are the patches for the alternate kernel. Once you have the patches, go to kernel.org and also download the initial release of the kernel sources you want. For example, if you want to build an srm for 3.4.2 which uses the 3.4.35 kernel, just download the 3.4 (3.4.0) kernel. You just need to download the initial release because one of the patches you downloaded earlier is the patch to update the 3.4.0 to 3.4.35.&lt;br /&gt;
&lt;br /&gt;
Once you download the kernel you want, let's extract and patch it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##tar xf linux-3.4.tar.bz2&lt;br /&gt;
# ##i##mv linux-3.4 linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-01-stable-3.4.35.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-02-fc16.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-03-aufs.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Retrieve kernel configuration===&lt;br /&gt;
Once that is complete, you will need to get the kernel config specifically for the kernel and architecture you want. The easiest way I found to do this was to download the System Rescue CD you want, and then boot it inside a VM. Once you are inside the VM, go to the /root directory, and it will be a file named kernel-&amp;lt;version&amp;gt;.conf. Copy this file over SSH and put it in a safe location. Also copy it over into the linux kernel directory and rename it to .config.&lt;br /&gt;
&lt;br /&gt;
===Build the kernel===&lt;br /&gt;
Once you copy the kernel config over, do a make menuconfig to begin. You will only need to change two settings inside the config, add the proper kernel name, and remove the old initramfs source files directory. This directory doesn't exist locally. This is a remnant of upstream's build process.&lt;br /&gt;
&lt;br /&gt;
Follow the below tree structure, and make it equal to what is below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
General Setup -&amp;gt;&lt;br /&gt;
 (-std342-amd64) Local version - append to kernel release&lt;br /&gt;
 [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support  ()    Initramfs source file(s)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Local version above will end up making the kernel modules directory be 3.4.35-std342-amd64. The reason the kernel modules directory has to be equal to this is because our directory will be merged into the System Rescue CD later on, so the names need to be exactly the same so that the System Rescue CD system can find our kernel modules.&lt;br /&gt;
&lt;br /&gt;
If you want to build an srm (which you do), you also need to change the following inside the kernel config so that squashfs-tools can work later on:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
File Systems -&amp;gt;&lt;br /&gt;
Miscellaneous Filesystems -&amp;gt;&lt;br /&gt;
 &amp;lt;*&amp;gt;   SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  [*]     Squashfs XATTR support&lt;br /&gt;
  [*]     Include support for ZLIB compressed file systems&lt;br /&gt;
  [*]     Include support for LZO compressed file systems&lt;br /&gt;
  [*]     Include support for XZ compressed file systems&lt;br /&gt;
  [ ]     Use 4K device block size?&lt;br /&gt;
  [ ]     Additional option for memory-constrained systems&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now save and exit, and continue to build 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 modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have multiple cores, do a make -j&amp;lt;# of processors+1&amp;gt; to build faster. Example: '''make -j9''' for an 8 core machine.}}&lt;br /&gt;
&lt;br /&gt;
=== Using the overlay ===&lt;br /&gt;
Inside the overlay, there are ebuilds already prepared that will download the kernel, patch it, and perform any required substitutions. Afterwards you literally just go into your /usr/src/&amp;lt;kernel&amp;gt; directory, and run make. To see the available versions, run the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Versions available for standard kernel&lt;br /&gt;
# ##i##equery y -O std-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.4.37-r1 | o ~ o o o o o o o o o o o | o 3.4.37 | fearedbliss&lt;br /&gt;
&lt;br /&gt;
Versions available for alternate kernel&lt;br /&gt;
# ##i##equery y -O alt-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.8.4 | o ~ o o o o o o o o o o o | o 3.8.4 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I haven't written the ebuilds in a way where it's easy to tell (at first glance) what System Rescue CD version you need. However, you can check the ebuild and you will see the version of the CD inside there. You can also check the chart above.&lt;br /&gt;
&lt;br /&gt;
If you wanted to install the standard kernel sources, you just emerge it like any other application:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge std-sources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the kernel and the kernel module are installed, you need to make the SRM.&lt;br /&gt;
&lt;br /&gt;
== Creating the SRM ==&lt;br /&gt;
It's time to gather the required files and pack them together in order for it to become an SRM. An SRM is nothing more than a directory that has been compressed with squashfs. Thankfully I've written a script that will build it for you, and you can install it from the overlay.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You also need to have spl, zfs, and zfs-kmod installed on your system before you try to make the srm. Emerging '''&amp;quot;bliss-initramfs&amp;quot;''' should automatically pull those packages. If it doesn't, make sure you install them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs srm&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should now have the following directory layout inside the '''/opt/bliss-initramfs''' folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-initramfs # ls -l&lt;br /&gt;
total 117&lt;br /&gt;
-rw-r--r-- 1 root root 6718 May 23 18:05 CHANGES&lt;br /&gt;
-rw-r--r-- 1 root root  176 May 23 18:05 CREDITS&lt;br /&gt;
-rw-r--r-- 1 root root  431 May 23 18:05 HELP&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 23 18:05 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root 1852 May 23 18:05 README&lt;br /&gt;
-rw-r--r-- 1 root root 3194 May 23 18:05 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 2891 May 23 18:05 createInit&lt;br /&gt;
drwxr-xr-x 3 root root    4 May 23 18:11 files&lt;br /&gt;
drwxr-xr-x 3 root root    6 May 23 18:11 hooks&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 23 22:01 resources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run the '''createInit''' script and follow the instructions for the kernel you want to make the srm for (In this case it's '''3.4.37-std350-amd64'''):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-----------------------------------&lt;br /&gt;
| Bliss Initramfs Creator - v1.8.1&lt;br /&gt;
| Author: Jonathan Vasquez &amp;lt;jvasquez1011@gmail.com&amp;gt;&lt;br /&gt;
| Distributed under the Simplified BSD License&lt;br /&gt;
-----------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Which initramfs would you like to generate:&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS&lt;br /&gt;
&amp;gt;&amp;gt; 2. Encrypted ZFS (LUKS + ZFS)&lt;br /&gt;
&amp;gt;&amp;gt; 3. More Options&lt;br /&gt;
&amp;gt;&amp;gt; 4. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##3 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; More Options:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS - System Rescue Module&lt;br /&gt;
&amp;gt;&amp;gt; 2. Back&lt;br /&gt;
&amp;gt;&amp;gt; 3. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating a ZFS System Rescue Module!&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Do you want to use the current kernel: 3.8.13-ALL? [Y/n]: ##i##n ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Please enter the kernel name: ##i##3.4.37-std350-amd64 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Detected 64 bit platform&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking to see if modules directory exists for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating SRMs for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating directory structure for initramfs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking preliminary binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Using ZFS&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying documentation...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying udev rules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Compressing kernel modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Getting dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Configuring files...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating and Packing SRMs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Complete :)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you should have two new files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-rw-r--r-- 1 root root 2068480 May 24 01:05 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rw-r--r-- 1 root root  483328 May 24 01:05 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now all you need to do is put those two files in the root of your USB directory.&lt;br /&gt;
&lt;br /&gt;
If you are making srms for both the standard and alternate kernels, you will end up with two zfs-core files and two zfs-kmod files (1 set for each kernel). You don't need to put the zfs-core that it makes for one of the kernels. The zfs-core srm only has zfs program binaries, man pages, udev rules, and a few other things. The zfs-kmod is the srm that has the kernel modules (and only the kernel modules). So you can easily just put two zfs-kmods (one for each kernel version) and just re-use the same zfs-core for both of them.&lt;br /&gt;
&lt;br /&gt;
== Using the prebuilt srm ==&lt;br /&gt;
&lt;br /&gt;
=== Download the SRM ===&lt;br /&gt;
If you didn't build your own srm and want to use the prebuilt one, just emerge '''&amp;quot;zfs-srm&amp;quot;''' from the overlay:&lt;br /&gt;
&lt;br /&gt;
(Instructions on [[Creating_System_Rescue_CD_ZFS_Modules#Adding_the_overlay|adding the overlay]] can be found at the top of this page)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge zfs-srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check available versions just as you did above for the kernels:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Available versions of the zfs-srm&lt;br /&gt;
# ##i##equery y -O zfs-srm&lt;br /&gt;
&lt;br /&gt;
[I]3.5.0 | o ~ o o o o o o o o o o o | o 3.5.0 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(These versions match the version of the System Rescue CD).&lt;br /&gt;
&lt;br /&gt;
Installing the zfs-srm will automatically pull the '''&amp;quot;bliss-isomaker&amp;quot;''' package which is just a script that assists you with rebuilding the System Rescue CD ISO so that the ISO includes the ZFS srms. The script lets you make a bootable ISO or a bootable USB.&lt;br /&gt;
&lt;br /&gt;
Once it's installed, switch to the /opt/bliss-isomaker folder &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-isomaker&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see a directory layout that looks similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-isomaker # ls -l&lt;br /&gt;
total 100&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 24 01:41 3.5.0&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 24 01:31 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root  312 May 24 01:31 README&lt;br /&gt;
-rw-r--r-- 1 root root  576 May 24 01:31 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 3228 May 24 01:31 create&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 iso&lt;br /&gt;
drwxr-xr-x 2 root root    4 May 24 01:41 resources&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The layout is as follows:&lt;br /&gt;
* 3.5.0 - This folder contains the System Rescue CD 3.5.0 specific srms for both the standard and alternate kernel that were installed by emerge.&lt;br /&gt;
* create - A script to automatically recreate the system rescue cd iso or usb with the zfs stuff included&lt;br /&gt;
* iso - directory to place your system rescue cd iso in&lt;br /&gt;
* srm - directory that has the srms&lt;br /&gt;
* resources - the files in this folder contain function calls that the 'create' script uses. You don't need to worry about these.&lt;br /&gt;
&lt;br /&gt;
=== Installing the SRM ===&lt;br /&gt;
There are a few ways to do this, you can either use one of the scripts, or you can do it manually. Before anything, make sure to copy the SRMs from the &amp;lt;Version&amp;gt; folder to the srm folder if you are using a prebuilt one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp 3.5.0/* srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Generating a new iso ====&lt;br /&gt;
If you just want to remake a new iso so that you can burn onto a cd or use in a virtual machine, just copy your iso over to the iso directory, and run the 'create' script. The new iso will be located in the iso directory as well with a -zfs ending. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 1 (or iso) chooses to make an iso. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 1&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create iso 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a fresh usb ====&lt;br /&gt;
If you want to have zfs on a usb with system rescue cd, put the iso in your iso dir, and then run the usb script. It will ask you what usb you want to format (This will delete everything), and then install system rescue cd onto it. Once that is done it will copy the zfs stuff over.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 2 (or usb) chooses to make an usb. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 2&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create usb 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Manual installation onto a usb ====&lt;br /&gt;
Assuming that your installing to a flash drive and that the flash drive is mounted in /mnt&lt;br /&gt;
&lt;br /&gt;
1. Mount your usb drive&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mount /dev/sdX# /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Where X# is the letter and number of your device. Immediately after you plug your usb in, type `dmesg | tail` in the console and you should see it.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Copy the zfs .srms to /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp zfs-core-3.4.37-std350-amd64.srm zfs-kmod-3.4.37-std350-amd64.srm zfs-kmod-3.8.4-alt350-amd64.srm /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. List your /mnt/usbstick directory and you should see something similar to the following in your /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus 3.5.0 # ls -l /mnt/usbstick&lt;br /&gt;
total 305028&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 boot&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootdisk&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootprog&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 efi&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 ntpasswd&lt;br /&gt;
-rwxr-xr-x 1 root root      2349 May 23 20:51 readme.txt&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:52 syslinux&lt;br /&gt;
-rwxr-xr-x 1 root root 309252096 May 23 20:51 sysrcd.dat&lt;br /&gt;
-rwxr-xr-x 1 root root        45 May 23 20:51 sysrcd.md5&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 usb_inst&lt;br /&gt;
-rwxr-xr-x 1 root root     15889 May 23 20:51 usb_inst.sh&lt;br /&gt;
-rwxr-xr-x 1 root root       877 May 23 20:51 usbstick.htm&lt;br /&gt;
-rwxr-xr-x 1 root root         6 May 23 20:51 version&lt;br /&gt;
-rwxr-xr-x 1 root root   2068480 May 23 20:51 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.8.4-alt350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now un-mount your flash drive and boot it into the machine that you want to use ZFS on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##umount /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Booting into the correct kernel ==&lt;br /&gt;
'''If you are using the standard srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
C) Standard 64bit kernel (rescue64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''If you are using the alternative srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
E) Alternative 64bit kernel (altker64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Run 'depmod' so that the new modules can be seen by the kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|You must run '''depmod'''. If you don't, then you will get failed to load the ZFS stack error!}}&lt;br /&gt;
&lt;br /&gt;
3. Use ZFS as usual. If you type '''zpool status''' and then type '''dmesg | tail''',&lt;br /&gt;
&lt;br /&gt;
you should see something that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
ZFS: Loaded module v0.6.1-1, ZFS pool version 5000, ZFS filesystem version 5&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see the above, then the modules loaded successfully!&lt;br /&gt;
&lt;br /&gt;
Enjoy System Rescue CD with ZFS :)&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules</id>
		<title>Creating System Rescue CD ZFS Modules</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules"/>
				<updated>2013-06-10T00:16:34Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Booting into the correct kernel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will show you how to create your own zfs srm or download the prebuilt zfs srm module from my website.&lt;br /&gt;
&lt;br /&gt;
== Adding the overlay ==&lt;br /&gt;
There are scripts that I've written that will make this process much easier for you. So we will first set up the overlay to a directory on your machine, let's say '''&amp;quot;/home/example/overlays/fearedbliss&amp;quot;''':&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that the overlay has been added, let's continue.&lt;br /&gt;
&lt;br /&gt;
== Compiling a compatible kernel ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is decide for which version of System Rescue CD you will be building for. Each System Rescue CD version has a different set of kernels. Specifically each version has a Stable kernel and an Alternate Kernel. The stable kernels get minor version increments every release (Sometimes major ones but usually doesn't happen too quickly), the Alternate kernels tend to move up much faster. For example System Rescue CD had the following stable/alternate kernels:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Version !! Stable !! Alternate&lt;br /&gt;
|-&lt;br /&gt;
| 3.5.0 || 3.4.37 || 3.8.4&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.2 || 3.4.35 || 3.7.10&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.1 || 3.4.32 || 3.7.9&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.0 || 3.4.30 || 3.7.8&lt;br /&gt;
|-&lt;br /&gt;
| 3.3.0 || 3.4.27 || 3.7.4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Download kernel and patches===&lt;br /&gt;
Once you decide which version you want to use, you can go to http://kernel.sysresccd.org/ and pick the version you want. After you do this, download all the stuff in that directory and put them in their own folder (a work directory). The files that are named std-sources are the patches for the regular stable kernel, the patches named alt-sources are the patches for the alternate kernel. Once you have the patches, go to kernel.org and also download the initial release of the kernel sources you want. For example, if you want to build an srm for 3.4.2 which uses the 3.4.35 kernel, just download the 3.4 (3.4.0) kernel. You just need to download the initial release because one of the patches you downloaded earlier is the patch to update the 3.4.0 to 3.4.35.&lt;br /&gt;
&lt;br /&gt;
Once you download the kernel you want, let's extract and patch it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##tar xf linux-3.4.tar.bz2&lt;br /&gt;
# ##i##mv linux-3.4 linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-01-stable-3.4.35.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-02-fc16.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-03-aufs.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Retrieve kernel configuration===&lt;br /&gt;
Once that is complete, you will need to get the kernel config specifically for the kernel and architecture you want. The easiest way I found to do this was to download the System Rescue CD you want, and then boot it inside a VM. Once you are inside the VM, go to the /root directory, and it will be a file named kernel-&amp;lt;version&amp;gt;.conf. Copy this file over SSH and put it in a safe location. Also copy it over into the linux kernel directory and rename it to .config.&lt;br /&gt;
&lt;br /&gt;
===Build the kernel===&lt;br /&gt;
Once you copy the kernel config over, do a make menuconfig to begin. You will only need to change two settings inside the config, add the proper kernel name, and remove the old initramfs source files directory. This directory doesn't exist locally. This is a remnant of upstream's build process.&lt;br /&gt;
&lt;br /&gt;
Follow the below tree structure, and make it equal to what is below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
General Setup -&amp;gt;&lt;br /&gt;
 (-std342-amd64) Local version - append to kernel release&lt;br /&gt;
 [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support  ()    Initramfs source file(s)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Local version above will end up making the kernel modules directory be 3.4.35-std342-amd64. The reason the kernel modules directory has to be equal to this is because our directory will be merged into the System Rescue CD later on, so the names need to be exactly the same so that the System Rescue CD system can find our kernel modules.&lt;br /&gt;
&lt;br /&gt;
If you want to build an srm (which you do), you also need to change the following inside the kernel config so that squashfs-tools can work later on:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
File Systems -&amp;gt;&lt;br /&gt;
Miscellaneous Filesystems -&amp;gt;&lt;br /&gt;
 &amp;lt;*&amp;gt;   SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  [*]     Squashfs XATTR support&lt;br /&gt;
  [*]     Include support for ZLIB compressed file systems&lt;br /&gt;
  [*]     Include support for LZO compressed file systems&lt;br /&gt;
  [*]     Include support for XZ compressed file systems&lt;br /&gt;
  [ ]     Use 4K device block size?&lt;br /&gt;
  [ ]     Additional option for memory-constrained systems&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now save and exit, and continue to build 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 modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have multiple cores, do a make -j&amp;lt;# of processors+1&amp;gt; to build faster. Example: '''make -j9''' for an 8 core machine.}}&lt;br /&gt;
&lt;br /&gt;
=== Using the overlay ===&lt;br /&gt;
Inside the overlay, there are ebuilds already prepared that will download the kernel, patch it, and perform any required substitutions. Afterwards you literally just go into your /usr/src/&amp;lt;kernel&amp;gt; directory, and run make. To see the available versions, run the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Versions available for standard kernel&lt;br /&gt;
# ##i##equery y -O std-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.4.37-r1 | o ~ o o o o o o o o o o o | o 3.4.37 | fearedbliss&lt;br /&gt;
&lt;br /&gt;
Versions available for alternate kernel&lt;br /&gt;
# ##i##equery y -O alt-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.8.4 | o ~ o o o o o o o o o o o | o 3.8.4 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I haven't written the ebuilds in a way where it's easy to tell (at first glance) what System Rescue CD version you need. However, you can check the ebuild and you will see the version of the CD inside there. You can also check the chart above.&lt;br /&gt;
&lt;br /&gt;
If you wanted to install the standard kernel sources, you just emerge it like any other application:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge std-sources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the kernel and the kernel module are installed, you need to make the SRM.&lt;br /&gt;
&lt;br /&gt;
== Creating the SRM ==&lt;br /&gt;
It's time to gather the required files and pack them together in order for it to become an SRM. An SRM is nothing more than a directory that has been compressed with squashfs. Thankfully I've written a script that will build it for you, and you can install it from the overlay.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You also need to have spl, zfs, and zfs-kmod installed on your system before you try to make the srm. Emerging '''&amp;quot;bliss-initramfs&amp;quot;''' should automatically pull those packages. If it doesn't, make sure you install them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs srm&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should now have the following directory layout inside the '''/opt/bliss-initramfs''' folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-initramfs # ls -l&lt;br /&gt;
total 117&lt;br /&gt;
-rw-r--r-- 1 root root 6718 May 23 18:05 CHANGES&lt;br /&gt;
-rw-r--r-- 1 root root  176 May 23 18:05 CREDITS&lt;br /&gt;
-rw-r--r-- 1 root root  431 May 23 18:05 HELP&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 23 18:05 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root 1852 May 23 18:05 README&lt;br /&gt;
-rw-r--r-- 1 root root 3194 May 23 18:05 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 2891 May 23 18:05 createInit&lt;br /&gt;
drwxr-xr-x 3 root root    4 May 23 18:11 files&lt;br /&gt;
drwxr-xr-x 3 root root    6 May 23 18:11 hooks&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 23 22:01 resources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run the '''createInit''' script and follow the instructions for the kernel you want to make the srm for (In this case it's '''3.4.37-std350-amd64'''):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-----------------------------------&lt;br /&gt;
| Bliss Initramfs Creator - v1.8.1&lt;br /&gt;
| Author: Jonathan Vasquez &amp;lt;jvasquez1011@gmail.com&amp;gt;&lt;br /&gt;
| Distributed under the Simplified BSD License&lt;br /&gt;
-----------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Which initramfs would you like to generate:&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS&lt;br /&gt;
&amp;gt;&amp;gt; 2. Encrypted ZFS (LUKS + ZFS)&lt;br /&gt;
&amp;gt;&amp;gt; 3. More Options&lt;br /&gt;
&amp;gt;&amp;gt; 4. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##3 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; More Options:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS - System Rescue Module&lt;br /&gt;
&amp;gt;&amp;gt; 2. Back&lt;br /&gt;
&amp;gt;&amp;gt; 3. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating a ZFS System Rescue Module!&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Do you want to use the current kernel: 3.8.13-ALL? [Y/n]: ##i##n ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Please enter the kernel name: ##i##3.4.37-std350-amd64 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Detected 64 bit platform&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking to see if modules directory exists for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating SRMs for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating directory structure for initramfs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking preliminary binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Using ZFS&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying documentation...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying udev rules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Compressing kernel modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Getting dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Configuring files...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating and Packing SRMs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Complete :)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you should have two new files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-rw-r--r-- 1 root root 2068480 May 24 01:05 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rw-r--r-- 1 root root  483328 May 24 01:05 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now all you need to do is put those two files in the root of your USB directory.&lt;br /&gt;
&lt;br /&gt;
If you are making srms for both the standard and alternate kernels, you will end up with two zfs-core files and two zfs-kmod files (1 set for each kernel). You don't need to put the zfs-core that it makes for one of the kernels. The zfs-core srm only has zfs program binaries, man pages, udev rules, and a few other things. The zfs-kmod is the srm that has the kernel modules (and only the kernel modules). So you can easily just put two zfs-kmods (one for each kernel version) and just re-use the same zfs-core for both of them.&lt;br /&gt;
&lt;br /&gt;
== Using the prebuilt srm ==&lt;br /&gt;
&lt;br /&gt;
=== Download the SRM ===&lt;br /&gt;
If you didn't build your own srm and want to use the prebuilt one, just emerge '''&amp;quot;zfs-srm&amp;quot;''' from the overlay:&lt;br /&gt;
&lt;br /&gt;
(Instructions on [[Creating_System_Rescue_CD_ZFS_Modules#Adding_the_overlay|adding the overlay]] can be found at the top of this page)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge zfs-srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check available versions just as you did above for the kernels:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Available versions of the zfs-srm&lt;br /&gt;
# ##i##equery y -O zfs-srm&lt;br /&gt;
&lt;br /&gt;
[I]3.5.0 | o ~ o o o o o o o o o o o | o 3.5.0 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(These versions match the version of the System Rescue CD).&lt;br /&gt;
&lt;br /&gt;
Installing the zfs-srm will automatically pull the '''&amp;quot;bliss-isomaker&amp;quot;''' package which is just a script that assists you with rebuilding the System Rescue CD ISO so that the ISO includes the ZFS srms. The script lets you make a bootable ISO or a bootable USB.&lt;br /&gt;
&lt;br /&gt;
Once it's installed, switch to the /opt/bliss-isomaker folder &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-isomaker&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see a directory layout that looks similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-isomaker # ls -l&lt;br /&gt;
total 100&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 24 01:41 3.5.0&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 24 01:31 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root  312 May 24 01:31 README&lt;br /&gt;
-rw-r--r-- 1 root root  576 May 24 01:31 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 3228 May 24 01:31 create&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 iso&lt;br /&gt;
drwxr-xr-x 2 root root    4 May 24 01:41 resources&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The layout is as follows:&lt;br /&gt;
* 3.5.0 - This folder contains the System Rescue CD 3.5.0 specific srms for both the standard and alternate kernel that were installed by emerge.&lt;br /&gt;
* create - A script to automatically recreate the system rescue cd iso or usb with the zfs stuff included&lt;br /&gt;
* iso - directory to place your system rescue cd iso in&lt;br /&gt;
* srm - directory that has the srms&lt;br /&gt;
* resources - the files in this folder contain function calls that the 'create' script uses. You don't need to worry about these.&lt;br /&gt;
&lt;br /&gt;
=== Installing the SRM ===&lt;br /&gt;
There are a few ways to do this, you can either use one of the scripts, or you can do it manually. Before anything, make sure to copy the SRMs from the &amp;lt;Version&amp;gt; folder to the srm folder if you are using a prebuilt one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp 3.5.0/* srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Generating a new iso ====&lt;br /&gt;
If you just want to remake a new iso so that you can burn onto a cd or use in a virtual machine, just copy your iso over to the iso directory, and run the 'create' script. The new iso will be located in the iso directory as well with a -zfs ending. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 1 (or iso) chooses to make an iso. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 1&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create iso 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a fresh usb ====&lt;br /&gt;
If you want to have zfs on a usb with system rescue cd, put the iso in your iso dir, and then run the usb script. It will ask you what usb you want to format (This will delete everything), and then install system rescue cd onto it. Once that is done it will copy the zfs stuff over.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 2 (or usb) chooses to make an usb. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 2&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create usb 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Manual installation onto a usb ====&lt;br /&gt;
Assuming that your installing to a flash drive and that the flash drive is mounted in /mnt&lt;br /&gt;
&lt;br /&gt;
1. Mount your usb drive&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mount /dev/sdX# /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Where X# is the letter and number of your device. Immediately after you plug your usb in, type `dmesg | tail` in the console and you should see it.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Copy the zfs .srms to /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp zfs-core-3.4.37-std350-amd64.srm zfs-kmod-3.4.37-std350-amd64.srm zfs-kmod-3.8.4-alt350-amd64.srm /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. List your /mnt/usbstick directory and you should see something similar to the following in your /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus 3.5.0 # ls -l /mnt/usbstick&lt;br /&gt;
total 305028&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 boot&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootdisk&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootprog&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 efi&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 ntpasswd&lt;br /&gt;
-rwxr-xr-x 1 root root      2349 May 23 20:51 readme.txt&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:52 syslinux&lt;br /&gt;
-rwxr-xr-x 1 root root 309252096 May 23 20:51 sysrcd.dat&lt;br /&gt;
-rwxr-xr-x 1 root root        45 May 23 20:51 sysrcd.md5&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 usb_inst&lt;br /&gt;
-rwxr-xr-x 1 root root     15889 May 23 20:51 usb_inst.sh&lt;br /&gt;
-rwxr-xr-x 1 root root       877 May 23 20:51 usbstick.htm&lt;br /&gt;
-rwxr-xr-x 1 root root         6 May 23 20:51 version&lt;br /&gt;
-rwxr-xr-x 1 root root   2068480 May 23 20:51 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.8.4-alt350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now un-mount your flash drive and boot it into the machine that you want to use ZFS on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##umount /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Booting into the correct kernel ==&lt;br /&gt;
'''If you are using the standard srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
C) Standard 64bit kernel (rescue64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''If you are using the alternative srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
E) Alternative 64bit kernel (altker64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Run 'depmod' so that the new modules can be seen by the kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|You must run '''depmod'''. If you don't, then you will get failed to load the ZFS stack error!}}&lt;br /&gt;
&lt;br /&gt;
3. Use ZFS as usual. If you type '''zpool status''' and then type '''dmesg | tail''',&lt;br /&gt;
&lt;br /&gt;
you should see something that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
ZFS: Loaded module v0.6.1-1, ZFS pool version 5000, ZFS filesystem version 5&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see the above, then the modules loaded successfully!&lt;br /&gt;
&lt;br /&gt;
Enjoy System Rescue CD with ZFS :)&lt;br /&gt;
&lt;br /&gt;
== Extra ==&lt;br /&gt;
&lt;br /&gt;
=== A more accurate kernel build setup ===&lt;br /&gt;
If you want to have a more accurate setup to upstream, you can check out the git repo he has for the target release. Example: [http://sourceforge.net/p/systemrescuecd/code/ci/74e7a9712a019958fbe099386c9fb6bd7813d907/tree/ Upstream Git Repo]&lt;br /&gt;
&lt;br /&gt;
If you navigate to portage-overlay/sys-kernel/std-sources, you can see the ebuild there and the files directory with the patches for the std-sources kernel.&lt;br /&gt;
&lt;br /&gt;
I also keep my own modified ebuilds for when I make my own srms in my overlay:&lt;br /&gt;
https://github.com/fearedbliss/funtoo-overlay&lt;br /&gt;
&lt;br /&gt;
You can see the ebuilds in the sys-kernel/std-sources directory.&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules</id>
		<title>Creating System Rescue CD ZFS Modules</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules"/>
				<updated>2013-06-10T00:16:10Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Booting into the correct kernel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will show you how to create your own zfs srm or download the prebuilt zfs srm module from my website.&lt;br /&gt;
&lt;br /&gt;
== Adding the overlay ==&lt;br /&gt;
There are scripts that I've written that will make this process much easier for you. So we will first set up the overlay to a directory on your machine, let's say '''&amp;quot;/home/example/overlays/fearedbliss&amp;quot;''':&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that the overlay has been added, let's continue.&lt;br /&gt;
&lt;br /&gt;
== Compiling a compatible kernel ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is decide for which version of System Rescue CD you will be building for. Each System Rescue CD version has a different set of kernels. Specifically each version has a Stable kernel and an Alternate Kernel. The stable kernels get minor version increments every release (Sometimes major ones but usually doesn't happen too quickly), the Alternate kernels tend to move up much faster. For example System Rescue CD had the following stable/alternate kernels:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Version !! Stable !! Alternate&lt;br /&gt;
|-&lt;br /&gt;
| 3.5.0 || 3.4.37 || 3.8.4&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.2 || 3.4.35 || 3.7.10&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.1 || 3.4.32 || 3.7.9&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.0 || 3.4.30 || 3.7.8&lt;br /&gt;
|-&lt;br /&gt;
| 3.3.0 || 3.4.27 || 3.7.4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Download kernel and patches===&lt;br /&gt;
Once you decide which version you want to use, you can go to http://kernel.sysresccd.org/ and pick the version you want. After you do this, download all the stuff in that directory and put them in their own folder (a work directory). The files that are named std-sources are the patches for the regular stable kernel, the patches named alt-sources are the patches for the alternate kernel. Once you have the patches, go to kernel.org and also download the initial release of the kernel sources you want. For example, if you want to build an srm for 3.4.2 which uses the 3.4.35 kernel, just download the 3.4 (3.4.0) kernel. You just need to download the initial release because one of the patches you downloaded earlier is the patch to update the 3.4.0 to 3.4.35.&lt;br /&gt;
&lt;br /&gt;
Once you download the kernel you want, let's extract and patch it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##tar xf linux-3.4.tar.bz2&lt;br /&gt;
# ##i##mv linux-3.4 linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-01-stable-3.4.35.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-02-fc16.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-03-aufs.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Retrieve kernel configuration===&lt;br /&gt;
Once that is complete, you will need to get the kernel config specifically for the kernel and architecture you want. The easiest way I found to do this was to download the System Rescue CD you want, and then boot it inside a VM. Once you are inside the VM, go to the /root directory, and it will be a file named kernel-&amp;lt;version&amp;gt;.conf. Copy this file over SSH and put it in a safe location. Also copy it over into the linux kernel directory and rename it to .config.&lt;br /&gt;
&lt;br /&gt;
===Build the kernel===&lt;br /&gt;
Once you copy the kernel config over, do a make menuconfig to begin. You will only need to change two settings inside the config, add the proper kernel name, and remove the old initramfs source files directory. This directory doesn't exist locally. This is a remnant of upstream's build process.&lt;br /&gt;
&lt;br /&gt;
Follow the below tree structure, and make it equal to what is below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
General Setup -&amp;gt;&lt;br /&gt;
 (-std342-amd64) Local version - append to kernel release&lt;br /&gt;
 [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support  ()    Initramfs source file(s)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Local version above will end up making the kernel modules directory be 3.4.35-std342-amd64. The reason the kernel modules directory has to be equal to this is because our directory will be merged into the System Rescue CD later on, so the names need to be exactly the same so that the System Rescue CD system can find our kernel modules.&lt;br /&gt;
&lt;br /&gt;
If you want to build an srm (which you do), you also need to change the following inside the kernel config so that squashfs-tools can work later on:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
File Systems -&amp;gt;&lt;br /&gt;
Miscellaneous Filesystems -&amp;gt;&lt;br /&gt;
 &amp;lt;*&amp;gt;   SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  [*]     Squashfs XATTR support&lt;br /&gt;
  [*]     Include support for ZLIB compressed file systems&lt;br /&gt;
  [*]     Include support for LZO compressed file systems&lt;br /&gt;
  [*]     Include support for XZ compressed file systems&lt;br /&gt;
  [ ]     Use 4K device block size?&lt;br /&gt;
  [ ]     Additional option for memory-constrained systems&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now save and exit, and continue to build 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 modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have multiple cores, do a make -j&amp;lt;# of processors+1&amp;gt; to build faster. Example: '''make -j9''' for an 8 core machine.}}&lt;br /&gt;
&lt;br /&gt;
=== Using the overlay ===&lt;br /&gt;
Inside the overlay, there are ebuilds already prepared that will download the kernel, patch it, and perform any required substitutions. Afterwards you literally just go into your /usr/src/&amp;lt;kernel&amp;gt; directory, and run make. To see the available versions, run the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Versions available for standard kernel&lt;br /&gt;
# ##i##equery y -O std-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.4.37-r1 | o ~ o o o o o o o o o o o | o 3.4.37 | fearedbliss&lt;br /&gt;
&lt;br /&gt;
Versions available for alternate kernel&lt;br /&gt;
# ##i##equery y -O alt-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.8.4 | o ~ o o o o o o o o o o o | o 3.8.4 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I haven't written the ebuilds in a way where it's easy to tell (at first glance) what System Rescue CD version you need. However, you can check the ebuild and you will see the version of the CD inside there. You can also check the chart above.&lt;br /&gt;
&lt;br /&gt;
If you wanted to install the standard kernel sources, you just emerge it like any other application:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge std-sources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the kernel and the kernel module are installed, you need to make the SRM.&lt;br /&gt;
&lt;br /&gt;
== Creating the SRM ==&lt;br /&gt;
It's time to gather the required files and pack them together in order for it to become an SRM. An SRM is nothing more than a directory that has been compressed with squashfs. Thankfully I've written a script that will build it for you, and you can install it from the overlay.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You also need to have spl, zfs, and zfs-kmod installed on your system before you try to make the srm. Emerging '''&amp;quot;bliss-initramfs&amp;quot;''' should automatically pull those packages. If it doesn't, make sure you install them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs srm&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should now have the following directory layout inside the '''/opt/bliss-initramfs''' folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-initramfs # ls -l&lt;br /&gt;
total 117&lt;br /&gt;
-rw-r--r-- 1 root root 6718 May 23 18:05 CHANGES&lt;br /&gt;
-rw-r--r-- 1 root root  176 May 23 18:05 CREDITS&lt;br /&gt;
-rw-r--r-- 1 root root  431 May 23 18:05 HELP&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 23 18:05 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root 1852 May 23 18:05 README&lt;br /&gt;
-rw-r--r-- 1 root root 3194 May 23 18:05 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 2891 May 23 18:05 createInit&lt;br /&gt;
drwxr-xr-x 3 root root    4 May 23 18:11 files&lt;br /&gt;
drwxr-xr-x 3 root root    6 May 23 18:11 hooks&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 23 22:01 resources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run the '''createInit''' script and follow the instructions for the kernel you want to make the srm for (In this case it's '''3.4.37-std350-amd64'''):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-----------------------------------&lt;br /&gt;
| Bliss Initramfs Creator - v1.8.1&lt;br /&gt;
| Author: Jonathan Vasquez &amp;lt;jvasquez1011@gmail.com&amp;gt;&lt;br /&gt;
| Distributed under the Simplified BSD License&lt;br /&gt;
-----------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Which initramfs would you like to generate:&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS&lt;br /&gt;
&amp;gt;&amp;gt; 2. Encrypted ZFS (LUKS + ZFS)&lt;br /&gt;
&amp;gt;&amp;gt; 3. More Options&lt;br /&gt;
&amp;gt;&amp;gt; 4. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##3 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; More Options:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS - System Rescue Module&lt;br /&gt;
&amp;gt;&amp;gt; 2. Back&lt;br /&gt;
&amp;gt;&amp;gt; 3. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating a ZFS System Rescue Module!&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Do you want to use the current kernel: 3.8.13-ALL? [Y/n]: ##i##n ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Please enter the kernel name: ##i##3.4.37-std350-amd64 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Detected 64 bit platform&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking to see if modules directory exists for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating SRMs for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating directory structure for initramfs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking preliminary binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Using ZFS&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying documentation...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying udev rules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Compressing kernel modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Getting dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Configuring files...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating and Packing SRMs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Complete :)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you should have two new files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-rw-r--r-- 1 root root 2068480 May 24 01:05 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rw-r--r-- 1 root root  483328 May 24 01:05 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now all you need to do is put those two files in the root of your USB directory.&lt;br /&gt;
&lt;br /&gt;
If you are making srms for both the standard and alternate kernels, you will end up with two zfs-core files and two zfs-kmod files (1 set for each kernel). You don't need to put the zfs-core that it makes for one of the kernels. The zfs-core srm only has zfs program binaries, man pages, udev rules, and a few other things. The zfs-kmod is the srm that has the kernel modules (and only the kernel modules). So you can easily just put two zfs-kmods (one for each kernel version) and just re-use the same zfs-core for both of them.&lt;br /&gt;
&lt;br /&gt;
== Using the prebuilt srm ==&lt;br /&gt;
&lt;br /&gt;
=== Download the SRM ===&lt;br /&gt;
If you didn't build your own srm and want to use the prebuilt one, just emerge '''&amp;quot;zfs-srm&amp;quot;''' from the overlay:&lt;br /&gt;
&lt;br /&gt;
(Instructions on [[Creating_System_Rescue_CD_ZFS_Modules#Adding_the_overlay|adding the overlay]] can be found at the top of this page)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge zfs-srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check available versions just as you did above for the kernels:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Available versions of the zfs-srm&lt;br /&gt;
# ##i##equery y -O zfs-srm&lt;br /&gt;
&lt;br /&gt;
[I]3.5.0 | o ~ o o o o o o o o o o o | o 3.5.0 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(These versions match the version of the System Rescue CD).&lt;br /&gt;
&lt;br /&gt;
Installing the zfs-srm will automatically pull the '''&amp;quot;bliss-isomaker&amp;quot;''' package which is just a script that assists you with rebuilding the System Rescue CD ISO so that the ISO includes the ZFS srms. The script lets you make a bootable ISO or a bootable USB.&lt;br /&gt;
&lt;br /&gt;
Once it's installed, switch to the /opt/bliss-isomaker folder &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-isomaker&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see a directory layout that looks similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-isomaker # ls -l&lt;br /&gt;
total 100&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 24 01:41 3.5.0&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 24 01:31 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root  312 May 24 01:31 README&lt;br /&gt;
-rw-r--r-- 1 root root  576 May 24 01:31 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 3228 May 24 01:31 create&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 iso&lt;br /&gt;
drwxr-xr-x 2 root root    4 May 24 01:41 resources&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The layout is as follows:&lt;br /&gt;
* 3.5.0 - This folder contains the System Rescue CD 3.5.0 specific srms for both the standard and alternate kernel that were installed by emerge.&lt;br /&gt;
* create - A script to automatically recreate the system rescue cd iso or usb with the zfs stuff included&lt;br /&gt;
* iso - directory to place your system rescue cd iso in&lt;br /&gt;
* srm - directory that has the srms&lt;br /&gt;
* resources - the files in this folder contain function calls that the 'create' script uses. You don't need to worry about these.&lt;br /&gt;
&lt;br /&gt;
=== Installing the SRM ===&lt;br /&gt;
There are a few ways to do this, you can either use one of the scripts, or you can do it manually. Before anything, make sure to copy the SRMs from the &amp;lt;Version&amp;gt; folder to the srm folder if you are using a prebuilt one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp 3.5.0/* srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Generating a new iso ====&lt;br /&gt;
If you just want to remake a new iso so that you can burn onto a cd or use in a virtual machine, just copy your iso over to the iso directory, and run the 'create' script. The new iso will be located in the iso directory as well with a -zfs ending. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 1 (or iso) chooses to make an iso. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 1&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create iso 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a fresh usb ====&lt;br /&gt;
If you want to have zfs on a usb with system rescue cd, put the iso in your iso dir, and then run the usb script. It will ask you what usb you want to format (This will delete everything), and then install system rescue cd onto it. Once that is done it will copy the zfs stuff over.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 2 (or usb) chooses to make an usb. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 2&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create usb 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Manual installation onto a usb ====&lt;br /&gt;
Assuming that your installing to a flash drive and that the flash drive is mounted in /mnt&lt;br /&gt;
&lt;br /&gt;
1. Mount your usb drive&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mount /dev/sdX# /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Where X# is the letter and number of your device. Immediately after you plug your usb in, type `dmesg | tail` in the console and you should see it.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Copy the zfs .srms to /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp zfs-core-3.4.37-std350-amd64.srm zfs-kmod-3.4.37-std350-amd64.srm zfs-kmod-3.8.4-alt350-amd64.srm /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. List your /mnt/usbstick directory and you should see something similar to the following in your /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus 3.5.0 # ls -l /mnt/usbstick&lt;br /&gt;
total 305028&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 boot&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootdisk&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootprog&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 efi&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 ntpasswd&lt;br /&gt;
-rwxr-xr-x 1 root root      2349 May 23 20:51 readme.txt&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:52 syslinux&lt;br /&gt;
-rwxr-xr-x 1 root root 309252096 May 23 20:51 sysrcd.dat&lt;br /&gt;
-rwxr-xr-x 1 root root        45 May 23 20:51 sysrcd.md5&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 usb_inst&lt;br /&gt;
-rwxr-xr-x 1 root root     15889 May 23 20:51 usb_inst.sh&lt;br /&gt;
-rwxr-xr-x 1 root root       877 May 23 20:51 usbstick.htm&lt;br /&gt;
-rwxr-xr-x 1 root root         6 May 23 20:51 version&lt;br /&gt;
-rwxr-xr-x 1 root root   2068480 May 23 20:51 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.8.4-alt350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now un-mount your flash drive and boot it into the machine that you want to use ZFS on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##umount /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Booting into the correct kernel ==&lt;br /&gt;
'''If you are using the standard srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
C) Standard 64bit kernel (rescue64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''If you are using the alternative srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
E) Alternative 64bit kernel (altker64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Run 'depmod' so that the new modules can be seen by the kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|You must run '''depmod'''. If you don't, then you will get failed to load the ZFS stack error! And after modprobe you can check with 'lsmod' if the 6 modules where loaded.}}&lt;br /&gt;
&lt;br /&gt;
3. Use ZFS as usual. If you type '''zpool status''' and then type '''dmesg | tail''',&lt;br /&gt;
&lt;br /&gt;
you should see something that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
ZFS: Loaded module v0.6.1-1, ZFS pool version 5000, ZFS filesystem version 5&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see the above, then the modules loaded successfully!&lt;br /&gt;
&lt;br /&gt;
Enjoy System Rescue CD with ZFS :)&lt;br /&gt;
&lt;br /&gt;
== Extra ==&lt;br /&gt;
&lt;br /&gt;
=== A more accurate kernel build setup ===&lt;br /&gt;
If you want to have a more accurate setup to upstream, you can check out the git repo he has for the target release. Example: [http://sourceforge.net/p/systemrescuecd/code/ci/74e7a9712a019958fbe099386c9fb6bd7813d907/tree/ Upstream Git Repo]&lt;br /&gt;
&lt;br /&gt;
If you navigate to portage-overlay/sys-kernel/std-sources, you can see the ebuild there and the files directory with the patches for the std-sources kernel.&lt;br /&gt;
&lt;br /&gt;
I also keep my own modified ebuilds for when I make my own srms in my overlay:&lt;br /&gt;
https://github.com/fearedbliss/funtoo-overlay&lt;br /&gt;
&lt;br /&gt;
You can see the ebuilds in the sys-kernel/std-sources directory.&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules</id>
		<title>Creating System Rescue CD ZFS Modules</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules"/>
				<updated>2013-06-10T00:16:03Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Booting into the correct kernel */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will show you how to create your own zfs srm or download the prebuilt zfs srm module from my website.&lt;br /&gt;
&lt;br /&gt;
== Adding the overlay ==&lt;br /&gt;
There are scripts that I've written that will make this process much easier for you. So we will first set up the overlay to a directory on your machine, let's say '''&amp;quot;/home/example/overlays/fearedbliss&amp;quot;''':&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that the overlay has been added, let's continue.&lt;br /&gt;
&lt;br /&gt;
== Compiling a compatible kernel ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is decide for which version of System Rescue CD you will be building for. Each System Rescue CD version has a different set of kernels. Specifically each version has a Stable kernel and an Alternate Kernel. The stable kernels get minor version increments every release (Sometimes major ones but usually doesn't happen too quickly), the Alternate kernels tend to move up much faster. For example System Rescue CD had the following stable/alternate kernels:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Version !! Stable !! Alternate&lt;br /&gt;
|-&lt;br /&gt;
| 3.5.0 || 3.4.37 || 3.8.4&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.2 || 3.4.35 || 3.7.10&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.1 || 3.4.32 || 3.7.9&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.0 || 3.4.30 || 3.7.8&lt;br /&gt;
|-&lt;br /&gt;
| 3.3.0 || 3.4.27 || 3.7.4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Download kernel and patches===&lt;br /&gt;
Once you decide which version you want to use, you can go to http://kernel.sysresccd.org/ and pick the version you want. After you do this, download all the stuff in that directory and put them in their own folder (a work directory). The files that are named std-sources are the patches for the regular stable kernel, the patches named alt-sources are the patches for the alternate kernel. Once you have the patches, go to kernel.org and also download the initial release of the kernel sources you want. For example, if you want to build an srm for 3.4.2 which uses the 3.4.35 kernel, just download the 3.4 (3.4.0) kernel. You just need to download the initial release because one of the patches you downloaded earlier is the patch to update the 3.4.0 to 3.4.35.&lt;br /&gt;
&lt;br /&gt;
Once you download the kernel you want, let's extract and patch it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##tar xf linux-3.4.tar.bz2&lt;br /&gt;
# ##i##mv linux-3.4 linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-01-stable-3.4.35.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-02-fc16.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-03-aufs.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Retrieve kernel configuration===&lt;br /&gt;
Once that is complete, you will need to get the kernel config specifically for the kernel and architecture you want. The easiest way I found to do this was to download the System Rescue CD you want, and then boot it inside a VM. Once you are inside the VM, go to the /root directory, and it will be a file named kernel-&amp;lt;version&amp;gt;.conf. Copy this file over SSH and put it in a safe location. Also copy it over into the linux kernel directory and rename it to .config.&lt;br /&gt;
&lt;br /&gt;
===Build the kernel===&lt;br /&gt;
Once you copy the kernel config over, do a make menuconfig to begin. You will only need to change two settings inside the config, add the proper kernel name, and remove the old initramfs source files directory. This directory doesn't exist locally. This is a remnant of upstream's build process.&lt;br /&gt;
&lt;br /&gt;
Follow the below tree structure, and make it equal to what is below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
General Setup -&amp;gt;&lt;br /&gt;
 (-std342-amd64) Local version - append to kernel release&lt;br /&gt;
 [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support  ()    Initramfs source file(s)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Local version above will end up making the kernel modules directory be 3.4.35-std342-amd64. The reason the kernel modules directory has to be equal to this is because our directory will be merged into the System Rescue CD later on, so the names need to be exactly the same so that the System Rescue CD system can find our kernel modules.&lt;br /&gt;
&lt;br /&gt;
If you want to build an srm (which you do), you also need to change the following inside the kernel config so that squashfs-tools can work later on:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
File Systems -&amp;gt;&lt;br /&gt;
Miscellaneous Filesystems -&amp;gt;&lt;br /&gt;
 &amp;lt;*&amp;gt;   SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  [*]     Squashfs XATTR support&lt;br /&gt;
  [*]     Include support for ZLIB compressed file systems&lt;br /&gt;
  [*]     Include support for LZO compressed file systems&lt;br /&gt;
  [*]     Include support for XZ compressed file systems&lt;br /&gt;
  [ ]     Use 4K device block size?&lt;br /&gt;
  [ ]     Additional option for memory-constrained systems&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now save and exit, and continue to build 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 modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have multiple cores, do a make -j&amp;lt;# of processors+1&amp;gt; to build faster. Example: '''make -j9''' for an 8 core machine.}}&lt;br /&gt;
&lt;br /&gt;
=== Using the overlay ===&lt;br /&gt;
Inside the overlay, there are ebuilds already prepared that will download the kernel, patch it, and perform any required substitutions. Afterwards you literally just go into your /usr/src/&amp;lt;kernel&amp;gt; directory, and run make. To see the available versions, run the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Versions available for standard kernel&lt;br /&gt;
# ##i##equery y -O std-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.4.37-r1 | o ~ o o o o o o o o o o o | o 3.4.37 | fearedbliss&lt;br /&gt;
&lt;br /&gt;
Versions available for alternate kernel&lt;br /&gt;
# ##i##equery y -O alt-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.8.4 | o ~ o o o o o o o o o o o | o 3.8.4 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I haven't written the ebuilds in a way where it's easy to tell (at first glance) what System Rescue CD version you need. However, you can check the ebuild and you will see the version of the CD inside there. You can also check the chart above.&lt;br /&gt;
&lt;br /&gt;
If you wanted to install the standard kernel sources, you just emerge it like any other application:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge std-sources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the kernel and the kernel module are installed, you need to make the SRM.&lt;br /&gt;
&lt;br /&gt;
== Creating the SRM ==&lt;br /&gt;
It's time to gather the required files and pack them together in order for it to become an SRM. An SRM is nothing more than a directory that has been compressed with squashfs. Thankfully I've written a script that will build it for you, and you can install it from the overlay.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You also need to have spl, zfs, and zfs-kmod installed on your system before you try to make the srm. Emerging '''&amp;quot;bliss-initramfs&amp;quot;''' should automatically pull those packages. If it doesn't, make sure you install them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs srm&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should now have the following directory layout inside the '''/opt/bliss-initramfs''' folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-initramfs # ls -l&lt;br /&gt;
total 117&lt;br /&gt;
-rw-r--r-- 1 root root 6718 May 23 18:05 CHANGES&lt;br /&gt;
-rw-r--r-- 1 root root  176 May 23 18:05 CREDITS&lt;br /&gt;
-rw-r--r-- 1 root root  431 May 23 18:05 HELP&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 23 18:05 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root 1852 May 23 18:05 README&lt;br /&gt;
-rw-r--r-- 1 root root 3194 May 23 18:05 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 2891 May 23 18:05 createInit&lt;br /&gt;
drwxr-xr-x 3 root root    4 May 23 18:11 files&lt;br /&gt;
drwxr-xr-x 3 root root    6 May 23 18:11 hooks&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 23 22:01 resources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run the '''createInit''' script and follow the instructions for the kernel you want to make the srm for (In this case it's '''3.4.37-std350-amd64'''):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-----------------------------------&lt;br /&gt;
| Bliss Initramfs Creator - v1.8.1&lt;br /&gt;
| Author: Jonathan Vasquez &amp;lt;jvasquez1011@gmail.com&amp;gt;&lt;br /&gt;
| Distributed under the Simplified BSD License&lt;br /&gt;
-----------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Which initramfs would you like to generate:&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS&lt;br /&gt;
&amp;gt;&amp;gt; 2. Encrypted ZFS (LUKS + ZFS)&lt;br /&gt;
&amp;gt;&amp;gt; 3. More Options&lt;br /&gt;
&amp;gt;&amp;gt; 4. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##3 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; More Options:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS - System Rescue Module&lt;br /&gt;
&amp;gt;&amp;gt; 2. Back&lt;br /&gt;
&amp;gt;&amp;gt; 3. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating a ZFS System Rescue Module!&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Do you want to use the current kernel: 3.8.13-ALL? [Y/n]: ##i##n ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Please enter the kernel name: ##i##3.4.37-std350-amd64 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Detected 64 bit platform&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking to see if modules directory exists for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating SRMs for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating directory structure for initramfs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking preliminary binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Using ZFS&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying documentation...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying udev rules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Compressing kernel modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Getting dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Configuring files...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating and Packing SRMs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Complete :)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you should have two new files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-rw-r--r-- 1 root root 2068480 May 24 01:05 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rw-r--r-- 1 root root  483328 May 24 01:05 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now all you need to do is put those two files in the root of your USB directory.&lt;br /&gt;
&lt;br /&gt;
If you are making srms for both the standard and alternate kernels, you will end up with two zfs-core files and two zfs-kmod files (1 set for each kernel). You don't need to put the zfs-core that it makes for one of the kernels. The zfs-core srm only has zfs program binaries, man pages, udev rules, and a few other things. The zfs-kmod is the srm that has the kernel modules (and only the kernel modules). So you can easily just put two zfs-kmods (one for each kernel version) and just re-use the same zfs-core for both of them.&lt;br /&gt;
&lt;br /&gt;
== Using the prebuilt srm ==&lt;br /&gt;
&lt;br /&gt;
=== Download the SRM ===&lt;br /&gt;
If you didn't build your own srm and want to use the prebuilt one, just emerge '''&amp;quot;zfs-srm&amp;quot;''' from the overlay:&lt;br /&gt;
&lt;br /&gt;
(Instructions on [[Creating_System_Rescue_CD_ZFS_Modules#Adding_the_overlay|adding the overlay]] can be found at the top of this page)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge zfs-srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check available versions just as you did above for the kernels:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Available versions of the zfs-srm&lt;br /&gt;
# ##i##equery y -O zfs-srm&lt;br /&gt;
&lt;br /&gt;
[I]3.5.0 | o ~ o o o o o o o o o o o | o 3.5.0 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(These versions match the version of the System Rescue CD).&lt;br /&gt;
&lt;br /&gt;
Installing the zfs-srm will automatically pull the '''&amp;quot;bliss-isomaker&amp;quot;''' package which is just a script that assists you with rebuilding the System Rescue CD ISO so that the ISO includes the ZFS srms. The script lets you make a bootable ISO or a bootable USB.&lt;br /&gt;
&lt;br /&gt;
Once it's installed, switch to the /opt/bliss-isomaker folder &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-isomaker&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see a directory layout that looks similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-isomaker # ls -l&lt;br /&gt;
total 100&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 24 01:41 3.5.0&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 24 01:31 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root  312 May 24 01:31 README&lt;br /&gt;
-rw-r--r-- 1 root root  576 May 24 01:31 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 3228 May 24 01:31 create&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 iso&lt;br /&gt;
drwxr-xr-x 2 root root    4 May 24 01:41 resources&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The layout is as follows:&lt;br /&gt;
* 3.5.0 - This folder contains the System Rescue CD 3.5.0 specific srms for both the standard and alternate kernel that were installed by emerge.&lt;br /&gt;
* create - A script to automatically recreate the system rescue cd iso or usb with the zfs stuff included&lt;br /&gt;
* iso - directory to place your system rescue cd iso in&lt;br /&gt;
* srm - directory that has the srms&lt;br /&gt;
* resources - the files in this folder contain function calls that the 'create' script uses. You don't need to worry about these.&lt;br /&gt;
&lt;br /&gt;
=== Installing the SRM ===&lt;br /&gt;
There are a few ways to do this, you can either use one of the scripts, or you can do it manually. Before anything, make sure to copy the SRMs from the &amp;lt;Version&amp;gt; folder to the srm folder if you are using a prebuilt one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp 3.5.0/* srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Generating a new iso ====&lt;br /&gt;
If you just want to remake a new iso so that you can burn onto a cd or use in a virtual machine, just copy your iso over to the iso directory, and run the 'create' script. The new iso will be located in the iso directory as well with a -zfs ending. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 1 (or iso) chooses to make an iso. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 1&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create iso 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a fresh usb ====&lt;br /&gt;
If you want to have zfs on a usb with system rescue cd, put the iso in your iso dir, and then run the usb script. It will ask you what usb you want to format (This will delete everything), and then install system rescue cd onto it. Once that is done it will copy the zfs stuff over.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 2 (or usb) chooses to make an usb. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 2&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create usb 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Manual installation onto a usb ====&lt;br /&gt;
Assuming that your installing to a flash drive and that the flash drive is mounted in /mnt&lt;br /&gt;
&lt;br /&gt;
1. Mount your usb drive&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mount /dev/sdX# /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Where X# is the letter and number of your device. Immediately after you plug your usb in, type `dmesg | tail` in the console and you should see it.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Copy the zfs .srms to /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp zfs-core-3.4.37-std350-amd64.srm zfs-kmod-3.4.37-std350-amd64.srm zfs-kmod-3.8.4-alt350-amd64.srm /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. List your /mnt/usbstick directory and you should see something similar to the following in your /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus 3.5.0 # ls -l /mnt/usbstick&lt;br /&gt;
total 305028&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 boot&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootdisk&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootprog&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 efi&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 ntpasswd&lt;br /&gt;
-rwxr-xr-x 1 root root      2349 May 23 20:51 readme.txt&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:52 syslinux&lt;br /&gt;
-rwxr-xr-x 1 root root 309252096 May 23 20:51 sysrcd.dat&lt;br /&gt;
-rwxr-xr-x 1 root root        45 May 23 20:51 sysrcd.md5&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 usb_inst&lt;br /&gt;
-rwxr-xr-x 1 root root     15889 May 23 20:51 usb_inst.sh&lt;br /&gt;
-rwxr-xr-x 1 root root       877 May 23 20:51 usbstick.htm&lt;br /&gt;
-rwxr-xr-x 1 root root         6 May 23 20:51 version&lt;br /&gt;
-rwxr-xr-x 1 root root   2068480 May 23 20:51 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.8.4-alt350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now un-mount your flash drive and boot it into the machine that you want to use ZFS on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##umount /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Booting into the correct kernel ==&lt;br /&gt;
'''If you are using the standard srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
C) Standard 64bit kernel (rescue64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''If you are using the alternative srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
E) Alternative 64bit kernel (altker64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Run 'depmod' so that the new modules can be seen by the kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|You must run '''depmod'''. If you don't, then you will get failed to load the ZFS stack error! And after modprobe you can check with 'lsmod' if the 6 modules where loaded.}}&lt;br /&gt;
&lt;br /&gt;
5. Use ZFS as usual. If you type '''zpool status''' and then type '''dmesg | tail''',&lt;br /&gt;
&lt;br /&gt;
you should see something that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
ZFS: Loaded module v0.6.1-1, ZFS pool version 5000, ZFS filesystem version 5&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see the above, then the modules loaded successfully!&lt;br /&gt;
&lt;br /&gt;
Enjoy System Rescue CD with ZFS :)&lt;br /&gt;
&lt;br /&gt;
== Extra ==&lt;br /&gt;
&lt;br /&gt;
=== A more accurate kernel build setup ===&lt;br /&gt;
If you want to have a more accurate setup to upstream, you can check out the git repo he has for the target release. Example: [http://sourceforge.net/p/systemrescuecd/code/ci/74e7a9712a019958fbe099386c9fb6bd7813d907/tree/ Upstream Git Repo]&lt;br /&gt;
&lt;br /&gt;
If you navigate to portage-overlay/sys-kernel/std-sources, you can see the ebuild there and the files directory with the patches for the std-sources kernel.&lt;br /&gt;
&lt;br /&gt;
I also keep my own modified ebuilds for when I make my own srms in my overlay:&lt;br /&gt;
https://github.com/fearedbliss/funtoo-overlay&lt;br /&gt;
&lt;br /&gt;
You can see the ebuilds in the sys-kernel/std-sources directory.&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules</id>
		<title>Creating System Rescue CD ZFS Modules</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Creating_System_Rescue_CD_ZFS_Modules"/>
				<updated>2013-06-10T00:15:45Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: removed &amp;quot;modprobe -v zfs&amp;quot; this isn't necessary. Once the person runs &amp;quot;zpool status&amp;quot; or another zfs command, it will automatically load the modules.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This HOWTO will show you how to create your own zfs srm or download the prebuilt zfs srm module from my website.&lt;br /&gt;
&lt;br /&gt;
== Adding the overlay ==&lt;br /&gt;
There are scripts that I've written that will make this process much easier for you. So we will first set up the overlay to a directory on your machine, let's say '''&amp;quot;/home/example/overlays/fearedbliss&amp;quot;''':&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now that the overlay has been added, let's continue.&lt;br /&gt;
&lt;br /&gt;
== Compiling a compatible kernel ==&lt;br /&gt;
&lt;br /&gt;
The first thing you need to do is decide for which version of System Rescue CD you will be building for. Each System Rescue CD version has a different set of kernels. Specifically each version has a Stable kernel and an Alternate Kernel. The stable kernels get minor version increments every release (Sometimes major ones but usually doesn't happen too quickly), the Alternate kernels tend to move up much faster. For example System Rescue CD had the following stable/alternate kernels:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Version !! Stable !! Alternate&lt;br /&gt;
|-&lt;br /&gt;
| 3.5.0 || 3.4.37 || 3.8.4&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.2 || 3.4.35 || 3.7.10&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.1 || 3.4.32 || 3.7.9&lt;br /&gt;
|-&lt;br /&gt;
| 3.4.0 || 3.4.30 || 3.7.8&lt;br /&gt;
|-&lt;br /&gt;
| 3.3.0 || 3.4.27 || 3.7.4&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Download kernel and patches===&lt;br /&gt;
Once you decide which version you want to use, you can go to http://kernel.sysresccd.org/ and pick the version you want. After you do this, download all the stuff in that directory and put them in their own folder (a work directory). The files that are named std-sources are the patches for the regular stable kernel, the patches named alt-sources are the patches for the alternate kernel. Once you have the patches, go to kernel.org and also download the initial release of the kernel sources you want. For example, if you want to build an srm for 3.4.2 which uses the 3.4.35 kernel, just download the 3.4 (3.4.0) kernel. You just need to download the initial release because one of the patches you downloaded earlier is the patch to update the 3.4.0 to 3.4.35.&lt;br /&gt;
&lt;br /&gt;
Once you download the kernel you want, let's extract and patch it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##tar xf linux-3.4.tar.bz2&lt;br /&gt;
# ##i##mv linux-3.4 linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-01-stable-3.4.35.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-02-fc16.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
# ##i##bzcat std-sources-3.4-03-aufs.patch.bz2 | patch -p1 -d linux-3.4.35-std342-amd64&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Retrieve kernel configuration===&lt;br /&gt;
Once that is complete, you will need to get the kernel config specifically for the kernel and architecture you want. The easiest way I found to do this was to download the System Rescue CD you want, and then boot it inside a VM. Once you are inside the VM, go to the /root directory, and it will be a file named kernel-&amp;lt;version&amp;gt;.conf. Copy this file over SSH and put it in a safe location. Also copy it over into the linux kernel directory and rename it to .config.&lt;br /&gt;
&lt;br /&gt;
===Build the kernel===&lt;br /&gt;
Once you copy the kernel config over, do a make menuconfig to begin. You will only need to change two settings inside the config, add the proper kernel name, and remove the old initramfs source files directory. This directory doesn't exist locally. This is a remnant of upstream's build process.&lt;br /&gt;
&lt;br /&gt;
Follow the below tree structure, and make it equal to what is below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
General Setup -&amp;gt;&lt;br /&gt;
 (-std342-amd64) Local version - append to kernel release&lt;br /&gt;
 [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support  ()    Initramfs source file(s)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Local version above will end up making the kernel modules directory be 3.4.35-std342-amd64. The reason the kernel modules directory has to be equal to this is because our directory will be merged into the System Rescue CD later on, so the names need to be exactly the same so that the System Rescue CD system can find our kernel modules.&lt;br /&gt;
&lt;br /&gt;
If you want to build an srm (which you do), you also need to change the following inside the kernel config so that squashfs-tools can work later on:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
File Systems -&amp;gt;&lt;br /&gt;
Miscellaneous Filesystems -&amp;gt;&lt;br /&gt;
 &amp;lt;*&amp;gt;   SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  [*]     Squashfs XATTR support&lt;br /&gt;
  [*]     Include support for ZLIB compressed file systems&lt;br /&gt;
  [*]     Include support for LZO compressed file systems&lt;br /&gt;
  [*]     Include support for XZ compressed file systems&lt;br /&gt;
  [ ]     Use 4K device block size?&lt;br /&gt;
  [ ]     Additional option for memory-constrained systems&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now save and exit, and continue to build 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 modules_install&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancynote|If you have multiple cores, do a make -j&amp;lt;# of processors+1&amp;gt; to build faster. Example: '''make -j9''' for an 8 core machine.}}&lt;br /&gt;
&lt;br /&gt;
=== Using the overlay ===&lt;br /&gt;
Inside the overlay, there are ebuilds already prepared that will download the kernel, patch it, and perform any required substitutions. Afterwards you literally just go into your /usr/src/&amp;lt;kernel&amp;gt; directory, and run make. To see the available versions, run the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Versions available for standard kernel&lt;br /&gt;
# ##i##equery y -O std-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.4.37-r1 | o ~ o o o o o o o o o o o | o 3.4.37 | fearedbliss&lt;br /&gt;
&lt;br /&gt;
Versions available for alternate kernel&lt;br /&gt;
# ##i##equery y -O alt-sources&lt;br /&gt;
&lt;br /&gt;
[I]3.8.4 | o ~ o o o o o o o o o o o | o 3.8.4 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I haven't written the ebuilds in a way where it's easy to tell (at first glance) what System Rescue CD version you need. However, you can check the ebuild and you will see the version of the CD inside there. You can also check the chart above.&lt;br /&gt;
&lt;br /&gt;
If you wanted to install the standard kernel sources, you just emerge it like any other application:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge std-sources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the kernel and the kernel module are installed, you need to make the SRM.&lt;br /&gt;
&lt;br /&gt;
== Creating the SRM ==&lt;br /&gt;
It's time to gather the required files and pack them together in order for it to become an SRM. An SRM is nothing more than a directory that has been compressed with squashfs. Thankfully I've written a script that will build it for you, and you can install it from the overlay.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You also need to have spl, zfs, and zfs-kmod installed on your system before you try to make the srm. Emerging '''&amp;quot;bliss-initramfs&amp;quot;''' should automatically pull those packages. If it doesn't, make sure you install them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs srm&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You should now have the following directory layout inside the '''/opt/bliss-initramfs''' folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-initramfs # ls -l&lt;br /&gt;
total 117&lt;br /&gt;
-rw-r--r-- 1 root root 6718 May 23 18:05 CHANGES&lt;br /&gt;
-rw-r--r-- 1 root root  176 May 23 18:05 CREDITS&lt;br /&gt;
-rw-r--r-- 1 root root  431 May 23 18:05 HELP&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 23 18:05 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root 1852 May 23 18:05 README&lt;br /&gt;
-rw-r--r-- 1 root root 3194 May 23 18:05 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 2891 May 23 18:05 createInit&lt;br /&gt;
drwxr-xr-x 3 root root    4 May 23 18:11 files&lt;br /&gt;
drwxr-xr-x 3 root root    6 May 23 18:11 hooks&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 23 22:01 resources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then run the '''createInit''' script and follow the instructions for the kernel you want to make the srm for (In this case it's '''3.4.37-std350-amd64'''):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-----------------------------------&lt;br /&gt;
| Bliss Initramfs Creator - v1.8.1&lt;br /&gt;
| Author: Jonathan Vasquez &amp;lt;jvasquez1011@gmail.com&amp;gt;&lt;br /&gt;
| Distributed under the Simplified BSD License&lt;br /&gt;
-----------------------------------&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Which initramfs would you like to generate:&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS&lt;br /&gt;
&amp;gt;&amp;gt; 2. Encrypted ZFS (LUKS + ZFS)&lt;br /&gt;
&amp;gt;&amp;gt; 3. More Options&lt;br /&gt;
&amp;gt;&amp;gt; 4. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##3 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; More Options:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; 1. ZFS - System Rescue Module&lt;br /&gt;
&amp;gt;&amp;gt; 2. Back&lt;br /&gt;
&amp;gt;&amp;gt; 3. Exit Program&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Current choice [1]: ##i##↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating a ZFS System Rescue Module!&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Do you want to use the current kernel: 3.8.13-ALL? [Y/n]: ##i##n ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Please enter the kernel name: ##i##3.4.37-std350-amd64 ↵&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Detected 64 bit platform&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking to see if modules directory exists for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating SRMs for 3.4.37-std350-amd64...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating directory structure for initramfs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking preliminary binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Using ZFS&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Checking modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying binaries...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying documentation...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying udev rules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Compressing kernel modules...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Getting dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Copying dependencies...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Configuring files...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Creating and Packing SRMs...&lt;br /&gt;
&amp;gt;&amp;gt;&amp;gt; Complete :)&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you should have two new files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
-rw-r--r-- 1 root root 2068480 May 24 01:05 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rw-r--r-- 1 root root  483328 May 24 01:05 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now all you need to do is put those two files in the root of your USB directory.&lt;br /&gt;
&lt;br /&gt;
If you are making srms for both the standard and alternate kernels, you will end up with two zfs-core files and two zfs-kmod files (1 set for each kernel). You don't need to put the zfs-core that it makes for one of the kernels. The zfs-core srm only has zfs program binaries, man pages, udev rules, and a few other things. The zfs-kmod is the srm that has the kernel modules (and only the kernel modules). So you can easily just put two zfs-kmods (one for each kernel version) and just re-use the same zfs-core for both of them.&lt;br /&gt;
&lt;br /&gt;
== Using the prebuilt srm ==&lt;br /&gt;
&lt;br /&gt;
=== Download the SRM ===&lt;br /&gt;
If you didn't build your own srm and want to use the prebuilt one, just emerge '''&amp;quot;zfs-srm&amp;quot;''' from the overlay:&lt;br /&gt;
&lt;br /&gt;
(Instructions on [[Creating_System_Rescue_CD_ZFS_Modules#Adding_the_overlay|adding the overlay]] can be found at the top of this page)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge zfs-srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can check available versions just as you did above for the kernels:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Available versions of the zfs-srm&lt;br /&gt;
# ##i##equery y -O zfs-srm&lt;br /&gt;
&lt;br /&gt;
[I]3.5.0 | o ~ o o o o o o o o o o o | o 3.5.0 | fearedbliss&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(These versions match the version of the System Rescue CD).&lt;br /&gt;
&lt;br /&gt;
Installing the zfs-srm will automatically pull the '''&amp;quot;bliss-isomaker&amp;quot;''' package which is just a script that assists you with rebuilding the System Rescue CD ISO so that the ISO includes the ZFS srms. The script lets you make a bootable ISO or a bootable USB.&lt;br /&gt;
&lt;br /&gt;
Once it's installed, switch to the /opt/bliss-isomaker folder &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /opt/bliss-isomaker&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see a directory layout that looks similar to this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus bliss-isomaker # ls -l&lt;br /&gt;
total 100&lt;br /&gt;
drwxr-xr-x 2 root root    5 May 24 01:41 3.5.0&lt;br /&gt;
-rw-r--r-- 1 root root 1397 May 24 01:31 LICENSE&lt;br /&gt;
-rw-r--r-- 1 root root  312 May 24 01:31 README&lt;br /&gt;
-rw-r--r-- 1 root root  576 May 24 01:31 USAGE&lt;br /&gt;
-rwxr-xr-x 1 root root 3228 May 24 01:31 create&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 iso&lt;br /&gt;
drwxr-xr-x 2 root root    4 May 24 01:41 resources&lt;br /&gt;
drwxr-xr-x 2 root root    3 May 24 01:41 srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The layout is as follows:&lt;br /&gt;
* 3.5.0 - This folder contains the System Rescue CD 3.5.0 specific srms for both the standard and alternate kernel that were installed by emerge.&lt;br /&gt;
* create - A script to automatically recreate the system rescue cd iso or usb with the zfs stuff included&lt;br /&gt;
* iso - directory to place your system rescue cd iso in&lt;br /&gt;
* srm - directory that has the srms&lt;br /&gt;
* resources - the files in this folder contain function calls that the 'create' script uses. You don't need to worry about these.&lt;br /&gt;
&lt;br /&gt;
=== Installing the SRM ===&lt;br /&gt;
There are a few ways to do this, you can either use one of the scripts, or you can do it manually. Before anything, make sure to copy the SRMs from the &amp;lt;Version&amp;gt; folder to the srm folder if you are using a prebuilt one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp 3.5.0/* srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Generating a new iso ====&lt;br /&gt;
If you just want to remake a new iso so that you can burn onto a cd or use in a virtual machine, just copy your iso over to the iso directory, and run the 'create' script. The new iso will be located in the iso directory as well with a -zfs ending. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 1 (or iso) chooses to make an iso. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 1&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create iso 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Creating a fresh usb ====&lt;br /&gt;
If you want to have zfs on a usb with system rescue cd, put the iso in your iso dir, and then run the usb script. It will ask you what usb you want to format (This will delete everything), and then install system rescue cd onto it. Once that is done it will copy the zfs stuff over.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Running the script with 2 (or usb) chooses to make an usb. You can also pass the version as well.&lt;br /&gt;
# ##i##./create 2&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
# ##i##./create usb 3.5.0&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Manual installation onto a usb ====&lt;br /&gt;
Assuming that your installing to a flash drive and that the flash drive is mounted in /mnt&lt;br /&gt;
&lt;br /&gt;
1. Mount your usb drive&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mount /dev/sdX# /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Where X# is the letter and number of your device. Immediately after you plug your usb in, type `dmesg | tail` in the console and you should see it.'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Copy the zfs .srms to /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp zfs-core-3.4.37-std350-amd64.srm zfs-kmod-3.4.37-std350-amd64.srm zfs-kmod-3.8.4-alt350-amd64.srm /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. List your /mnt/usbstick directory and you should see something similar to the following in your /mnt/usbstick&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
octopus 3.5.0 # ls -l /mnt/usbstick&lt;br /&gt;
total 305028&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 boot&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootdisk&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 bootprog&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:51 efi&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 ntpasswd&lt;br /&gt;
-rwxr-xr-x 1 root root      2349 May 23 20:51 readme.txt&lt;br /&gt;
drwxr-xr-x 3 root root      4096 May 23 20:52 syslinux&lt;br /&gt;
-rwxr-xr-x 1 root root 309252096 May 23 20:51 sysrcd.dat&lt;br /&gt;
-rwxr-xr-x 1 root root        45 May 23 20:51 sysrcd.md5&lt;br /&gt;
drwxr-xr-x 2 root root      4096 May 23 20:51 usb_inst&lt;br /&gt;
-rwxr-xr-x 1 root root     15889 May 23 20:51 usb_inst.sh&lt;br /&gt;
-rwxr-xr-x 1 root root       877 May 23 20:51 usbstick.htm&lt;br /&gt;
-rwxr-xr-x 1 root root         6 May 23 20:51 version&lt;br /&gt;
-rwxr-xr-x 1 root root   2068480 May 23 20:51 zfs-core-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.4.37-std350-amd64.srm&lt;br /&gt;
-rwxr-xr-x 1 root root    483328 May 23 20:51 zfs-kmod-3.8.4-alt350-amd64.srm&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now un-mount your flash drive and boot it into the machine that you want to use ZFS on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##umount /mnt/usbstick&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Booting into the correct kernel ==&lt;br /&gt;
'''If you are using the standard srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
C) Standard 64bit kernel (rescue64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''If you are using the alternative srm:'''&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
E) Alternative 64bit kernel (altker64) with more choice... &amp;gt;&lt;br /&gt;
1. SystemRescueCd with default options&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Run 'depmod' so that the new modules can be seen by the kernel.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##depmod&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|You must run '''depmod'''. If you don't, then you will get failed to load the ZFS stack error! And after modprobe you can check with 'lsmod' if the 6 modules where loaded.}}&lt;br /&gt;
&lt;br /&gt;
5. Use ZFS as usual. If you type '''zpool status''' and then type `dmesg | tail`,&lt;br /&gt;
&lt;br /&gt;
you should see something that says:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
ZFS: Loaded module v0.6.1-1, ZFS pool version 5000, ZFS filesystem version 5&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see the above, then the modules loaded successfully!&lt;br /&gt;
&lt;br /&gt;
Enjoy System Rescue CD with ZFS :)&lt;br /&gt;
&lt;br /&gt;
== Extra ==&lt;br /&gt;
&lt;br /&gt;
=== A more accurate kernel build setup ===&lt;br /&gt;
If you want to have a more accurate setup to upstream, you can check out the git repo he has for the target release. Example: [http://sourceforge.net/p/systemrescuecd/code/ci/74e7a9712a019958fbe099386c9fb6bd7813d907/tree/ Upstream Git Repo]&lt;br /&gt;
&lt;br /&gt;
If you navigate to portage-overlay/sys-kernel/std-sources, you can see the ebuild there and the files directory with the patches for the std-sources kernel.&lt;br /&gt;
&lt;br /&gt;
I also keep my own modified ebuilds for when I make my own srms in my overlay:&lt;br /&gt;
https://github.com/fearedbliss/funtoo-overlay&lt;br /&gt;
&lt;br /&gt;
You can see the ebuilds in the sys-kernel/std-sources directory.&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Fearedbliss</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-06-09T06:34:23Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: &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.5.0 (390 MiB)&lt;br /&gt;
Release Date: 2013-03-25&lt;br /&gt;
md5sum 48552b9e905872bd5061eb112b73ea20&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.5.0.iso Download System Rescue CD 3.5.0]&amp;lt;br /&amp;gt;&lt;br /&gt;
[http://ftp.osuosl.org/pub/funtoo/distfiles/sysrescuecd/zfs-3.4.37-std350-amd64_0.6.1.tar.xz 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;
We will be showing you how to partition it '''manually''' because if you partition it manually you get to create your own layout, you get to have your own separate /boot partition (Which is nice since not every bootloader supports booting from ZFS pools), and you get to boot into RAID10, RAID5 (RAIDZ) pools and any other layouts due to you having a separate /boot partition.&lt;br /&gt;
&lt;br /&gt;
==== fdisk (MBR Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command (m for help): ##i##o ↵&lt;br /&gt;
Building a new DOS disklabel with disk identifier 0xbeead864.&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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;
==== gdisk (GPT Style) ====&lt;br /&gt;
&lt;br /&gt;
'''A Fresh Start''':&lt;br /&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;
&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;
&lt;br /&gt;
{{fancywarning|This is a destructive operation. Make sure you really don't want anything on this disk.}}&lt;br /&gt;
&lt;br /&gt;
Now that we have a clean drive, we will create the new layout.&lt;br /&gt;
&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 3''' (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##bf00 ↵&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          579583   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          579584      1953525134   931.2 GiB   BF00  Solaris root&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;
Format your separate /boot partition:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##mkfs.ext2 /dev/sda1&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Encryption (Optional) ===&lt;br /&gt;
If you want encryption, then create your encrypted vault(s) now by doing the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cryptsetup -c aes-xts-plain64 luksFormat /dev/sda2&lt;br /&gt;
# ##i##cryptsetup luksOpen /dev/sda2 vault_1&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''.}}&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;
&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;
&lt;br /&gt;
{{fancyimportant|If you followed the manual GPT partitioning instructions, you should change '''/dev/sda2 to /dev/sda3'''. If you are using encrypted root, then change '''/dev/sda2 to vault_1'''.}}&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 -f -R /mnt/funtoo &amp;lt;pool_name&amp;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). &lt;br /&gt;
&lt;br /&gt;
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;
'''Make your swap +1G greater than your RAM. An 8G machine would have 9G of SWAP (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;
&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&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;
&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;
&lt;br /&gt;
Sync your 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 kernels 2.6.32 - 3.9.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;- Linux Kernel&lt;br /&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;
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;
  # Only if you want to make an SRM&lt;br /&gt;
  &amp;gt; File systems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt; Miscellaneous filesystems ---&amp;gt;&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; &amp;lt;*&amp;gt; SquashFS 4.0 - Squashed file system support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Squashfs XATTR support&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for ZLIB compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for LZO compressed file systems&lt;br /&gt;
  &amp;gt;&amp;gt;&amp;gt; [*] Include support for XZ compressed file systems&lt;br /&gt;
&lt;br /&gt;
* All other drivers required to see your PATA/SATA drives must be compiled in.&lt;br /&gt;
&lt;br /&gt;
- app-arch/cpio&lt;br /&gt;
- sys-apps/busybox&lt;br /&gt;
- sys-kernel/spl&lt;br /&gt;
- sys-fs/zfs&lt;br /&gt;
- sys-fs/zfs-kmod&lt;br /&gt;
&lt;br /&gt;
For SRM creation:&lt;br /&gt;
- sys-fs/squashfs-tools&lt;br /&gt;
&lt;br /&gt;
For LUKS support:&lt;br /&gt;
- sys-fs/cryptsetup&lt;br /&gt;
&lt;br /&gt;
- Linux Kernel&lt;br /&gt;
Device Drivers ---&amp;gt;&lt;br /&gt;
  [*] Multiple devices driver support (RAID and LVM) ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; Device mapper support&lt;br /&gt;
  &amp;lt;*&amp;gt; Crypt target support&lt;br /&gt;
&lt;br /&gt;
  Cryptographic API ---&amp;gt;&lt;br /&gt;
  &amp;lt;*&amp;gt; XTS support&lt;br /&gt;
  -*- AES cipher algorithms&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;# ##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.&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;
== Install the bootloader ==&lt;br /&gt;
&lt;br /&gt;
=== GRUB 2 ===&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;
&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;
&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;
&lt;br /&gt;
=== Create a boot symlink ===&lt;br /&gt;
We will create a boot symlink so that we can have &amp;quot;consistent&amp;quot; boot configurations without any errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /boot&lt;br /&gt;
# ##i##ln -s . boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now have a symlink called 'boot' inside /boot that points to /boot :).&lt;br /&gt;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
pool name is: rpool&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''genkernel entries need verification'''&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /boot/vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
        initrd /boot/initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you followed the way to set up a separate partition to boot of (/dev/sda1 in this guid) you need to modify the entries in your grub.cfg, since grub will now not search inside zfs: &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.8.5&amp;quot; {  &lt;br /&gt;
  insmod zfs&lt;br /&gt;
  linux /vmlinuz-3.8.5-ALL real_root=ZFS=rpool/ROOT/funtoo dozfs=force&lt;br /&gt;
  initrd /initramfs-genkernel-x86_64-3.8.5-ALL&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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.8.5-ALL&lt;br /&gt;
  KERNEL /boot/vmlinuz-3.8.5-ALL&lt;br /&gt;
  INITRD /boot/initramfs-genkernel-x86_64-3.8.5-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;
&lt;br /&gt;
=== Bliss Initramfs Creator ===&lt;br /&gt;
I've written an ebuild to install the creator for you on your machine. The ebuild is in my overlay so we will first add my overlay to your machine. &lt;br /&gt;
&lt;br /&gt;
First we will clone it to a directory on your machine, let's say &amp;quot;/home/example/overlays/fearedbliss&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# Make the overlays directory if it doesn't exist&lt;br /&gt;
# ##i##mkdir /home/example/overlays&lt;br /&gt;
&lt;br /&gt;
# Clone my overlay into this directory&lt;br /&gt;
# ##i##git clone git://github.com/fearedbliss/funtoo-overlay.git&lt;br /&gt;
&lt;br /&gt;
# Rename the &amp;quot;funtoo-overlay&amp;quot; folder to &amp;quot;fearedbliss&amp;quot;&lt;br /&gt;
# ##i##mv funtoo-overlay fearedbliss&lt;br /&gt;
&lt;br /&gt;
# Add the overlay to your /etc/portage/make.conf so portage knows its existence.&lt;br /&gt;
# ##i##echo 'PORTDIR_OVERLAY=&amp;quot;/home/example/overlays/fearedbliss ${PORTDIR_OVERLAY}&amp;quot;' &amp;gt;&amp;gt; /etc/portage/make.conf&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you can install the creator, but before we do that, if you are encrypting your drives, then add the &amp;quot;luks&amp;quot; use flag to your package.use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##echo &amp;quot;sys-kernel/bliss-initramfs luks&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now install the creator:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge bliss-initramfs&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then go into the install directory, run the script as root, and place it into /boot:&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /opt/bliss-initramfs&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;
&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.8.5-ALL&lt;br /&gt;
initramfs name is: initrd-3.8.5-ALL.img&lt;br /&gt;
/boot partition is: /dev/sda1 (on GPT)&lt;br /&gt;
Encrypted partitions (If any, example: /dev/sda2, /dev/sdb3, /dev/sdc4)&lt;br /&gt;
Pool root is: rpool/ROOT/funtoo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&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.8.5&amp;quot; {&lt;br /&gt;
        insmod part_gpt&lt;br /&gt;
        insmod ext2&lt;br /&gt;
&lt;br /&gt;
        set root=(hd0,gpt1)&lt;br /&gt;
&lt;br /&gt;
        linux /boot/vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo quiet&lt;br /&gt;
        # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
        # linux /boot/vmlinuz-3.8.5-ALL root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
        initrd /boot/initrd-3.8.5-ALL.img&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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.8.5-ALL  &lt;br /&gt;
  KERNEL /boot/vmlinuz-3.8.5-ALL  &lt;br /&gt;
  INITRD /boot/initrd-3.8.5-ALL.img  &lt;br /&gt;
  APPEND root=rpool/ROOT/funtoo quiet&lt;br /&gt;
  # Let's say you have 3 drives that are encrypted, and your pool (which also contains your root) is on here&lt;br /&gt;
  # APPEND root=rpool/ROOT/funtoo enc_root=/dev/sda2,/dev/sdb3,/dev/sdc4 quiet&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&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           ext2            defaults        0 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;
[[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>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Funtoo_Linux_Installation</id>
		<title>Funtoo Linux Installation</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Funtoo_Linux_Installation"/>
				<updated>2013-06-09T06:31:40Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: /* Notes Before We Begin */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This document briefly explains all of the steps required to set up a typical Funtoo Linux installation on a &amp;quot;PC compatible&amp;quot; computer system. If you've had previous experience installing Gentoo Linux then a lot of steps will be familiar, but you should still read through as there are a few differences.&lt;br /&gt;
&lt;br /&gt;
=== Additional Resources === &lt;br /&gt;
&lt;br /&gt;
This document was written to help you install Funtoo Linux as efficiently as possible, with a minimum number of distracting options regarding system configuration. &lt;br /&gt;
&lt;br /&gt;
Those who prefer a longer, more thorough tutorial-style installation may want to check out our beta [[Installation (Tutorial)|Installation Tutorial]] instead. It explores more installation possibilities and options such as encrypted filesystems, and includes screenshots.&lt;br /&gt;
&lt;br /&gt;
If you are installing Funtoo Linux on [[Funtoo Linux Installation on ARM|ARM]] architecture, please see [[Funtoo Linux Installation on ARM]] for notable differences regarding ARM support. An experimental Funtoo Linux build also exists for [[Funtoo Linux Installation on SPARC|SPARC]] platforms. See [[Funtoo Linux Installation on SPARC]]&lt;br /&gt;
&lt;br /&gt;
== Installation Overview ==&lt;br /&gt;
&lt;br /&gt;
This is a basic overview of the Funtoo installation process:&lt;br /&gt;
&lt;br /&gt;
# [[#Live CD|Download and boot the live CD of your choice]].&lt;br /&gt;
# [[#Prepare Hard Disk|Prepare your disk]].&lt;br /&gt;
# [[#Creating filesystems|Create]] and [[#Mounting filesystems|mount]] filesystems.&lt;br /&gt;
# [[#Installing the Stage 3 tarball|Install the Funtoo stage tarball]] of your choice.&lt;br /&gt;
# [[#Chroot into Funtoo|Chroot into your new system]].&lt;br /&gt;
# [[#Downloading the Portage tree|Download the Portage tree]].&lt;br /&gt;
# [[#Configuring your system|Configure your system]] and [[#Configuring your network|network]].&lt;br /&gt;
# [[#Configuring and installing the Linux kernel|Install a kernel]].&lt;br /&gt;
# [[#Installing a Bootloader|Install a bootloader]].&lt;br /&gt;
# [[#Finishing Steps|Complete final steps]].&lt;br /&gt;
# [[#Restart your system|Reboot and enjoy]].&lt;br /&gt;
&lt;br /&gt;
=== Live CD ===&lt;br /&gt;
Funtoo doesn't provide an &amp;quot;official&amp;quot; Funtoo Live CD, but there are plenty of good ones out there to choose from. A great choice is the Gentoo-based [http://www.sysresccd.org/ SystemRescueCd] as it contains lots of tools and utilities and supports both 32-bit and 64-bit systems.&lt;br /&gt;
&lt;br /&gt;
It is also possible to install Funtoo Linux using many other Linux-based live CDs. Generally, any modern bootable Linux live CD or live USB media will work. See [[Requirements|requirements]] for an overview of what the Live Media must provide to allow a problem-free install of Funtoo Linux.&lt;br /&gt;
&lt;br /&gt;
To begin a Funtoo Linux installation, download SystemRescueCD from:&lt;br /&gt;
&lt;br /&gt;
* Main US mirror: [http://ftp.osuosl.org/pub/funtoo/distfiles/sysrescuecd/systemrescuecd-x86-3.4.2.iso The Oregon State University Open Source Lab]&lt;br /&gt;
* Main EU mirror: [http://ftp.heanet.ie/mirrors/funtoo/distfiles/sysrescuecd/systemrescuecd-x86-3.4.2.iso HEAnet] or use your preferred live media. Insert it into your disc drive, and boot from it. If using an older version of SystemRescueCd, '''be sure to select the &amp;lt;tt&amp;gt;rescue64&amp;lt;/tt&amp;gt; kernel at the boot menu if you are installing a 64-bit system'''. By default, SystemRescueCd used to boot in 32-bit mode though the latest version attempts to automatically detect 64-bit processors.&lt;br /&gt;
&lt;br /&gt;
=== Prepare Hard Disk ===&lt;br /&gt;
==== Partitions ====&lt;br /&gt;
&lt;br /&gt;
Funtoo Linux fully supports traditional MBR partitions, as well as newer GPT/GUID partition formats. Funtoo Linux recommends the use of the GPT partitioning scheme, since it is newer and more flexible. Here are the various trade-offs between each partitioning scheme:&lt;br /&gt;
&lt;br /&gt;
===== GPT Partitions =====&lt;br /&gt;
&lt;br /&gt;
* Newer, preferred format for Linux systems&lt;br /&gt;
* Supports 2 TB+ hard drives for booting&lt;br /&gt;
* Supports hundreds of partitions per disk of any size&lt;br /&gt;
* Requires legacy BIOS boot partition (~32 MB) to be created if system does not use EFI&lt;br /&gt;
* Requires bootloader with support for GPT such as GRUB 2, EXTLINUX, or a patched version of GRUB Legacy&lt;br /&gt;
&lt;br /&gt;
===== MBR Partitions =====&lt;br /&gt;
&lt;br /&gt;
* Legacy, DOS partitioning scheme&lt;br /&gt;
* Only 4 primary partitions per disk; after that, you must use &amp;quot;logical&amp;quot; partitions&lt;br /&gt;
* Does not support 2 TB+ disks for booting&lt;br /&gt;
* Compatible with certain problematic systems (such as the HP ProBook 4520)&lt;br /&gt;
* Dual-boot with Windows for BIOS systems (Windows handle GPT only on true EFI systems, whatever version it is)&lt;br /&gt;
* Multiple boot loader options, e.g. GRUB 2, GRUB Legacy, lilo&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you plan to use partitions of 2 TB or greater, you ''must'' partition using the GPT/GUID format. Also note that there are small percentage of PCs that will not boot properly with GPT. For these systems, using MBR partitions or a primary drive with an MBR partition may be required in order to boot.}}&lt;br /&gt;
&lt;br /&gt;
==== Partitioning Using gdisk ====&lt;br /&gt;
&lt;br /&gt;
===== Notes Before We Begin =====&lt;br /&gt;
&lt;br /&gt;
These install instructions assume you are installing Funtoo Linux to an empty hard disk using GUID partition tables (GPT). If you are installing Funtoo Linux on a machine where another OS is installed, or there is an existing Linux distribution on your system that you want to keep, then you will need to adapt these instructions to suit your needs.&lt;br /&gt;
&lt;br /&gt;
If you are going to create a legacy MBR partition table instead of GUID/GPT, you will use the &amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt; command instead of &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;, and you will not need to create the GRUB boot loader partition. See the table under [[#Partitioning Recommendations|Partitioning Recommendations]], in particular the &lt;br /&gt;
'''MBR Block Device (&amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt;)''' and '''MBR Code''' columns. &amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt; works just like &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;, but creates legacy MBR partition tables instead of the newer GPT/GUID partition tables.&lt;br /&gt;
&lt;br /&gt;
Advanced users may be interested in the following topics:&lt;br /&gt;
&lt;br /&gt;
* [[GUID Booting Guide]]&lt;br /&gt;
* [[Rootfs over encrypted lvm]]&lt;br /&gt;
* [[Rootfs over encrypted lvm over raid-1 on GPT]]&lt;br /&gt;
* '''NEW!''' '''[[ZFS Install Guide]] (Also contains instructions for Rootfs over Encrypted ZFS!)'''&lt;br /&gt;
&lt;br /&gt;
===== Using gdisk =====&lt;br /&gt;
&lt;br /&gt;
The first step after booting SystemRescueCd is to use &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt; to create GPT (also known as GUID) partitions, specifying the disk you want to use, which is typically &amp;lt;tt&amp;gt;/dev/sda&amp;lt;/tt&amp;gt;, the first disk in the system:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##gdisk /dev/sda&amp;lt;/console&amp;gt;&lt;br /&gt;
You should find &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt; very similar to &amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt;. Here is the partition table we want to end up with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;Command (? for help): ##i##p&lt;br /&gt;
Disk /dev/sda: 234441648 sectors, 111.8 GiB&lt;br /&gt;
Logical sector size: 512 bytes&lt;br /&gt;
Disk identifier (GUID): A4E5208A-CED3-4263-BB25-7147DC426931&lt;br /&gt;
Partition table holds up to 128 entries&lt;br /&gt;
First usable sector is 34, last usable sector is 234441614&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          206847   500.0 MiB   8300  Linux filesystem&lt;br /&gt;
   2          206848          272383   32.0 MiB    EF02  BIOS boot partition&lt;br /&gt;
   3          272384         8660991   4.0 GiB     8200  Linux swap&lt;br /&gt;
   4         8660992       234441614   107.7 GiB   8300  Linux filesystem&lt;br /&gt;
&lt;br /&gt;
Command (? for help): &amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Above, you'll see that we have a 500 MiB boot partition, a 32 MiB &amp;quot;BIOS boot partition&amp;quot; (also known as the GRUB boot loader partition), 4 GiB of swap, and the remaining disk used by a 107.7 GiB root partition.&lt;br /&gt;
&lt;br /&gt;
===== For new &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt; users =====&lt;br /&gt;
&lt;br /&gt;
These partitions were created using the &amp;quot;&amp;lt;tt&amp;gt;n&amp;lt;/tt&amp;gt;&amp;quot; command from within &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;. The &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt; commands to create the partition table above are as follows. Adapt sizes as necessary, although these defaults will work for most users. The partition codes entered below can be found in the [[#Partitioning Recommendations|Partitioning Recommendations]] table below, in the GPT Code column.&lt;br /&gt;
&lt;br /&gt;
Within &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;, follow these steps:&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##1 ↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+500M ↵&lt;br /&gt;
Hex Code: ##i##↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 2''' (GRUB):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##2 ↵&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;
'''Create Partition 3''' (swap):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##3 ↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##+4G ↵&lt;br /&gt;
Hex Code: ##i##8200 ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Create Partition 4''' (root):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##n ↵&lt;br /&gt;
Partition Number: ##i##4 ↵&lt;br /&gt;
First sector: ##i##↵&lt;br /&gt;
Last sector: ##i##↵##!i## (for rest of disk)&lt;br /&gt;
Hex Code: ##i##↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Along the way, you can type &amp;quot;&amp;lt;tt&amp;gt;p&amp;lt;/tt&amp;gt;&amp;quot; and hit Enter to view your current partition table. If you make a mistake, you can type &amp;quot;&amp;lt;tt&amp;gt;d&amp;lt;/tt&amp;gt;&amp;quot; to delete an existing partition that you created. When you are satisfied with your partition setup, type &amp;quot;&amp;lt;tt&amp;gt;w&amp;lt;/tt&amp;gt;&amp;quot; to write your configuration to disk:&lt;br /&gt;
&lt;br /&gt;
'''Write Partition Table To Disk''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
Command: ##i##w ↵&lt;br /&gt;
Do you want to proceed? (Y/N): ##i##Y ↵&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The partition table will now be written to disk and &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt; will close.&lt;br /&gt;
&lt;br /&gt;
Now, your GPT/GUID partitions have been created, and will show up as the following ''block devices'' under Linux:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;/dev/sda1&amp;lt;/tt&amp;gt;, which will be used to hold the &amp;lt;tt&amp;gt;/boot&amp;lt;/tt&amp;gt; filesystem, &lt;br /&gt;
* &amp;lt;tt&amp;gt;/dev/sda2&amp;lt;/tt&amp;gt;, which will be used directly by the new GRUB,&lt;br /&gt;
* &amp;lt;tt&amp;gt;/dev/sda3&amp;lt;/tt&amp;gt;, which will be used for swap space, and &lt;br /&gt;
* &amp;lt;tt&amp;gt;/dev/sda4&amp;lt;/tt&amp;gt;, which will hold your root filesystem.&lt;br /&gt;
&lt;br /&gt;
===== For Previous fdisk users =====&lt;br /&gt;
&lt;br /&gt;
If you have installed Gentoo Linux before, the one thing that is likely new to you here is the GRUB boot loader partition, which is listed as &amp;quot;BIOS boot partition&amp;quot; within &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;. This partition is required for GRUB 2 to boot GPT/GUID boot disks. What is it? In GRUB-speak, this partition is essentially the location of the meat of GRUB's boot loading code. If you've used GRUB Legacy in the past, this partition is where the new GRUB stores the equivalent of the &amp;lt;tt&amp;gt;stage1_5&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;stage2&amp;lt;/tt&amp;gt; files in legacy GRUB. Since GPT-based partition tables have less dead space at the beginning of the disk than their MBR equivalents, an explicitly defined partition of code &amp;lt;tt&amp;gt;EF02&amp;lt;/tt&amp;gt; is required to hold the guts of the boot loader.&lt;br /&gt;
&lt;br /&gt;
In all other respects, the partition table is similar to that which you might create for an MBR-based disk during a Gentoo Linux installation. We have a boot and a root partition with code &amp;lt;tt&amp;gt;0700&amp;lt;/tt&amp;gt;, and a Linux swap partition with code &amp;lt;tt&amp;gt;8200&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===== Partitioning Recommendations =====&lt;br /&gt;
&lt;br /&gt;
Below are our partitioning recommendations in table form. For GPT-based partitions, use the GPT Block Device and GPT Code columns with &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;. For legacy MBR-based partitions, use the MBR Block Device and MBR code columns with &amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{| {{table}} &lt;br /&gt;
!Partition&lt;br /&gt;
!Size&lt;br /&gt;
!MBR Block Device (&amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt;)&lt;br /&gt;
!GPT Block Device (&amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt;)&lt;br /&gt;
!Filesystem&lt;br /&gt;
!MBR Code&lt;br /&gt;
!GPT Code&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;/boot&amp;lt;/tt&amp;gt;&lt;br /&gt;
|500 MB&lt;br /&gt;
|&amp;lt;tt&amp;gt;/dev/sda1&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&amp;lt;tt&amp;gt;/dev/sda1&amp;lt;/tt&amp;gt;&lt;br /&gt;
|ext2&lt;br /&gt;
|83&lt;br /&gt;
|8300&lt;br /&gt;
|-&lt;br /&gt;
|GRUB boot loader partition&lt;br /&gt;
|32 MB&lt;br /&gt;
| ''not required for MBR''&lt;br /&gt;
|&amp;lt;tt&amp;gt;/dev/sda2&amp;lt;/tt&amp;gt;&lt;br /&gt;
|For GPT/GUID only, skip for MBR - no filesystem.&lt;br /&gt;
|''N/A''&lt;br /&gt;
|EF02&lt;br /&gt;
|-&lt;br /&gt;
|swap&lt;br /&gt;
|2x RAM for low-memory systems and production servers; otherwise 2GB.&lt;br /&gt;
|&amp;lt;tt&amp;gt;/dev/sda2&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&amp;lt;tt&amp;gt;/dev/sda3&amp;lt;/tt&amp;gt;&lt;br /&gt;
|swap (default)&lt;br /&gt;
|82&lt;br /&gt;
|8200&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;/&amp;lt;/tt&amp;gt; (root)&lt;br /&gt;
|Rest of the disk, minimum of 10GB.&lt;br /&gt;
|&amp;lt;tt&amp;gt;/dev/sda3&amp;lt;/tt&amp;gt;&lt;br /&gt;
|&amp;lt;tt&amp;gt;/dev/sda4&amp;lt;/tt&amp;gt;&lt;br /&gt;
|XFS recommended, alternatively ext4&lt;br /&gt;
|83&lt;br /&gt;
|8300&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;/home&amp;lt;/tt&amp;gt; (optional)	&lt;br /&gt;
|User storage and media. Typically most of the disk.&lt;br /&gt;
|&amp;lt;tt&amp;gt;/dev/sda4&amp;lt;/tt&amp;gt; (if created)&lt;br /&gt;
|&amp;lt;tt&amp;gt;/dev/sda5&amp;lt;/tt&amp;gt; (if created)&lt;br /&gt;
|XFS recommended, alternatively ext4&lt;br /&gt;
|83&lt;br /&gt;
|8300&lt;br /&gt;
|-&lt;br /&gt;
| LVM (optional)&lt;br /&gt;
| If you want to create an LVM volume.&lt;br /&gt;
| &amp;lt;tt&amp;gt;/dev/sda4&amp;lt;/tt&amp;gt; (PV, if created)&lt;br /&gt;
| &amp;lt;tt&amp;gt;/dev/sda5&amp;lt;/tt&amp;gt; (PV, if created)&lt;br /&gt;
| LVM PV&lt;br /&gt;
| 8E&lt;br /&gt;
| 8E00&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Creating filesystems ====&lt;br /&gt;
&lt;br /&gt;
Before your newly-created partitions can be used, the block devices need to be initialized with filesystem ''metadata''. This process is known as ''creating a filesystem'' on the block devices. After filesystems are created on the block devices, they can be mounted and used to store files.&lt;br /&gt;
&lt;br /&gt;
You will not create a filesystem on your swap partition, but will initialize it using the &amp;lt;tt&amp;gt;mkswap&amp;lt;/tt&amp;gt; command so that it can be used as disk-based virtual memory. Then we'll run the &amp;lt;tt&amp;gt;swapon&amp;lt;/tt&amp;gt; command to make your newly-initialized swap space active within the live CD environment, in case it is needed during the rest of the install process.&lt;br /&gt;
&lt;br /&gt;
Note that we will not create a filesystem on the GRUB boot loader partition, as GRUB writes binary data directly to that partition when the boot loader is installed, which we'll do later.&lt;br /&gt;
&lt;br /&gt;
You can see the commands you will need to type below. Like the rest of this document, it assumes that you are using a GPT partitioning scheme. If you are using MBR, your root filesystem will likely be created on &amp;lt;tt&amp;gt;/dev/sda3&amp;lt;/tt&amp;gt; instead and you will need to adjust the target block devices. If you are following our recommendations, then simply do this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mke2fs -t ext2 /dev/sda1 &lt;br /&gt;
# ##i##mkfs.xfs /dev/sda4&lt;br /&gt;
# ##i##mkswap /dev/sda3&lt;br /&gt;
# ##i##swapon /dev/sda3&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Mounting filesystems ====&lt;br /&gt;
&lt;br /&gt;
Mount the newly-created filesystems as follows, creating &amp;lt;tt&amp;gt;/mnt/funtoo&amp;lt;/tt&amp;gt; as the installation mount point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkdir /mnt/funtoo&lt;br /&gt;
# ##i##mount /dev/sda4 /mnt/funtoo&lt;br /&gt;
# ##i##mkdir /mnt/funtoo/boot&lt;br /&gt;
# ##i##mount /dev/sda1 /mnt/funtoo/boot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Optionally, if you have a separate filesystem for &amp;lt;tt&amp;gt;/home&amp;lt;/tt&amp;gt; or anything else:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##mkdir /mnt/funtoo/home&lt;br /&gt;
# ##i##mount /dev/sda5 /mnt/funtoo/home&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;/var/tmp&amp;lt;/tt&amp;gt; on a separate filesystem, be sure to change the permissions of the mount point to be globally-writeable after mounting, as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##chmod 1777 /mnt/funtoo/tmp&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Installing the Stage 3 tarball ===&lt;br /&gt;
==== Stage 3 tarball ====&lt;br /&gt;
&lt;br /&gt;
After creating filesystems, the next step is downloading the initial Stage 3 tarball. The Stage 3 is a pre-compiled system used as a starting point to install Funtoo Linux. Visit the [[Download]] page and copy the URL to the Stage 3 tarball you want to use. We will download it soon.&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If your system's date and time are too far off (typically by months or years,) then it may prevent Portage from properly downloading source tarballs. This is because some of our sources are downloaded via HTTPS, which use SSL certificates and are marked with an activation and expiration date.}}&lt;br /&gt;
&lt;br /&gt;
Now is a good time to verify the date and time are correctly set to UTC. Use the &amp;lt;tt&amp;gt;date&amp;lt;/tt&amp;gt; command to verify the date and time:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##date&lt;br /&gt;
Fri Jul 15 19:47:18 UTC 2011&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the date and/or time need to be corrected, do so using &amp;lt;tt&amp;gt;date MMDDhhmmYYYY&amp;lt;/tt&amp;gt;, keeping in mind &amp;lt;tt&amp;gt;hhmm&amp;lt;/tt&amp;gt; are in 24-hour format. The example below changes the date and time to &amp;quot;July 16th, 2011 @ 8:00PM&amp;quot; UTC:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##date 071620002011&lt;br /&gt;
Fri Jul 16 20:00:00 UTC 2011&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you are in your Funtoo Linux root filesystem, use &amp;lt;tt&amp;gt;wget&amp;lt;/tt&amp;gt; to download the Stage 3 tarball you have chosen from the [[Download]] page to use as the basis for your new Funtoo Linux system. It should be saved to the &amp;lt;tt&amp;gt;/mnt/funtoo&amp;lt;/tt&amp;gt; directory as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;# ##i##cd /mnt/funtoo&lt;br /&gt;
# ##i##wget http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/generic_64/stage3-latest.tar.xz&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that 64-bit systems can run 32-bit or 64-bit stages, but 32-bit systems can only run 32-bit stages. Make sure that you select a Stage 3 build that is appropriate for your CPU. If you are not certain, it is a safe bet to choose the &amp;lt;tt&amp;gt;generic_64&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;generic_32&amp;lt;/tt&amp;gt; stage. Consult the [[Download]] page for more information.&lt;br /&gt;
&lt;br /&gt;
Once the stage is downloaded, extract the contents with the following command, substituting in the actual name of your stage 3 tarball:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##tar xJpf stage3-latest.tar.xz&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|It is very important to use &amp;lt;tt&amp;gt;tar&amp;lt;/tt&amp;gt;'s &amp;quot;&amp;lt;tt&amp;gt;p&amp;lt;/tt&amp;gt;&amp;quot; option when extracting the Stage 3 tarball - it tells &amp;lt;tt&amp;gt;tar&amp;lt;/tt&amp;gt; to ''preserve'' any permissions and ownership that exist within the archive. Without this option, your Funtoo Linux filesystem permissions will be incorrect.}}&lt;br /&gt;
&lt;br /&gt;
=== Chroot into Funtoo ===&lt;br /&gt;
Before chrooting into your new system, there's a few things that need to be done first. You will need to mount /proc and /dev inside your new system. Use the following commands:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cd /mnt/funtoo&lt;br /&gt;
# ##i##mount --rbind /proc proc&lt;br /&gt;
# ##i##mount --rbind /dev dev&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You'll also want to copy over &amp;lt;tt&amp;gt;resolv.conf&amp;lt;/tt&amp;gt; in order to have proper DNS name resolution from inside the chroot:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##cp /etc/resolv.conf etc&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you can chroot into your new system. Use &amp;lt;tt&amp;gt;env&amp;lt;/tt&amp;gt; before &amp;lt;tt&amp;gt;chroot&amp;lt;/tt&amp;gt; to ensure that no environment variables from the installation media are used by your new system:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&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;
{{fancynote|Users of live CDs with 64-bit kernels: Some software may use &amp;lt;tt&amp;gt;uname -r&amp;lt;/tt&amp;gt; to check whether the system is 32 or 64-bit. You may want append linux32 to the chroot command as a workaround, but it's generally not needed.}}&lt;br /&gt;
{{fancyimportant|If you receive the error &amp;quot;&amp;lt;tt&amp;gt;chroot: failed to run command `/bin/bash': Exec format error&amp;lt;/tt&amp;gt;&amp;quot;, it is probably because you are running a 32-bit kernel and trying to execute 64-bit code. SystemRescueCd boots with a 32-bit kernel by default.}}&lt;br /&gt;
&lt;br /&gt;
It's also a good idea to change the default command prompt while inside the chroot. This will avoid confusion if you have to change terminals. Use this command:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##export PS1=&amp;quot;(chroot) $PS1&amp;quot;&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! You are now chrooted inside a Funtoo Linux system. Now it's time to get Funtoo Linux properly configured so that Funtoo Linux will boot successfully when your system is restarted.&lt;br /&gt;
&lt;br /&gt;
=== Downloading the Portage tree ===&lt;br /&gt;
&lt;br /&gt;
{{fancynote|For an alternative way to do this, see [[Installing Portage From Snapshot]].}}&lt;br /&gt;
Now it's time to install a copy of the Portage repository, which contains package scripts (ebuilds) that tell portage how to build and install thousands of different software packages. To create the Portage repository, simply run &amp;lt;tt&amp;gt;emerge --sync&amp;lt;/tt&amp;gt; from within the chroot. This will automatically clone the portage tree from [http://github.com/ GitHub]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i##emerge --sync&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|If you receive the error with initial &amp;lt;tt&amp;gt;emerge --sync&amp;lt;/tt&amp;gt; due to git protocol restrictions, change &amp;lt;tt&amp;gt;SYNC&amp;lt;/tt&amp;gt; variable in &amp;lt;tt&amp;gt;/etc/portage/make.conf&amp;lt;/tt&amp;gt;}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SYNC=&amp;quot;https://github.com/funtoo/ports-2012.git&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Configuring your system ===&lt;br /&gt;
As is expected from a Linux distribution, Funtoo Linux has its share of configuration files. The one file you are absolutely required to edit in order to ensure that Funtoo Linux boots successfully is &amp;lt;tt&amp;gt;/etc/fstab&amp;lt;/tt&amp;gt;. The others are optional. Here are a list of files that you should consider editing:&lt;br /&gt;
&lt;br /&gt;
{| {{table}}&lt;br /&gt;
!File&lt;br /&gt;
!Do I need to change it?&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;/etc/fstab&amp;lt;/tt&amp;gt;&lt;br /&gt;
|'''YES - required'''&lt;br /&gt;
|Mount points for all filesystems to be used at boot time. This file must reflect your disk partition setup. We'll guide you through modifying this file below.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;/etc/localtime&amp;lt;/tt&amp;gt;&lt;br /&gt;
|''Maybe - recommended''&lt;br /&gt;
|Your timezone, which will default to UTC if not set. This should be a symbolic link to something located under /usr/share/zoneinfo (e.g. /usr/share/zoneinfo/America/Montreal) &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;/etc/make.conf&amp;lt;br/&amp;gt;/etc/portage/make.conf&amp;amp;nbsp;(new&amp;amp;nbsp;location)&amp;lt;/tt&amp;gt;&lt;br /&gt;
|''Maybe - recommended''&lt;br /&gt;
|Parameters used by gcc (compiler), portage, and make. It's a good idea to set MAKEOPTS. This is covered later in this document.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;/etc/conf.d/hostname&amp;lt;/tt&amp;gt;&lt;br /&gt;
|''Maybe - recommended''&lt;br /&gt;
|Used to set system hostname. Set to the fully-qualified (with dots) name. Defaults to &amp;lt;tt&amp;gt;localhost&amp;lt;/tt&amp;gt; if not set.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;/etc/hosts&amp;lt;/tt&amp;gt;&lt;br /&gt;
|''No''&lt;br /&gt;
| You no longer need to manually set the hostname in this file. This file is automatically generated by &amp;lt;tt&amp;gt;/etc/init.d/hostname&amp;lt;/tt&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;/etc/conf.d/keymaps&amp;lt;/tt&amp;gt;&lt;br /&gt;
|Optional&lt;br /&gt;
|Keyboard mapping configuration file (for console pseudo-terminals). Set if you have a non-US keyboard. See [[Funtoo Linux Localization]].&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;/etc/conf.d/hwclock&amp;lt;/tt&amp;gt;&lt;br /&gt;
|Optional&lt;br /&gt;
|How the time of the battery-backed hardware clock of the system is interpreted (UTC or local time). Linux uses the battery-backed hardware clock to initialize the system clock when the system is booted.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;/etc/conf.d/modules&amp;lt;/tt&amp;gt;&lt;br /&gt;
|Optional&lt;br /&gt;
|Kernel modules to load automatically at system startup. Typically not required. See [[Additional Kernel Resources]] for more info.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;tt&amp;gt;profiles&amp;lt;/tt&amp;gt;&lt;br /&gt;
|Optional&lt;br /&gt;
|Some useful portage settings that may help speed up intial configuration.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you're installing an English version of Funtoo Linux, you're in luck as most of the configuration files can be used as-is. If you're installing for another locale, don't worry. We will walk you through the necessary configuration steps on the [[Funtoo Linux Localization]] page, and if needed, there's always plenty of friendly, helpful support. (See [[#Community portal|Community]])&lt;br /&gt;
&lt;br /&gt;
Let's go ahead and see what we have to do. Use &amp;lt;tt&amp;gt;nano -w &amp;lt;name_of_file&amp;gt;&amp;lt;/tt&amp;gt; to edit files -- the &amp;quot;&amp;lt;tt&amp;gt;-w&amp;lt;/tt&amp;gt;&amp;quot; disables word-wrapping, which is handy when editing configuration files. You can copy and paste from the examples.&lt;br /&gt;
&lt;br /&gt;
{{fancywarning|It's important to edit your &amp;lt;tt&amp;gt;/etc/fstab&amp;lt;/tt&amp;gt; file before you reboot! You will need to modify both the &amp;quot;fs&amp;quot; and &amp;quot;type&amp;quot; columns to match the settings for your partitions and filesystems that you created with &amp;lt;tt&amp;gt;gdisk&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;fdisk&amp;lt;/tt&amp;gt;. Skipping this step may prevent Funtoo Linux from booting successfully.}}&lt;br /&gt;
&lt;br /&gt;
==== /etc/fstab ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;/etc/fstab&amp;lt;/tt&amp;gt; is used by the &amp;lt;tt&amp;gt;mount&amp;lt;/tt&amp;gt; command which is ran when your system boots. Statements of this file inform &amp;lt;tt&amp;gt;mount&amp;lt;/tt&amp;gt; about partitions to be mounted and how they are mounted. In order for the system to boot properly, you must edit &amp;lt;tt&amp;gt;/etc/fstab&amp;lt;/tt&amp;gt; and ensure that it reflects the partition configuration you used earlier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i##nano -w /etc/fstab&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can use arrow keys to move around and hit Control-X to exit. If you want to save your changes, type &amp;quot;&amp;lt;tt&amp;gt;Y&amp;lt;/tt&amp;gt;&amp;quot; when asked if you want to save the modified buffer, or hit Control-O before closing &amp;lt;tt&amp;gt;nano&amp;lt;/tt&amp;gt;. Otherwise your changes will be discarded.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# The root filesystem should have a pass number of either 0 or 1.&lt;br /&gt;
# All other filesystems should have a pass number of 0 or greater than 1.&lt;br /&gt;
#&lt;br /&gt;
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.&lt;br /&gt;
#&lt;br /&gt;
# See the manpage fstab(5) for more information.&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		ext2		noatime  	         1 2&lt;br /&gt;
/dev/sda3		none		swap		sw		         0 0&lt;br /&gt;
/dev/sda4		/		xfs		noatime		         0 1&lt;br /&gt;
#/dev/cdrom		/mnt/cdrom	auto		noauto,ro	         0 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== /etc/localtime ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;/etc/localtime&amp;lt;/tt&amp;gt; is used to specify the timezone that your machine is in, and defaults to UTC. If you would like your Funtoo Linux system to use local time, you should replace &amp;lt;tt&amp;gt;/etc/localtime&amp;lt;/tt&amp;gt; with a symbolic link to the timezone that you wish to use. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(chroot) # ln -sf /usr/share/zoneinfo/America/Montreal /etc/localtime&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above sets the timezone to Eastern Time Canada. Go to &amp;lt;tt&amp;gt;/usr/share/zoneinfo&amp;lt;/tt&amp;gt; to see which values to use.&lt;br /&gt;
&lt;br /&gt;
==== /etc/make.conf ====&lt;br /&gt;
&lt;br /&gt;
{{fancynote|This file is the symlink to /etc/portage/make.conf, new default location, edit /etc/portage/make.conf.}}&lt;br /&gt;
&lt;br /&gt;
MAKEOPTS can be used to define how many parallel compilations should occur when you compile a package, which can speed up compilation significantly. A rule of thumb is the number of CPUs (or CPU threads) in your system plus one. If for example you have a dual core processor without [[wikipedia:Hyper-threading|hyper-threading]], then you would set MAKEOPTS to 3:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEOPTS=&amp;quot;-j3&amp;quot; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are unsure about how many processors/threads you have then use /proc/cpuinfo to help you.&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i##grep &amp;quot;processor&amp;quot; /proc/cpuinfo | wc -l&lt;br /&gt;
16&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set MAKEOPTS to this number plus one:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MAKEOPTS=&amp;quot;-j17&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
USE flags define what functionality is enabled when packages are built. It is not recommended to add a lot of them during installation; you should wait until you have a working, bootable system before changing your USE flags. A USE flag prefixed with a minus (&amp;quot;&amp;lt;tt&amp;gt;-&amp;lt;/tt&amp;gt;&amp;quot;) sign tells Portage not to use the flag when compiling.  A Funtoo guide to USE flags will be available in the future. For now, you can find out more information about USE flags in the [http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=2&amp;amp;chap=2 Gentoo Handbook].&lt;br /&gt;
&lt;br /&gt;
LINGUAS tells Portage which local language to compile the system and applications in (those who use LINGUAS variable like OpenOffice). It is not usually necessary to set this if you use English. If you want another language such as French (fr) or German (de), set LINGUAS appropriately:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LINGUAS=&amp;quot;fr&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== /etc/conf.d/hwclock ====&lt;br /&gt;
If you dual-boot with Windows, you'll need to edit this file and change '''clock''' to '''local''', because Windows will set your hardware clock to local time every time you boot Windows. Otherwise you normally wouldn't need to edit this file.&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i##nano -w /etc/conf.d/hwclock&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Localization ====&lt;br /&gt;
&lt;br /&gt;
By default, Funtoo Linux is configured with Unicode (UTF-8) enabled, and for the US English locale and keyboard. If you would like to configure your system to use a non-English locale or keyboard, see [[Funtoo Linux Localization]].&lt;br /&gt;
&lt;br /&gt;
==== Profiles ====&lt;br /&gt;
&lt;br /&gt;
[[Funtoo 1.0 Profile|Funtoo profiles]] are used to define defaults for Portage specific to your needs. There are 4 basic profile types: arch, build, [[Flavors and Mix-ins|flavor, and mix-ins]]:&lt;br /&gt;
&lt;br /&gt;
;arch: typically &amp;lt;tt&amp;gt;x86-32bit&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;x86-64bit&amp;lt;/tt&amp;gt;, this defines the processor type and support of your system. This is defined when your stage was built and should not be changed.&lt;br /&gt;
;build: defines whether your system is a &amp;lt;tt&amp;gt;current&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;stable&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;experimental&amp;lt;/tt&amp;gt; build. &amp;lt;tt&amp;gt;current&amp;lt;/tt&amp;gt; systems will have newer packages unmasked than &amp;lt;tt&amp;gt;stable&amp;lt;/tt&amp;gt; systems.&lt;br /&gt;
;flavor: defines the general type of system, such as &amp;lt;tt&amp;gt;server&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;desktop&amp;lt;/tt&amp;gt;, and will set default USE flags appropriate for your needs.&lt;br /&gt;
;mix-ins: define various optional settings that you may be interested in enabling.&lt;br /&gt;
&lt;br /&gt;
One arch, build and flavor must be set for each Funtoo Linux system, while mix-ins are optional and you can enable more than one if desired.&lt;br /&gt;
&lt;br /&gt;
Remember that profiles can often be inherited. For example, the &amp;lt;tt&amp;gt;desktop&amp;lt;/tt&amp;gt; flavor inherits the &amp;lt;tt&amp;gt;workstation&amp;lt;/tt&amp;gt; flavor settings, which in turn inherits the &amp;lt;tt&amp;gt;X&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;audio&amp;lt;/tt&amp;gt; mix-ins. You can view this by inspecting the &amp;lt;tt&amp;gt;parent&amp;lt;/tt&amp;gt; files defined in each profile, which can be found in &amp;lt;tt&amp;gt;/usr/portage/profiles/funtoo/1.0/linux-gnu&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i##cd /usr/portage/profiles/funtoo/1.0/linux-gnu/&lt;br /&gt;
(chroot) # ##i##ls&lt;br /&gt;
arch/             eapi              make.defaults     package.use/      packages.build    use.force&lt;br /&gt;
build/            flavor/           mix-ins/          package.use.mask/ parent            &lt;br /&gt;
(chroot) # ##i##cat flavor/desktop/parent &lt;br /&gt;
../workstation&lt;br /&gt;
../../mix-ins/print&lt;br /&gt;
(chroot) # ##i##cat flavor/workstation/parent &lt;br /&gt;
../core&lt;br /&gt;
../../mix-ins/X&lt;br /&gt;
../../mix-ins/audio&lt;br /&gt;
../../mix-ins/dvd&lt;br /&gt;
../../mix-ins/media&lt;br /&gt;
../../mix-ins/console-extras&lt;br /&gt;
(chroot) # &lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To view installed profiles:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i##eselect profile list&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To change the profile flavor:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i##eselect profile set-flavor 7&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add a mix-in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i##eselect profile add 10&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember if you add by string; add a 'gentoo:' to the beginning of the profile name ie:&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i## eselect profile add gentoo:funtoo/1.0/linux-gnu/mix-ins/console-extras&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configuring and installing the Linux kernel ===&lt;br /&gt;
&lt;br /&gt;
Now it's time to build and install a Linux kernel, which is the heart of any Funtoo Linux system. In the past, the process of creating a kernel that actually booted your system could be time-consuming and require a great deal of trial and error. Fortunately, Funtoo Linux offers an option to automatically build a kernel for you that will boot nearly all systems.&lt;br /&gt;
&lt;br /&gt;
If you are unfamiliar with how to manually configure your own kernel, or you simply want to get your system up and running quickly, you can emerge &amp;lt;tt&amp;gt;debian-sources&amp;lt;/tt&amp;gt; with the &amp;lt;tt&amp;gt;binary&amp;lt;/tt&amp;gt; USE flag set, which will automatically build the kernel and an initrd that will boot nearly all Funtoo Linux systems. This kernel is based on a linux-3.2 LTS official debian kernel package and is an easy way to get your system up and running relatively quickly.&lt;br /&gt;
&lt;br /&gt;
Click [http://wiki.debian.org/DebianKernel here] for a list of all architectures the Debian kernel supports. &lt;br /&gt;
&lt;br /&gt;
{{fancyimportant|&amp;lt;tt&amp;gt;debian-sources&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;binary&amp;lt;/tt&amp;gt; USE flag requires at least 12GB in /var/tmp}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i##echo &amp;quot;sys-kernel/debian-sources binary&amp;quot; &amp;gt;&amp;gt; /etc/portage/package.use&lt;br /&gt;
(chroot) # ##i##emerge debian-sources&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All done!&lt;br /&gt;
&lt;br /&gt;
{{fancynote|NVIDIA card users: the &amp;lt;tt&amp;gt;binary&amp;lt;/tt&amp;gt; USE flag installs the Nouveau drivers which cannot be loaded at the same time as the proprietary drivers, and cannot be unloaded at runtime because of KMS. You need to blacklist it under &amp;lt;tt&amp;gt;/etc/modprobe.d/&amp;lt;/tt&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
For an overview of other kernel options for Funtoo Linux, see [[Funtoo Linux Kernels]]. Also be sure to see [[:Category:Hardware Compatibility|hardware compatibility]] information. We have compiled a very good reference for [[Dell PowerEdge 11G Servers]] that includes kernel compatibility information as well.&lt;br /&gt;
&lt;br /&gt;
The next step is to configure your boot loader so that your new kernel loads when the system boots.&lt;br /&gt;
&lt;br /&gt;
=== Installing a Bootloader ===&lt;br /&gt;
&lt;br /&gt;
==== Installing Grub ====&lt;br /&gt;
&lt;br /&gt;
The boot loader is responsible for loading the kernel from disk when your computer boots. For new installations, GRUB 2 and Funtoo's boot-update tool should be used as a boot loader. GRUB supports both GPT/GUID and legacy MBR partitioning schemes.&lt;br /&gt;
&lt;br /&gt;
To use this recommended boot method, first emerge &amp;lt;tt&amp;gt;boot-update&amp;lt;/tt&amp;gt;. This will also cause &amp;lt;tt&amp;gt;grub-2&amp;lt;/tt&amp;gt; to be merged, since it is a dependency of &amp;lt;tt&amp;gt;boot-update&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i##emerge boot-update&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, edit &amp;lt;tt&amp;gt;/etc/boot.conf&amp;lt;/tt&amp;gt; and specify &amp;quot;&amp;lt;tt&amp;gt;Funtoo Linux genkernel&amp;lt;/tt&amp;gt;&amp;quot; as the &amp;lt;tt&amp;gt;default&amp;lt;/tt&amp;gt; setting at the top of the file, replacing &amp;lt;tt&amp;gt;&amp;quot;Funtoo Linux&amp;quot;&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;/etc/boot.conf&amp;lt;/tt&amp;gt; should now look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
boot {&lt;br /&gt;
        generate grub&lt;br /&gt;
        default &amp;quot;Funtoo Linux genkernel&amp;quot;&lt;br /&gt;
        timeout 3 &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Funtoo Linux&amp;quot; {&lt;br /&gt;
        kernel bzImage[-v]&lt;br /&gt;
        # params += nomodeset&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Funtoo Linux genkernel&amp;quot; {&lt;br /&gt;
        kernel kernel[-v]&lt;br /&gt;
        initrd initramfs[-v]&lt;br /&gt;
        params += real_root=auto &lt;br /&gt;
        # params += nomodeset&lt;br /&gt;
} &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Please read &amp;lt;tt&amp;gt;man boot.conf&amp;lt;/tt&amp;gt; for further details.&lt;br /&gt;
&lt;br /&gt;
===== Running grub-install and boot-update =====&lt;br /&gt;
&lt;br /&gt;
Finally, we will need to actually install the GRUB boot loader to your disk, and also run &amp;lt;tt&amp;gt;boot-update&amp;lt;/tt&amp;gt; which will generate your boot loader configuration file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i##grub-install --no-floppy /dev/sda&lt;br /&gt;
(chroot) # ##i##boot-update&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You only need to run &amp;lt;tt&amp;gt;grub-install&amp;lt;/tt&amp;gt; when you first install Funtoo Linux, but you need to re-run &amp;lt;tt&amp;gt;boot-update&amp;lt;/tt&amp;gt; every time you modify your &amp;lt;tt&amp;gt;/etc/boot.conf&amp;lt;/tt&amp;gt; file, so your changes are applied on next boot.&lt;br /&gt;
&lt;br /&gt;
OK - your system should be ready to boot! Well, there are a few more loose ends...&lt;br /&gt;
&lt;br /&gt;
==== Installing Syslinux/Extlinux ====&lt;br /&gt;
&lt;br /&gt;
An alternate Bootloader is Extlinux, for installing it see the [[Extlinux|extlinux Guide]].&lt;br /&gt;
&lt;br /&gt;
=== Configuring your network ===&lt;br /&gt;
&lt;br /&gt;
It's important to ensure that you will be able to connect to your local-area network after you reboot into Funtoo Linux. There are three approaches you can use for configuring your network: NetworkManager, dhcpcd, and the [[Funtoo Linux Networking]] scripts. Here's how to choose which one to use based on the type of network you want to set up.&lt;br /&gt;
&lt;br /&gt;
==== Wi-Fi ====&lt;br /&gt;
&lt;br /&gt;
For laptop/mobile systems where you will be using Wi-Fi and connecting to various networks, NetworkManager is strongly recommended. The Funtoo version of NetworkManager is fully functional even from the command-line, so you can use it even without X or without the Network Manager applet. Here are the steps involved in setting up NetworkManager:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##emerge linux-firmware&lt;br /&gt;
# ##i##emerge networkmanager&lt;br /&gt;
# ##i##rc-update add NetworkManager default&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Above, we installed linux-firmware which contains a complete collection of available firmware for many hardware devices including Wi-Fi adapters, plus NetworkManager to manage our network connection. Then we added NetworkManager to the &amp;lt;tt&amp;gt;default&amp;lt;/tt&amp;gt; runlevel so it will start when Funtoo Linux boots.&lt;br /&gt;
&lt;br /&gt;
After you reboot into Funtoo Linux, you will be able to add a Wi-Fi connection this way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##addwifi -S wpa -K 'wifipassword' mywifinetwork&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;addwifi&amp;lt;/tt&amp;gt; command is used to configure and connect to a WPA/WPA2 Wi-Fi network named &amp;lt;tt&amp;gt;mywifinetwork&amp;lt;/tt&amp;gt; with the password &amp;lt;tt&amp;gt;wifipassword&amp;lt;/tt&amp;gt;. This network configuration entry is stored in &amp;lt;tt&amp;gt;/etc/NetworkManager/system-connections&amp;lt;/tt&amp;gt; so that it will be remembered in the future. You should only need to enter this command once for each Wi-Fi network you connect to.&lt;br /&gt;
&lt;br /&gt;
==== Desktop (Wired Ethernet) ====&lt;br /&gt;
&lt;br /&gt;
For a home desktop or workstation with wired Ethernet that will use DHCP, the simplest and most effective option to enable network connectivity is to simply add &amp;lt;tt&amp;gt;dhcpcd&amp;lt;/tt&amp;gt; to the default runlevel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
# ##i##rc-update add dhcpcd default&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you reboot, &amp;lt;tt&amp;gt;dhcpcd&amp;lt;/tt&amp;gt; will run in the background and manage all network interfaces and use DHCP to acquire network addresses from a DHCP server.&lt;br /&gt;
&lt;br /&gt;
==== Server (Static IP) ====&lt;br /&gt;
&lt;br /&gt;
For servers, the [[Funtoo Linux Networking]] scripts are recommended. They are optimized for static configurations and things like virtual ethernet bridging for virtualization setups. See [[Funtoo Linux Networking]] for information on how to use Funtoo Linux's template-based network configuration system.&lt;br /&gt;
&lt;br /&gt;
=== Finishing Steps ===&lt;br /&gt;
&lt;br /&gt;
==== Set your root password ====&lt;br /&gt;
It's imperative that you set your root password before rebooting so that you can log in.&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i##passwd&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Restart your system ===&lt;br /&gt;
&lt;br /&gt;
Now is the time to leave chroot, to unmount Funtoo Linux partitions and files and to restart your computer. When you restart, the GRUB boot loader will start, load the Linux kernel and initramfs, and your system will begin booting.&lt;br /&gt;
&lt;br /&gt;
Leave the chroot, change directory to /, unmount your Funtoo partitions, and reboot.&lt;br /&gt;
&amp;lt;console&amp;gt;&lt;br /&gt;
(chroot) # ##i##exit&lt;br /&gt;
# ##i##cd /&lt;br /&gt;
# ##i##umount /mnt/funtoo/boot /mnt/funtoo/dev /mnt/funtoo/proc /mnt/funtoo&lt;br /&gt;
# ##i##reboot&lt;br /&gt;
&amp;lt;/console&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should now see your system reboot, the GRUB boot loader appear for a few seconds, and then see the Linux kernel and initramfs loading. After this, you should see Funtoo Linux itself start to boot, and you should be greeted with a &amp;lt;tt&amp;gt;login:&amp;lt;/tt&amp;gt; prompt. Funtoo Linux has been successfully installed!&lt;br /&gt;
&lt;br /&gt;
===Next Steps===&lt;br /&gt;
&lt;br /&gt;
To learn how to customize and start using Funtoo Linux, see [[Funtoo Linux First Steps]].&lt;br /&gt;
&lt;br /&gt;
If your system did not boot correctly, see [[Installation Troubleshooting]] for steps you can take to resolve the problem.&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;br /&gt;
[[Category:Install]]&lt;/div&gt;</summary>
		<author><name>Fearedbliss</name></author>	</entry>

	<entry>
		<id>http://www.funtoo.org/wiki/Funtoo_Linux_Installation</id>
		<title>Funtoo Linux Installation</title>
		<link rel="alternate" type="text/html" href="http://www.funtoo.org/wiki/Funtoo_Linux_Installation"/>
				<updated>2013-06-09T06:28:30Z</updated>
		
		<summary type="html">&lt;p&gt;Fearedbliss: removed zfs encryption guide link. The regular zfs guide now has encryption instructions.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This document briefly explains all of the steps required to set up a typical Funtoo Linux installation on a &amp;quot;PC compatible&amp;quot; computer system. If you've had previous experience installing Gentoo Linux then a lot of steps will be familiar, but you should still read through as there are a few differences.&lt;br /&gt;
&lt;br /&gt;
=== Additional Resources === &lt;br /&gt;
&lt;br /&gt;
This document was written to help you install Funtoo Linux as efficiently as possible, with a minimum number of distracting options regarding system configuration. &lt;br /&gt;
&lt;br /&gt;
Those who prefer a longer, more thorough tutorial-style installation may want to check out our beta [[Installation (Tutorial)|Installation Tutorial]] instead. It explores more installation possibilities and options such as encrypted filesystems, and includes screenshots.&lt;br /&gt;
&lt;br /&gt;
If you are installing Funtoo Linux on [[Funtoo Linux Installation on ARM|ARM]] architecture, please see [[Funtoo Linux Installation on ARM]] for notable differences regarding ARM support. An experimental Funtoo Linux build also exists for [[Funtoo Linux Installation on SPARC|SPARC]] platforms. See [[Funtoo Linux Installation on SPARC]]&lt;br /&gt;
&lt;br /&gt;
== Installation Overview ==&lt;br /&gt;
&lt;br /&gt;
This is a basic overview of the Funtoo installation process:&lt;br /&gt;
&lt;br /&gt;
# [[#Live CD|Download and boot the live CD of your choice]].&lt;b