Difference between pages "Install/es" and "Install ZFS root&boot File System"

(Difference between pages)
(Created page with "Si necesitas configurar una conexión WiFi para acceso a internet, entonces se necesita realizar usando en el entorno gráfico el System Rescue CD. Ejecuta <code>startx</code>...")
 
(Installing the ZFS initramfs, kernel and kernel modules)
 
Line 1: Line 1:
{{#widget:AddThis}}
+
== 0. Introduction ==
= Install Funtoo Linux =  
+
__NOTITLE__
+
<languages/>
+
{{Announce|To help us translate this documentation, {{CreateAccount}}, log in to the wiki. Then go to Actions -> Translate in the menu, or click the "Translate this page" link, above. You will be able to select small parts of the install docs and translate these parts to your native language.}}
+
== Introducción ==  
+
  
Este documento ha sido escrito para ayudarte a instalar Funtoo Linux en sistemas compatibles con PC, manteniendo opciones distractoras pertinentes a la configuración del sistema al mínimo.
+
ZFS seams to be one of the future filesystems. At the time of writing (31.08.2015) booting on ZFS is still a headache. Some linux distributions boot on ext2 partition and run zfs as rootfs like [[ZFS_Install_Guide]] and some are able to boot from zfs, some do support zfs only as a filesystem.
  
Si tu tienes experiencia previa instalando Gentoo Linux, entonces muchos pasos te seran familiares, pero aún asi debes leerla, ya que hay algunas diferencias. Si eres nuevo instalando un Linux basado en Gentoo  o totalmente nuevo en Linux  - Bienvenidos! Hemos intentado hacer estas instrucciones de instalación comprensible para los usuarios nuevos también.
+
Funtoo linux supports ZFS as filesystem and as rootfs, however it does not support it as boot/grub filesystem. For easier search by search engines, it is referred to in this document as whole disk ZFS.
  
Nota
+
Funtoo linux uses the grub bootloader. So it has been not really understandable, why whole disk ZFS could not be supported by funtoo, as grub is able to do so. Or better, some linux distribution, using the grub bootloader run "whole disk ZFS". What they can, ... yes, we can! ... as well.
  
Si tu estas instanlando Funtoo Linux en una arquitectura ARM, por favor ve a [[Funtoo Linux Installation on ARM]] para conocer las diferencias notables respecto al soporte ARM
+
This guide is based on many trial and errors - caused by lack of knowledge - the actual [[ZFS_Install_Guide]] and a guide for whole disk ZFS for ubuntu. Ubuntu runs als grub bootloader, so some ideas are adapted from there.
  
== Resumen de Instalación ==  
+
=== Disclaimers ===
  
Éste es el resumen básico del proceso de instalación de Funtoo.
+
{{fancywarning|This guide is a working pretty well on one computer - that is mine! If it does not run on your's, or if it breaks on your's, than you should try to sort the issue out and report it to this page.  
  
# [[#Live CD|Descarga y arranca el live CD de tu elección]].
+
So, you may expect that it MAY work! ... and you should be aware that it MAY break your installation. This guide is not developed enough to ENSURE a stable production environment.
# [[#Prepare Hard Disk|Prepara tu disco]].
+
# [[#Creating filesystems|Crea]] y [[#Mounting filesystems|monta]] el sistema de archivos.
+
# [[#Installing the Stage 3 tarball|Instala el Stage 3 tarball]] de tu elección.
+
# [[#Chroot into Funtoo|Inicia un Chroot en tu nuevo sistema]].
+
# [[#Downloading the Portage tree|Descarga el árbol de Portage]].
+
# [[#Configuring your system|Configura tu sistema]] y [[#Configuring your network|red]].
+
# [[#Configuring and installing the Linux kernel|Instala un kernel]].
+
# [[#Installing a Bootloader|Instala un gestor de arranque]].
+
# [[#Finishing Steps|Completa los pasos finales]].
+
# [[#Restart your system|Reinicia y disfruta]].
+
  
=== Live CD ===
+
... however, I use it for that! ;-) - crazzy as I am.
 
+
Para instalar Funtoo Linux, primero necesitas arrancar el ordenador mediante un Live CD de un sistema basado en Linux o un Live USB. Recomendamos el [http://www.sysresccd.org/ System Rescue CD] basado en Gentoo, ya que contiene una gran cantidad de herramientas y utilidades y soporta tanto sistemas de 32 bits como de  64 bits. Se puede grabar en un CD / DVD o instalarlo en una memoria USB. Descárgalo aquí:
+
 
+
* Descargar desde '''[http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/systemrescuecd-x86-4.5.0.iso osuosl.org]'''
+
* Descargar desde '''[http://build.funtoo.org/distfiles/sysresccd/systemrescuecd-x86-4.5.0.iso funtoo.org]'''
+
 
+
{{Note| Si estás usando una antigua versión de Sustem Rescue CD, "asegúrate de seleccionar el kernel <code>rescue64</code> en el menu de arranque si estás instalando un sistema de 64-bit". Por defecto, System Rescue CD usa para el arranque un modo de 32-bit  aunque la última versión intenta detectar automaticamente procesadores de 64-bit.}}
+
 
+
==== Acceso a la Red ====
+
 
+
Una vez que haya arrancado System Rescue CD, vea si tiene acceso a Internet. Se requiere acceso a Internet para la instalación Funtoo Linux:
+
 
+
<console>
+
# ##i##ping www.google.com
+
PING www.google.com (216.58.217.36) 56(84) bytes of data.
+
64 bytes from den03s10-in-f4.1e100.net (216.58.217.36): icmp_seq=1 ttl=57 time=30.1 ms
+
</console>
+
 
+
Si el ping es satisfactorio (mirarás <code>64 bytes</code> mensajes como el anterior,) entonces tu Red está configurada. Presiona Control-C para detener el ping.
+
 
+
Si necesitas configurar una conexión WiFi para acceso a internet, entonces se necesita realizar usando en el entorno gráfico el System Rescue CD. Ejecuta <code>startx</code> para iniciar una sesión gráfica.
+
<console>
+
# ##i##startx
+
</console>
+
 
+
[[File:NetworkManagerIcon.PNG|left|caption]]
+
 
+
Then, use the NetworkManager applet (icon in lower right of graphical session, in taskbar) to connect to a WiFi network of your choice. Next, open a terminal inside your graphical environment, and you should be able to use the terminal to complete the rest of the steps.
+
 
+
==== Instalación Remota ====
+
 
+
Alternatively, you can log into System Rescue CD over the network via SSH to perform the install from another computer, and this may be more convenient way to install Funtoo Linux.
+
 
+
If you'd like to complete the install remotely, here's how. First, you will need to ensure that System Rescue CD has a functioning network connection. Then, you will need to set a root password for System Rescue CD:
+
{{console|body=
+
###i## passwd
+
New password: ##i##********
+
Retype new password: ##i##********
+
passwd: password updated successfully
+
 
}}
 
}}
Once you have typed in a password, you will now need to determine the IP address of System Rescue CD, and then you can use {{c|ssh}} to connect to it. To determine the IP address currently being used by System Rescue CD, type {{c|ifconfig}}:
 
  
{{console|body=
+
{{fancyimportant|ZFS will run properly only on 64Bit machines. If you plan to run ZFS with 32Bit, you may also try russian roulette with six bullets. The outcome is clear, and sure not that what you want!
###i## ifconfig
+
}}
+
One of the interfaces should have an IP address (listed as {{c|inet addr:}}) from your LAN. You can then connect remotely, from another system on your LAN, to System Rescue CD, and perform steps from the comfort of an existing OS. On your remote system, type the following, replacing {{c|1.2.3.4}} with the IP address of System Rescue CD. Connecting from an existing Linux or MacOS system would look something like this:
+
  
{{console|body=
+
Not covered in this Guide are:
(remote system) $ ##i##ssh root@1.2.3.4
+
Password: ##i##**********}}
+
{{Note|If you'd like to connect remotely from an existing Microsoft Windows system, you'll need to download an SSH client for Windows, such as [http://www.chiark.greenend.org.uk/~sgtatham/putty/ PuTTY].}}
+
  
After you've logged in via SSH, you're now connected remotely to System Rescue CD and can perform the installation steps.
+
- obvious steps from the regular funtoo installation guide [[Install]] and the ZFS installation guide [[ZFS_Install_Guide]]
  
=== Preparar Disco Duro ===
+
- other partition layouts than GPT
  
In this section, we'll learn about the different ways that Funtoo Linux can boot from a hard disk. By "boot", we mean the process by which Linux starts after you press the power button on your desktop, laptop or server. You can think of "booting" as a process that starts with your computer's firmware (built-in software) running, and then "finding" the Linux kernel and running it. The Linux kernel then takes over, identifies all your hardware, and starts.
+
- other kernel sources than gentoo-sources as debian-sources do not work for sure
  
==== Antecedentes ====
+
- usb bootable whole disk ZFS devices (as they need a proper set of udev rules)
  
{{Note|If you are an absolute beginner to Linux, you may be less confused if you skip to the next section, [[#Which to Use?|Which to Use?]]}}
+
- and may be many items more ... ;-)}}
  
In earlier times, there was only one way to boot a PC-compatible computer. All of our desktops and servers had standard firmware called the "PC BIOS," all our hard drives used Master Boot Records at the beginning of the disk, where the PC BIOS would "look" to find boot loader code which would in turn load Linux, and our hard drives were partitioned into different regions using the standard MBR partition scheme. That was just how it was done. And we liked it that way!
+
== 1. Preparations ==
 +
In this section, we will prepare everything, to be used during system and boot loader installation.
  
Then, along came EFI and UEFI, which are new-style firmware designed to boot systems, along with GPT partition tables to define disk partitions on disks larger than 2.2TB. All of the sudden, we had a variety of options for installing and booting Linux systems, turning what once was a one-method-fits-all approach into something a lot more complex.
+
=== Create an installation envirnment ===
 +
To be able to install funtoo on zfs, we need a suitable installation environment. The next steps describe the setup:
  
Let's take a moment to review the options available to you for configuring a hard drive to boot Funtoo Linux. This Install Guide uses, and recommends, the old-school method of BIOS booting and using an MBR. It works and (except for rare cases) is universally supported. There's nothing wrong with it. If your system disk is 2TB or smaller in size, it won't prevent you from using all of your disk's capacity, either.
+
==== Downloading the ISO (With ZFS) ====
  
But, there are some situations where the old-school method isn't optimal. If you have a system disk >2TB in size, then MBR partitions won't allow you to access all your storage. So that's one reason. Another reason is that there are some so-called "PC" systems out there that don't support BIOS booting anymore, and force you to use UEFI to boot. So, out of compassion for people who fall into this predicament, this Install Guide documents UEFI booting too.
+
This is a copy by the date of 31.08.2015 from the [[ZFS_Install_Guide]].
  
Our recommendation is still to go old-school unless you have reason not to. The boot loader we will be using to load the Linux kernel in this guide is called GRUB, so we call this method the '''BIOS + GRUB (MBR)''' method. It's the traditional method of setting up a PC-compatible system to boot Linux.
+
In order for us to install Funtoo on ZFS, you will need an environment that already provides the ZFS tools. Therefore we will download a customized version of System Rescue CD with ZFS included.  
  
If you need to use UEFI to boot, we recommend not using the MBR at all for booting, as some systems support this, but others don't. Instead, we recommend using UEFI to boot GRUB, which in turn will load Linux. We refer to this method as the '''UEFI + GRUB (GPT)''' method.
+
<pre>
 +
Name: sysresccd-4.2.0_zfs_0.6.2.iso  (545 MB)
 +
Release Date: 2014-02-25
 +
md5sum 01f4e6929247d54db77ab7be4d156d85
 +
</pre>
  
And yes, there are even more methods, some of which are documented on the [[Boot Methods]] page. We used to recommend a '''BIOS + GRUB (GPT)''' method but it is not consistently supported across a wide variety of hardware.
 
  
==== ¿Cuál Usar? ====
+
'''[http://ftp.osuosl.org/pub/funtoo/distfiles/sysresccd/ Download System Rescue CD with ZFS]'''<br />
  
'''The big question is -- which boot method should you use?''' Here's how to tell.
+
==== Creating a bootable USB from ISO (From a Linux Environment) ====
  
;Principle 1 - Old School: If you can reliably boot System Rescue CD and it shows you an initial light blue menu, you are booting the CD using the BIOS, and it's likely that you can thus boot Funtoo Linux using the BIOS. So, go old-school and use BIOS booting, ''unless'' you have some reason to use UEFI, such as having a >2.2TB system disk. In that case, see Principle 2, as your system may also support UEFI booting.
+
This is a copy by the date of 31.08.2015 from the [[ZFS_Install_Guide]].
  
;Principle 2 - New School: If you can reliably boot System Rescue CD and it shows you an initial black and white menu -- congratulations, your system is configured to support UEFI booting. This means that you are ready to install Funtoo Linux to boot via UEFI. Your system may still support BIOS booting, but just be trying UEFI first. You can poke around in your BIOS boot configuration and play with this.
+
After you download the iso, you can do the following steps to create a bootable USB:
  
{{Note|'''Advanced Users May Wonder:''' What's the Big Difference between Old School and New School?: Here's the deal. If you go with old-school MBR partitions, your {{f|/boot}} partition will be an ext2 filesystem, and you'll use {{c|fdisk}} to create your MBR partitions. If you go with new-school GPT partitions and UEFI booting, your {{f|/boot}} partition will be a vfat filesystem, because this is what UEFI is able to read, and you will use {{c|gdisk}} to create your GPT partitions. And you'll install GRUB a bit differently. That's about all it comes down to, in case you were curious.}}
+
<console>
 +
Make a temporary directory
 +
# ##i##mkdir /tmp/loop
  
To install Funtoo Linux to boot via the New School UEFI method, you must boot System Rescue CD using UEFI. If you successfully boot sysresccd with UEFI, you will see an initial black and white screen to select the mode in which you will boot system rescue cd. Otherwise, if you see a blue screen with black text, UEFI will not be active and you will not be able to set up UEFI booting later in the install process!
+
Mount the iso
 +
# ##i##mount -o ro,loop /root/sysresccd-4.2.0_zfs_0.6.2.iso /tmp/loop
  
{{Note|'''Some motherboards may appear to support UEFI, but don't.''' Do your research. For example, the Award BIOS in my Gigabyte GA-990FXA-UD7 rev 1.1 has an option to enable UEFI boot for CD/DVD. '''This is not sufficient for enabling UEFI boot for hard drives and installing Funtoo Linux.''' UEFI must be supported for both removable media (so you can boot System Rescue CD using UEFI) as well as fixed media (so you can boot your new Funtoo Linux installation.) It turns out that later revisions of this board (rev 3.0) have a new BIOS that fully supports UEFI boot.  This may point to a third principle -- know thy hardware.}}
+
Run the usb installer
 +
# ##i##/tmp/loop/usb_inst.sh
 +
</console>
  
==== Método de la Vieja Escuela (BIOS/MBR) ====
+
That should be all you need to do to get your flash drive working.
  
{{Note|Use this method if you are booting using your BIOS, and if your System Rescue CD initial boot menu was light blue. If you're going to use the new-school method, [[#New-School (UEFI/GPT) Method|click here to jump down to UEFI/GPT.]]}}
+
==== Booting the ISO ====
 +
While booting the above mentioned iso image - you should use exactly that one, unless you are writing another guide - you shoud use the option '''E) Alternative 64bit kernel (altker64) with more choice...'''. 64Bit, as mentioned above.
  
First, it's a good idea to make sure that you've found the correct hard disk to partition. Try this command and verify that {{f|/dev/sda}} is the disk that you want to partition:
+
On the next page you should select '''7. SystemRecsueCd with the default graphic environment'''. The system will come up with a small graphical environment and some tools. One of them is a graphical version of GParted, which will be used in this guide.
{{console|body=
+
###i## fdisk -l /dev/sda
+
  
Disk /dev/sda: 640.1 GB, 640135028736 bytes, 1250263728 sectors
+
=== Preparing the harddrives ===
Units = sectors of 1 * 512 = 512 bytes
+
Sector size (logical/physical): 512 bytes / 512 bytes
+
I/O size (minimum/optimal): 512 bytes / 512 bytes
+
Disk label type: gpt
+
  
#        Start          End    Size  Type            Name
+
The preparation of the harddrives envolves the following steps:
1        2048  1250263694  596.2G  Linux filesyste Linux filesystem
+
}}
+
Now, it is recommended that you erase any existing MBR or GPT partition tables on the disk, which could confuse the system's BIOS at boot time. We accomplish this using {{c|sgdisk}}:
+
{{Warning|This will make any existing partitions inaccessible! You are '''strongly''' cautioned and advised to backup any critical data before proceeding.}}
+
  
{{console|body=
+
==== Cleaning the disks ====
###i## sgdisk --zap-all /dev/sda
+
This guide was developed using GPT partition layout. Any other layout type is not included here.
  
Creating new GPT entries.
+
All below this note is a copy by the date of 31.08.2015 from the respective section of the [[ZFS_Install_Guide]].
GPT data structures destroyed! You may now partition the disk using fdisk or
+
other utilities.
+
}}
+
This output is also nothing to worry about, as the command still succeded:
+
  
{{console|body=
+
First lets make sure that the disk is completely wiped from any previous disk labels and partitions.
***************************************************************
+
We will also assume that <tt>/dev/sda</tt> is the target drive.
Found invalid GPT and valid MBR; converting MBR to GPT format
+
<console>
in memory.  
+
# ##i##sgdisk -Z /dev/sda
***************************************************************
+
</console>
}}Now we will use {{c|fdisk}} to create the MBR partition table and partitions:
+
{{fancywarning|This is a destructive operation and the program will not ask you for confirmation! Make sure you really don't want anything on this disk.}}
{{console|body=
+
{{fancynote|Do not forget to run this command for each drive participating the new pool. In this guide a mirror pool is created and the devices <tt>/dev/sda</tt> and <tt>/dev/sdb</tt> are used.}}
###i## fdisk /dev/sda
+
==== Create a pool ====
}}
+
In this section, we create a whole disk ZFS / <code>zpool</code>. For the convenience of this guide, a <code>mirror</code> pool with the name <code>tank</code> will be created and not mounted (option <code>-m none</code>). Single disk ZFS or even <code>zraid</code> could be used respectively.
Within {{c|fdisk}}, follow these steps:
+
  
'''Empty the partition table''':
+
The option <code>ashift=12</code> is set for hard drives with a 4096 sector size commonly used by SSD drives.
{{console|body=
+
Command (m for help): ##i##o ↵
+
}}
+
'''Create Partition 1''' (boot):
+
  
{{console|body=
+
<console># ##i## zpool create -f -o ashift=12 -m none -R /mnt/funtoo tank mirror /dev/sda /dev/sdb </console>
Command (m for help): ##i##n ↵
+
{{fancyimportant|Here we use the devices /dev/sda and /dev/sdb, and not the partitions as described in the [[ZFS_Install_Guide]]. The devices will be partitioned with a GPT partition label and the respective pool including the ZFS filesystems will be created in one step.
Partition type (default p): ##i##
+
Partition number (1-4, default 1): ##i##↵
+
First sector: ##i##↵
+
Last sector: ##i##+128M ↵
+
}}
+
'''Create Partition 2''' (swap):
+
  
{{console|body=
+
The cachefile is omitted, as it only speeds booting and unfortunately creates destructive issues while manipulating the pool later on.}}
Command (m for help): ##i##n ↵
+
{{fancynote|It is preferred to use /dev/disk/by-id/ ... Here it does not really matter, and at the important points we will use the reference to the drives by ID.}}
Partition type (default p): ##i##↵
+
Partition number (2-4, default 2): ##i##↵
+
First sector: ##i##↵
+
Last sector: ##i##+2G ↵
+
Command (m for help): ##i##t ↵
+
Partition number (1,2, default 2): ##i## ↵
+
Hex code (type L to list all codes): ##i##82 ↵
+
}}
+
'''Create the root partition:'''
+
  
{{console|body=
+
<code>zpool status</code> can be used to verify the pool.
Command (m for help): ##i##n ↵
+
Partition type (default p): ##i##↵
+
Partition number (3,4, default 3): ##i##↵
+
First sector: ##i##↵
+
Last sector: ##i##↵
+
}}
+
'''Verify the partition table:'''
+
  
{{console|body=
+
==== Create the zfs datasets ====
Command (m for help): ##i##p
+
  
Disk /dev/sda: 298.1 GiB, 320072933376 bytes, 625142448 sectors
+
This is a copy by the date of 31.08.2015 from the [[ZFS_Install_Guide]], unless the <code>root</code> dataset has been changed to <code>ROOT</code> to avoid confusions with the normal linux <code>root</code> home directory <code>/root</code>. 
Units: sectors of 1 * 512 = 512 bytes
+
Sector size (logical/physical): 512 bytes / 512 bytes
+
I/O size (minimum/optimal): 512 bytes / 512 bytes
+
Disklabel type: dos
+
Disk identifier: 0x82abc9a6
+
  
Device    Boot    Start      End    Blocks  Id System
+
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: <code>/home</code>, <code>/usr/src</code>, and <code>/usr/portage</code>. Notice, datasets are examples only and not strictly required.
/dev/sda1          2048    264191    131072 83 Linux
+
/dev/sda2        264192  4458495  2097152  82 Linux swap / Solaris
+
/dev/sda3        4458496 625142447 310341976 83 Linux
+
}}
+
'''Write the parition table to disk:'''
+
  
{{console|body=Command (m for help): ##i##w}}
+
<console>
Your new MBR partition table will now be written to your system disk.
+
Create some empty containers for organization purposes, and make the dataset that will hold /
 +
# ##i## zfs create -p tank/funtoo
 +
# ##i## zfs create -o mountpoint=/ tank/funtoo/ROOT
  
{{Note|You're done with partitioning! Now, jump over to [[#Creating filesystems|Creating filesystems]].}}
+
Optional, but recommended datasets: /home
 +
# ##i## zfs create -o mountpoint=/home tank/funtoo/home
  
==== New-School (UEFI/GPT) Method ====  
+
Optional datasets: /usr/src, /usr/portage/{distfiles,packages}
 +
# ##i## zfs create -o mountpoint=/usr/src tank/funtoo/src
 +
# ##i## zfs create -o mountpoint=/usr/portage -o compression=off tank/funtoo/portage
 +
# ##i## zfs create -o mountpoint=/usr/portage/distfiles tank/funtoo/portage/distfiles
 +
# ##i## zfs create -o mountpoint=/usr/portage/packages tank/funtoo/portage/packages
 +
</console>
 +
<code>df -k</code> can be used to verify the mountpoints.
  
{{Note|Use this method if you are interested in booting using UEFI, and if your System Rescue CD initial boot menu was black and white. If it was light blue, this method will not work.}}
+
==== Create empty snapshot of the pool (purely optional) ====
 +
Expecting some trial and error during the system installation, a snapshot of the empty disks makes it easy to return this point ... of the game ...
 +
<console># ##i##  zfs snapshot -r tank@000-empty_pool  </console>
 +
<code>zfs list -t snapshot</code> allows to list the existing snapshots.
 +
The rollback will be descibed further down in the troubleshooting guide...
  
The {{c|gdisk}} commands to create a GPT partition table are as follows. Adapt sizes as necessary, although these defaults will work for most users. Start {{c|gdisk}}:
+
==== Flag the bios_grub partition ====
{{console|body=###i## gdisk /dev/sda}}
+
The freshly created GPT partition tables of the devices used in the pool contains two partitions. The first and larger one contains the zfs filesystem, the second (number 9), <code>8.0MiB</code> in size, is reserved by Solaris (<code>BF07</code>).
Within {{c|gdisk}}, follow these steps:
+
  
'''Create a new empty partition table''' (This ''will'' erase all data on the disk when saved):
+
We use now the graphical tool GParted selecting the partition 9 of each device and set the <code>bios_grub</code> flag. This action will add the flag and changes the partition type to BIOS boot partition (<code>EF02</code>).
{{console|body=
+
Command: ##i##o ↵
+
This option deletes all partitions and creates a new protective MBR.
+
Proceed? (Y/N): ##i##y ↵
+
}}
+
'''Create Partition 1''' (boot):
+
  
{{console|body=
+
This can be done by command line as well ...
Command: ##i##n ↵
+
Partition Number: ##i##1 ↵
+
First sector: ##i##↵
+
Last sector: ##i##+500M ↵
+
Hex Code: ##i##EF00 ↵
+
}}
+
'''Create Partition 2''' (swap):
+
  
{{console|body=
+
=== 2. Basic Funtoo installation ===
Command: ##i##n ↵
+
Now the installation environment has been set up, and the harddrives laid out. The next step will be the basic funtoo installation according to the following steps:
Partition Number: ##i##2
+
First sector: ##i##↵
+
Last sector: ##i##+4G ↵
+
Hex Code: ##i##8200 ↵
+
}}
+
'''Create Partition 3''' (root):
+
  
{{console|body=
+
==== Import the pool ====
Command: ##i##n ↵
+
For installation purpose, the pool created will be imported under the mountpoint <code>/mnt/funtoo</code>.
Partition Number: ##i##3 ↵
+
<code>ashift=12</code> option  which is used for a hard drives with a 4096 sector size.
First sector: ##i##↵
+
<console># ##i## zpool import -f -d /dev/disk/by-id -R /mnt/funtoo tank 
Last sector: ##i##↵##!i## (for rest of disk)
+
</console>
Hex Code: ##i##↵
+
Using <code>zpool status</code> and / or <code>df -k</code> can be used to verify the pool and the mountpoint.
}}
+
Along the way, you can type "{{c|p}}" and hit Enter to view your current partition table. If you make a mistake, you can type "{{c|d}}" to delete an existing partition that you created. When you are satisfied with your partition setup, type "{{c|w}}" to write your configuration to disk:
+
  
'''Write Partition Table To Disk''':
+
==== Change directory to the pool's root directory ====
{{console|body=
+
Then we should change into the pool's mountpoint directory. At the same time this is the root directory of the intended funtoo installation. That is the directory where you will chroot into.
Command: ##i##w ↵
+
<console>
Do you want to proceed? (Y/N): ##i##Y ↵
+
# ##i##cd /mnt/funtoo
}}The partition table will now be written to the disk and {{c|gdisk}} will close.
+
</console>
  
Now, your GPT/GUID partitions have been created, and will show up as the following ''block devices'' under Linux:
+
==== Download and extract funtoo stage3 ====
  
* {{c|/dev/sda1}}, which will be used to hold the {{c|/boot}} filesystem,
+
It is strongly recommended to use the generic_64 funtoo stage 3 tarball, to avoid a broken build.  
 
+
The download should be done using <code>wget</code>:
* {{c|/dev/sda2}}, which will be used for swap space, and
+
<console>
 
+
* {{c|/dev/sda3}}, which will hold your root filesystem.
+
 
+
{{Tip|You can verify that the block devices above were correctly created by running the command {{c|lsblk}}.}}
+
==== Creating filesystems ====
+
 
+
{{Note|This section covers both BIOS ''and'' UEFI installs. Don't skip it!}}
+
 
+
Before your newly-created partitions can be used, the block devices that were created in the previous step 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.
+
 
+
Let's keep this simple. Are you using old-school MBR partitions? If so, let's create an ext2 filesystem on {{f|/dev/sda1}}:
+
{{console|body=###i## mkfs.ext2 /dev/sda1}}
+
If you're using new-school GPT partitions for UEFI, you'll want to create a vfat filesystem on {{c|/dev/sda1}}, because this is what UEFI is able to read:
+
{{console|body=###i## mkfs.vfat -F 32 /dev/sda1}}
+
Now, let's create a swap partition. This partition will be used as disk-based virtual memory for your Funtoo Linux system.
+
 
+
You will not create a filesystem on your swap partition, since it is not used to store files. But it is necessary to initialize it using the {{c|mkswap}} command. Then we'll run the {{c|swapon}} command to make your newly-initialized swap space immediately active within the live CD environment, in case it is needed during the rest of the install process:
+
{{console|body=
+
# ##i##mkswap /dev/sda2
+
# ##i##swapon /dev/sda2
+
}}Now, we need to create a root filesystem. This is where Funtoo Linux will live. We generally recommend ext4 or XFS root filesystems. If you're not sure, choose ext4. Here's how to create a root ext4 filesystem:
+
 
+
{{console|body=###i## mkfs.ext4 /dev/sda3}}
+
...and here's how to create an XFS root filesystem, if you prefer to use XFS instead of ext4:
+
 
+
{{console|body=###i## mkfs.xfs /dev/sda3}}
+
Your filesystems (and swap) have all now been initialized, so that that can be mounted (attached to your existing directory heirarchy) and used to store files. We are ready to begin installing Funtoo Linux on these brand-new filesystems.
+
 
+
{{Warning|When deploying an OpenVZ host, please use ext4 exclusively. The Parallels development team tests extensively with ext4, and modern versions of {{c|openvz-rhel6-stable}} are '''not''' compatible with XFS, and you may experience kernel bugs.}}
+
 
+
==== Mounting filesystems ====
+
 
+
Mount the newly-created filesystems as follows, creating {{c|/mnt/funtoo}} as the installation mount point:
+
{{console|body=
+
###i## mkdir /mnt/funtoo
+
###i## mount /dev/sda3 /mnt/funtoo
+
###i## mkdir /mnt/funtoo/boot
+
###i## mount /dev/sda1 /mnt/funtoo/boot
+
}}
+
Optionally, if you have a separate filesystem for {{f|/home}} or anything else:
+
 
+
{{console|body=
+
###i## mkdir /mnt/funtoo/home
+
###i## mount /dev/sda4 /mnt/funtoo/home
+
}}
+
If you have {{f|/tmp}} or {{f|/var/tmp}} on a separate filesystem, be sure to change the permissions of the mount point to be globally-writeable after mounting, as follows:
+
{{console|body=###i## chmod 1777 /mnt/funtoo/tmp}}
+
==== Setting the Date ====
+
 
+
{{Important|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. However, if your system time is relatively close to correct, you can probably skip this step for now.}}
+
 
+
Now is a good time to verify the date and time are correctly set to UTC. Use the {{c|date}} command to verify the date and time:
+
{{console|body=
+
###i## date
+
Fri Jul 15 19:47:18 UTC 2011
+
}}
+
If the date and/or time need to be corrected, do so using {{c|date MMDDhhmmYYYY}}, keeping in mind {{c|hhmm}} are in 24-hour format. The example below changes the date and time to "July 16th, 2011 @ 8:00PM" UTC:
+
 
+
{{console|body=
+
###i## date 071620002011
+
Fri Jul 16 20:00:00 UTC 2011
+
}}
+
Once you have set the system clock, it's a very good idea to copy the time to the hardware clock, so it persists across reboots:
+
 
+
{{console|body=###i## hwclock --systohc}}
+
=== Installing the Stage 3 tarball ===
+
 
+
Now that filesystems are created and your hardware and system clock are set, 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.  Notice: if you're using virtual machines (like Vbox) generic stage3 images are preferred rather than cpu-optimized ones.
+
 
+
To download the correct build of Funtoo Linux for your system, head over to the [[Subarches]] page. Subarches are builds of Funtoo Linux that are designed to run on a particular type of CPU, to offer the best possible performance. They also take advantage of the instruction sets available for each CPU.
+
 
+
The [[Subarches]] page lists all CPU-optimized versions of Funtoo Linux. Find the one that is appropriate for the type of CPU that your system has, and then click on its name in the first column (such as {{c|corei7}}, for example.) You will then go to a page dedicated to that subarch, and the available stage3's available for download will be listed.
+
 
+
For most subarches, you will have several stage3's available to choose from. This next section will help you understand which one to pick.
+
 
+
==== Which Build? ====
+
 
+
'''If you're not sure, pick {{c|funtoo-current}}.'''
+
 
+
Funtoo Linux has various different 'builds':
+
 
+
{{TableStart}}
+
{{2ColHead|Build|Description}}
+
<tr><td>{{c|funtoo-current}}</td><td>The most commonly-selected build of Funtoo Linux. Receives rapid updates and preferred by desktop users.</td></tr>
+
<tr><td>{{c|funtoo-stable}}</td><td>Emphasizes less-frequent package updates and trusted, reliable versions of packages over the latest versions.</td></tr>
+
{{TableEnd}}
+
 
+
==== Which Variant? ====
+
 
+
'''If you're not sure, pick {{c|standard}}.'''
+
 
+
Our "regular" stage3's are listed with a variant of {{c|standard}}. The following variant builds are available:
+
 
+
{{TableStart}}
+
{{2ColHead|Variant|Description}}
+
<tr><td>{{c|standard}}</td><td>The "standard" version of Funtoo Linux</td></tr>
+
<tr><td>{{c|pure64}}</td><td>A 64-bit build that drops multilib (32-bit compatibility) support. Can be ideal for server systems.</td></tr>
+
<tr><td>{{c|hardened}}</td><td>Includes PIE/SSP toolchain for enhanced security. PIE does require the use of PaX in the kernel, while SSP works with any kernel, and provides enhanced security in user-space to avoid stack-based exploits. For expert users.</td></tr>
+
{{TableEnd}}
+
 
+
==== Download the Stage3 ====
+
 
+
Once you have found the stage3 that you would like to download, use {{c|wget}} to download the Stage 3 tarball you have chosen to use as the basis for your new Funtoo Linux system. It should be saved to the {{f|/mnt/funtoo}} directory as follows:
+
{{console|body=
+
###i## cd /mnt/funtoo
+
 
###i## wget http://build.funtoo.org/funtoo-current/x86-64bit/generic_64/stage3-latest.tar.xz
 
###i## wget http://build.funtoo.org/funtoo-current/x86-64bit/generic_64/stage3-latest.tar.xz
}}
+
</console>
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 {{c|generic_64}} or {{c|generic_32}} stage. Consult the [[Subarches]] page for more information.
+
{{fancynote|A snapshot is recommended to allow the rollback to this stage.}}
 
+
The tarball should be extracted using the following command:
Once the stage is downloaded, extract the contents with the following command, substituting in the actual name of your stage 3 tarball:
+
<console>
{{console|body=
+
 
###i## tar xpf stage3-latest.tar.xz
 
###i## tar xpf stage3-latest.tar.xz
}}{{Important|It is very important to use {{c|tar's}} "{{c|'''p'''}}" option when extracting the Stage 3 tarball - it tells {{c|tar}} to ''preserve'' any permissions and ownership that exist within the archive. Without this option, your Funtoo Linux filesystem permissions will be incorrect.}}
+
</console>
 
+
{{Important|Omitting the option '''p''' will result in a broken system!}}
=== Chroot into Funtoo ===
+
{{fancynote|More information could be found under [[Funtoo_Linux_Installation|Now download and extract the Funtoo stage3 ...]]}}
To install Funtoo Linux, the {{c|chroot}} command is first used. The chroot command will "switch into" the new Funtoo Linux system, so the commands you execute after running "chroot" will run within your newly-extracted Funtoo Linux system.
+
  
Before chrooting, there are a few things that need to be done to set up the chroot environment. You will need to mount {{f|/proc}}, {{f|/sys}} and {{f|/dev}} inside your new system. Use the following commands to do so:
+
==== Bind the kernel related directories ====
{{console|body=
+
<console>
# ##i##cd /mnt/funtoo
+
 
# ##i##mount -t proc none proc
 
# ##i##mount -t proc none proc
# ##i##mount --rbind /sys sys
 
 
# ##i##mount --rbind /dev dev
 
# ##i##mount --rbind /dev dev
}}You'll also want to copy over {{f|resolv.conf}} in order to have proper resolution of Internet hostnames from inside the chroot:
+
# ##i##mount --rbind /sys sys
{{console|body=
+
</console>
# ##i##cp /etc/resolv.conf /mnt/funtoo/etc/
+
}}Now you can chroot into your new system. Use <code>env</code> before <code>chroot</code> to ensure that no environment settings from the installation media are pulled in to your new system:
+
  
{{console|body=###i## env -i HOME=/root TERM=$TERM chroot . bash -l}}
+
==== Copy network settings ====
{{Note|For users of live CDs with 64-bit kernels installing 32-bit systems: Some software may use {{c|uname -r}} 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.}}
+
<console>
{{Important|If you receive the error "{{c|chroot: failed to run command `/bin/bash': Exec format error}}", it is most likely because you are running a 32-bit kernel and trying to execute 64-bit code. Make sure that you have selected the proper type of kernel when booting SystemRescueCD.}}
+
# ##i##cp -f /etc/resolv.conf etc
 +
</console>
  
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:
+
==== zpool.cache ====
{{console|body=# ##i##export PS1="(chroot) $PS1"}}
+
<code>zpool.cache</code> is omitted as described above.
Test internet name resolution from within the chroot:
+
{{console|body=###i## ping -c 5 google.com}}
+
If you can't ping, make sure {{f|/etc/resolv.conf}} doesn't contain things like {{c|127.0.x.x}} addresses, if it does, change the {{c|127.0.x.x}} entry to {{c|8.8.8.8}} -- Google's public dns address.  Make sure to replace this with your dns of choice once the system is installed.
+
  
 
+
==== Chroot into Funtoo ====
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 start successfully, without any manual assistance, when your system is restarted.
+
<console>
=== Downloading the Portage tree ===  
+
# ##i##env -i HOME=/root TERM=$TERM chroot . bash -l
 
+
</console>
{{note|For an alternative way to do this, see [[Installing Portage From Snapshot]].}}
+
{{fancynote|Using the graphical installation environment as described above, allows now to open several windows and changing the root into the chroot environment usind the following steps:
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 <code>emerge --sync</code> from within the chroot. This will automatically clone the portage tree from [https://github.com/funtoo/ports-2012 GitHub]:
+
<console>
 
+
# ##i##cd /mnt/funtoo
{{console|body=
+
# ##i##env -i HOME=/root TERM=$TERM chroot . bash -l
(chroot) ###i## emerge --sync
+
</console>
 +
This allows you to prepare allready the next steps, while the previous is still busy.
 
}}
 
}}
{{important|If you receive the error with initial {{c|emerge --sync}} due to git protocol restrictions, set the {{c|SYNC}} variable in {{c|/etc/portage/make.conf}} to
+
==== Setup portage ====
{{c|"https://github.com/funtoo/ports-2012.git"}}
+
Now you should think a little about how to set up <code>MAKEOPTS</code>, <code>LINGUAS</code> and <code>VIDEO_CARDS</code> in your portage <code>make.conf</code> file.
}}
+
==== Setup /etc/fstab ====
 
+
{{file|name=/etc/fstab|desc= |body=
=== Configuring your system ===
+
# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>
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 {{f|/etc/fstab}}. The others are optional.
+
 
+
==== Using Nano ====  
+
 
+
The default editor included in the chroot environment is called {{c|nano}}. To edit one of the files below, run nano as follows:
+
  
{{console|body=
+
tank/funtoo/ROOT              /          zfs            noatime        0 0
(chroot) ###i## nano /etc/fstab
+
 
}}
 
}}
When in the editor, you can use arrow keys to move the cursor, and common keys like backspace and delete will work as expected. To save the file, press Control-X, and answer {{c|y}} when prompted to save the modified buffer if you would like to save your changes.
+
==== Setup /etc/mtab ====
 
+
<code>zfs</code> and <code>zpool</code> will need it:
==== Configuration Files ====
+
 
+
Here are a full list of files that you may want to edit, depending on your needs:
+
{{TableStart}}
+
{{3ColHead|File|Do I need to change it?|Description}}
+
<tr  class="danger">
+
<td>{{c|/etc/fstab}}</td>
+
<td>'''YES - required'''</td>
+
<td>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.</td>
+
</tr><tr>
+
<td>{{c|/etc/localtime}}</td>
+
<td>''Maybe - recommended''</td>
+
<td>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) </td>
+
</tr><tr>
+
<td>{{c|/etc/make.conf}} (symlink) - also known as:<br/>{{c|/etc/portage/make.conf}}</td>
+
<td>''Maybe - recommended''</td>
+
<td>Parameters used by gcc (compiler), portage, and make. It's a good idea to set MAKEOPTS. This is covered later in this document.</td>
+
</tr><tr>
+
<td>{{c|/etc/conf.d/hostname}}</td>
+
<td>''Maybe - recommended''</td>
+
<td>Used to set system hostname. Set the {{c|hostname}} variable to the fully-qualified (with dots, ie. {{c|foo.funtoo.org}}) name if you have one. Otherwise, set to the local system hostname (without dots, ie. {{c|foo}}). Defaults to {{c|localhost}} if not set.</td>
+
</tr><tr>
+
<td>{{c|/etc/hosts}}</td>
+
<td>''No''</td>
+
<td> You no longer need to manually set the hostname in this file. This file is automatically generated by {{c|/etc/init.d/hostname}}.</td>
+
</tr><tr>
+
<td>{{c|/etc/conf.d/keymaps}}</td>
+
<td>Optional</td>
+
<td>Keyboard mapping configuration file (for console pseudo-terminals). Set if you have a non-US keyboard. See [[Funtoo Linux Localization]].</td>
+
</tr><tr>
+
<td>{{c|/etc/conf.d/hwclock}}</td>
+
<td>Optional</td>
+
<td>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.</td>
+
</tr><tr>
+
<td>{{c|/etc/conf.d/modules}}</td>
+
<td>Optional</td>
+
<td>Kernel modules to load automatically at system startup. Typically not required. See [[Additional Kernel Resources]] for more info.</td>
+
</tr><tr>
+
<td>{{c|/etc/conf.d/consolefont}}</td>
+
<td>Optional</td>
+
<td>Allows you to specify the default console font. To apply this font, enable the consolefont service by running rc-update add consolefont.</td>
+
</tr><tr>
+
<td>{{c|profiles}}</td>
+
<td>Optional</td>
+
<td>Some useful portage settings that may help speed up intial configuration.</td>
+
</tr>
+
{{TableEnd}}
+
 
+
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 available. (See [[#Community portal|Community]])
+
 
+
Let's go ahead and see what we have to do. Use {{c|nano -w <name_of_file>}} to edit files -- the "{{c|-w}}" argument disables word-wrapping, which is handy when editing configuration files. You can copy and paste from the examples.
+
 
+
{{Warning|It's important to edit your {{c|/etc/fstab}} file before you reboot! You will need to modify both the "fs" and "type" columns to match the settings for your partitions and filesystems that you created with {{c|gdisk}} or {{c|fdisk}}. Skipping this step may prevent Funtoo Linux from booting successfully.}}
+
 
+
==== /etc/fstab ====
+
 
+
{{f|/etc/fstab}} is used by the {{c|mount}} command which is run when your system boots. Lines in this file inform {{c|mount}} about filesystems to be mounted and how they should be mounted. In order for the system to boot properly, you must edit {{f|/etc/fstab}} and ensure that it reflects the partition configuration you used earlier in the install process. If you can't remember the partition configuration that you used earlier, the {{c|lsblk}} command may be of help to you:
+
{{console|body=
+
(chroot) ###i## nano -w /etc/fstab
+
}}
+
{{file|name=/etc/fstab|desc=An example fstab file|body=
+
# The root filesystem should have a pass number of either 0 or 1.
+
# All other filesystems should have a pass number of 0 or greater than 1.
+
#
+
# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
+
#
+
# See the manpage fstab(5) for more information.
+
#
+
# <fs>     <mountpoint>  <type>  <opts>        <dump/pass>
+
 
+
/dev/sda1    /boot        ext2    noauto,noatime 1 2
+
/dev/sda2    none          swap    sw            0 0
+
/dev/sda3    /            ext4    noatime        0 1
+
#/dev/cdrom  /mnt/cdrom    auto    noauto,ro      0 0
+
}}
+
{{Note|Currently, our default {{f|/etc/fstab}}file  has the root filesystem as {{c|/dev/sda4}} and the swap partition as {{c|/dev/sda3}}. These will need to be changed to {{c|/dev/sda3}} and {{c|/dev/sda2}}, respectively.}}
+
 
+
{{Note|If you're using UEFI to boot, change the {{f|/dev/sda1}} line so that it says {{c|vfat}} instead of {{c|ext2}}. Similarly, make sure that the {{f|/dev/sda3}} line specifies either {{c|xfs}} or {{c|ext4}}, depending on which filesystem you chose earlier on in the installation process when you created filesystems.}}
+
 
+
==== /etc/localtime ====
+
 
+
{{f|/etc/localtime}} 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 {{f|/etc/localtime}} with a symbolic link to the timezone that you wish to use.
+
 
+
{{console|body=
+
(chroot) ###i## ln -sf /usr/share/zoneinfo/MST7MDT /etc/localtime
+
}}
+
The above sets the timezone to Mountain Standard Time (with daylight savings). Type {{c|ls /usr/share/zoneinfo}} to list available timezones. There are also sub-directories containing timezones described by location.
+
 
+
==== /etc/portage/make.conf ====
+
 
+
{{c|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 {{c|MAKEOPTS}} to 3:
+
 
+
<pre>
+
MAKEOPTS="-j3"
+
</pre>
+
 
+
If you are unsure about how many processors/threads you have, then use {{c|nproc}} to help you.
+
{{console|body=
+
(chroot) ###i## nproc
+
16
+
}}
+
Set {{c|MAKEOPTS}} to this number plus one:
+
 
+
<pre>
+
MAKEOPTS="-j17"
+
</pre>
+
 
+
{{c|USE}} flags define what functionality is enabled when packages are built. It is not recommended to add a lot of USE flags during installation; you should wait until you have a working, bootable system before changing your USE flags. A USE flag prefixed with a minus ("{{c|-}}") 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&chap=2 Gentoo Handbook].
+
 
+
{{c|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:
+
 
+
<pre>
+
LINGUAS="fr"
+
</pre>
+
 
+
==== /etc/conf.d/hwclock ====
+
If you dual-boot with Windows, you'll need to edit this file and change the value of '''clock''' from '''UTC''' 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.
+
{{console|body=
+
(chroot) ###i## nano -w /etc/conf.d/hwclock
+
}}
+
==== Localization ====
+
 
+
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]].
+
 
+
=== Introducing Portage ===
+
 
+
Portage, the Funtoo Linux package manager has a command called <code>emerge</code> which is used to build and install packages from source. It also takes care of installing all of the package's dependencies. You call emerge like this:
+
 
+
 
<console>
 
<console>
(chroot) # ##i##emerge packagename
+
# ##i##grep -v rootfs /proc/mounts > /etc/mtab
 
</console>
 
</console>
  
When you install a package by specifying its name in the command-line, Portage records its name in the <code>/var/lib/portage/world</code> file. It does so because it assumes that, since you have installed it by name, you want to consider it part of your system and want to keep the package updated in the future. This is a handy feature, since when packages are being added to the <code>world</code> set, we can update our entire system by typing:
+
==== Emerge portage tree ====
 
+
Before we install zfs and the bootchain, we should update our portage tree using:
 
<console>
 
<console>
(chroot) # ##i##emerge --sync
+
# ##i##emerge --sync
(chroot) # ##i##emerge -auDN @world
+
 
</console>
 
</console>
 
+
==== Update the system ====
This is the "official" way to update your Funtoo Linux system. Above, we first update our Portage tree using git to grab the latest ebuilds (scripts), and then run an emerge command to update the <code>world</code> set of packages. The options specified tell <code>emerge</code> to:
+
Now we will update the system using the following command:
 
+
* '''<code>a</code>''' - show us what will be emerged, and '''ask''' us if we want to proceed
+
* '''<code>u</code>''' - '''update''' the packages we specify -- don't emerge them again if they are already emerged.
+
* '''<code>D</code>''' - Consider the entire dependency tree of packages when looking for updates. In other words, do a '''deep''' update.
+
* '''<code>N</code>''' - Update any packages that have changed ('''new''') USE settings.
+
 
+
You should also consider passing <code>--with-bdeps=y</code> when emerging @world, at least once in a while. This will update build dependencies as well.
+
 
+
Of course, sometimes we want to install a package but not add it to the <code>world</code> file. This is often done because you only want the package installed temporarily or because you know the package in question is a dependnecy of another package. If this behavior is desired, you call emerge like this:
+
 
+
 
<console>
 
<console>
(chroot) # ##i##emerge -1 packagename
+
# ##i##emerge --uaDN @world
 
</console>
 
</console>
 
+
{{fancynote|Here consider to make a snapshot, so we could rollback to a clean and updated system... This must be done outside the chroot environment, because here we still have no zfs / zpool installation.}}
Advanced users may be interested in the [[Emerge]] wiki page.
+
==== Emerge genkernel ====
 
+
<code>genkernel</code> is the tool used by gentoo and funtoo to build kernel and initramfs from sources. it supports <code>zfs</code> for the <code>gentoo-sources</code> as mentioned above.
==== Updating World ====  
+
 
+
Now is actually a very good time to update the entire system and it can be a good idea to do so prior to first boot.
+
 
+
 
<console>
 
<console>
(chroot) # ##i##emerge --sync
+
# ##i##emerge genkernel
(chroot) # ##i##emerge -auDN @world
+
 
</console>
 
</console>
 
+
==== Generate initial (unbootable) kernel ====
{{fancyimportant|1=
+
We need to build one first kernel. The <code>zfs</code> needs to find a valid kernel to configure itself properly.  
Make sure you read any post emerge messages and follow their instructions. This is especially true if you have upgraded perl or python.}}
+
 
+
=== Kernel ===
+
 
+
Starting mid-May 2015, Funtoo Linux stage3's include a pre-built {{c|debian-sources}} kernel to make installation faster and easier. To see if debian-sources is installed, type:
+
{{console|body=
+
(chroot) # ##i##emerge -s debian-sources
+
Searching...   
+
[ Results for search key : ##b##debian-sources##!b## ]
+
[ Applications found : ##b##1##!b## ]
+
 
+
*  ##b##sys-kernel/debian-sources##!b##
+
      ##g##Latest version available:##!g## 3.19.3
+
      ##g##Latest version installed:##!g## 3.19.3
+
      ##g##Size of files:##!g## 81,292 kB
+
      ##g##Homepage:##!g##      http://www.debian.org
+
      ##g##Description:##!g##  Debian Sources (and optional binary kernel)
+
      ##g##License:##!g##      GPL-2
+
}}
+
If a version is listed under {{c|Latest version installed}}, then debian-sources is already pre-built for you and you can skip the rest of the Kernel section, and proceed to the [[#Installing a Bootloader|Installing a Bootloader section]].
+
 
+
==== Building the Kernel ====  
+
 
+
If you need to build a kernel for Funtoo Linux, please follow these steps:
+
 
+
{{Fancynote|1=
+
See [[Funtoo Linux Kernels]] for a full list of kernels supported in Funtoo Linux. We recommend <code>debian-sources</code> for new users.}}
+
 
+
{{fancyimportant|1=
+
<code>debian-sources</code> with <code>binary</code> USE flag requires at least 14GB free in <code>/var/tmp</code> and takes around 1 hour to build on a Intel Core i7 Processor.}}
+
 
+
Let's emerge our kernel:
+
 
+
 
<console>
 
<console>
(chroot) # ##i##emerge debian-sources
+
# ##i##genkernel kernel
 
</console>
 
</console>
 
+
{{fancynote|No options are needed... And once the <code>genkernel</code> starts to build the kernel modules, the build may be interrupted with <code>ctrl c</code>. We have, what we need, and the system is still none-bootable.}}
Once <code>emerge</code> completes, you'll have a brand new kernel and initramfs installed to <code>/boot</code>, plus kernel headers installed in <code>/usr/src/linux</code>, and you'll be ready to configure the boot loader to load these to boot your Funtoo Linux system.
+
{{fancynote|As we have done now some cpu consuming tasks, consider to make a snapshot, so we could rollback to a clean and updated system... This must be done outside the chroot environment, because here we still have no zfs / zpool installation.}}
 
+
==== The debian-sources ====
{{warning|If you have a RAID in your machine, the kernel installation will pull in the <code>mdadm</code> tool as a dependency. It is important to edit the <code>/etc/mdadm.conf</code> file prior to rebooting the machine so the RAID is properly recognised and set up before the kernel attempts to mount it in the tree. Failing to do so can result in an unusable or even unbootable system! For specific details, consult the mdadm man page <code>man mdadm</code> or the [[Package:Mdadm|mdadm]] ebuild page.}}
+
From mid 2015 on, funtoo comes with a debian kernel and initramfs preinstalled. At the same time it is configured for debian-sources.  
 
+
Basically the debian distribution has a much better automatic hardware detection and configuration support. That is the advantage. The disadvantage is, we will have to recompile it, and it will take a long time!
{{fancynote|NVIDIA card users: the <code>binary</code> 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 <code>/etc/modprobe.d/</code>.}}
+
So first of all, we may delete the preinstalled kernel and initramfs:
 
+
{{fancynote|For an overview of other kernel options for Funtoo Linux, see [[Funtoo Linux Kernels]]. There may be modules that the Debian kernel doesn't include, a situation where [http://www.funtoo.org/wiki/Funtoo_Linux_Kernels#Using_Debian-Sources_with_Genkernel genkernel] would be useful. Also be sure to see [[:Category:Hardware Compatibility|hardware compatibility]] information.}}
+
 
+
=== Installing a Bootloader ===
+
 
+
These install instructions show you how to use GRUB to boot using BIOS (old-school) or UEFI (new-school). As of boot-update-1.7.2, now in Portage, the steps are very similar.
+
 
+
First, emerge <code>boot-update</code>. This will also cause <code>grub-2</code> and {{c|efibootmgr}} to be merged, since they are dependencies:
+
 
+
 
<console>
 
<console>
(chroot) # ##i##emerge boot-update
+
# ##i##rm /boot*
 
</console>
 
</console>
  
Then, edit <code>/etc/boot.conf</code> using {{c|nano}} and specify "<code>Funtoo Linux genkernel</code>" as the <code>default</code> setting at the top of the file, replacing <code>"Funtoo Linux"</code>.
+
== 3. Add ZFS support ==
 +
Now we will add the ZFS support to the basic funtoo system:
 +
=== The debian-sources ===
 +
Using the debian-sources we have to ensure that the following kernel configuration is set:
  
<code>/etc/boot.conf</code> should now look like this:
+
CONFIG_CALL_SYMS=y
{{file|name=/etc/boot.conf|body=
+
boot {
+
generate grub
+
default "Funtoo Linux genkernel"
+
timeout 3
+
}
+
  
"Funtoo Linux" {
+
CONFIG_PREEMPT_NONE=y
kernel bzImage[-v]
+
}
+
 
+
"Funtoo Linux genkernel" {
+
kernel kernel[-v]
+
initrd initramfs[-v]
+
params += real_root=auto
+
}
+
 
+
"Funtoo Linux better-initramfs" {
+
kernel vmlinuz[-v]
+
initrd /initramfs.cpio.gz
+
}
+
}}
+
If you are booting a custom or non-default kernel, please read <code>man boot.conf</code> for information on the various options available to you.
+
 
+
==== Old School (BIOS) MBR ====
+
 
+
When using "old school" BIOS booting, run the following command to install GRUB to your MBR, and generate the {{c|/boot/grub/grub.cfg}} configuration file that GRUB will use for booting:
+
  
 +
=== Installing the ZFS userspace tools ===
 +
This is a nearly indetical copy by the date of 31.08.2015 from the [[ZFS_Install_Guide]].
 +
Emerge {{Package|sys-fs/zfs}}. This package will bring in {{Package|sys-kernel/spl}}, and {{Package|sys-fs/zfs-kmod}} as its dependencies:
 
<console>
 
<console>
(chroot) # ##i##grub-install --target=i386-pc --no-floppy /dev/sda
+
# ##i##emerge zfs
(chroot) # ##i##boot-update
+
 
</console>
 
</console>
 +
Check to make sure that the zfs tools are working.
 +
<console>
 +
# ##i##zpool status
 +
# ##i##zfs list
 +
# ##i##zfs list -t snapshot
 +
</console>
 +
{{fancynote|If /etc/mtab is missing, these two commands will complaine.
 +
In that case solve that with:
 +
<console>
 +
# ##i##grep -v rootfs /proc/mounts > /etc/mtab
 +
</console>}}
 +
Add the zfs tools to openrc.
 +
<console># ##i##rc-update add zfs boot</console>
 +
{{fancynote|A snapshot is recommended to allow the rollback to this stage. Now you can and should make the snapshot within the chroot environment.}}
 +
=== Installing the ZFS initramfs, kernel and kernel modules  ===
 +
Build now kernel and initramfs and kernel modules:
 +
<console>
 +
# ##i##genkernel all --zfs --no-clean --callback="emerge @module-rebuild"
 +
</console>It looks like the following is working better <code>module-rebuild</code> is fetching <code>debian-sources</code> as well, and overwrites own configuration..
 +
<console>
 +
# ##i##genkernel all --zfs --no-clean --callback="emerge spl zfs-kmod zfs"
 +
</console>
 +
{{fancynote|To force to get a specific kernek configuration, you may use:
 +
<console>
 +
# ##i##genkernel all --zfs --no-clean --kerneldir=/usr/src/linux -- kernel-config=/usr/src/<path_to_config> --callback="emerge spl zfs-kmod zfs"
 +
</console>
 +
The result should be the same.}}
  
==== New School (UEFI) Boot Entry ====
+
=== Emerge, install und configure grub bootloader ===
 
+
This section now describes how to setup our boot configuration to boot from and into the whole disk ZFS.
If you're using "new school" UEFI booting, run of the following sets of commands, depending on whether you are installing a 64-bit or 32-bit system. This will add GRUB as a UEFI boot entry.
+
==== Emerge grub  ====
 
+
To emerge grub, we need to set some permanent USE flags first:
For x86-64bit systems:
+
 
+
 
<console>
 
<console>
(chroot) # ##i##grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id="Funtoo Linux [GRUB]" --recheck /dev/sda
+
# ##i##echo "sys-boot/grub libzfs truetype" >> /etc/portage/package.use
(chroot) # ##i##boot-update
+
# ##i##emerge grub
 
</console>
 
</console>
 +
{{fancynote|Be aware that it is not <code>-truetype</code> but <code>truetype</code>. We will need some fonts to display the grub menu...}}
 +
==== Check grub zfs support ====
 +
The zfs support of grub may be checked by invoking <code>grub-probe</code>:
 +
<console>
 +
# ##i##grub-probe .
 +
</console>
 +
it should return <code>zfs</code> for a directory on the zfs filesystem.
  
For x86-32bit systems:
+
==== Install grub into /boot/grub directory ====
 
+
The command <code>grub-install</code> is basically a script taking care off all installation issues. Presently we tweak it a little to do what we want. In the first step, it will be invoked as usual with standard parameters for only one pool device.
 
<console>
 
<console>
(chroot) # ##i##grub-install --target=i386-efi --efi-directory=/boot --bootloader-id="Funtoo Linux [GRUB]" --recheck /dev/sda
+
# ##i##grub-install /dev/sda
(chroot) # ##i##boot-update
+
 
</console>
 
</console>
 +
That will create the /boot/grub directory and installs grub into it.
 +
It also installs the bootloader into the BIOS grub partition, which will be overwritten later on.
 +
==== Add zfs parameters to grub config ====
 +
Now we need to tell grub to use our whole disk zfs during boot time. That is done in two steps.
 +
First we edit <code>/etc/default/boot</code>
  
==== First Boot, and in the future... ====
+
{{file|name=/etc/default/boot|desc= |body=
 
+
GRUB_CMDLINE_LINUX="boot=zfs rpool=tank bootfs=tank/funtoo/ROOT"
OK -- you are ready to boot!
+
 
+
You only need to run <code>grub-install</code> when you first install Funtoo Linux, but you need to re-run <code>boot-update</code> every time you modify your <code>/etc/boot.conf</code> file or add new kernels to your system. This will regenerate {{c|/boot/grub/grub.cfg}} so that you will have new kernels available in your GRUB boot menu, the next time you reboot.
+
 
+
=== Configuring your network ===
+
 
+
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.
+
 
+
==== Wi-Fi ====
+
 
+
For laptop/mobile systems where you will be using Wi-Fi, roaming, and connecting to various networks NetworkManager is strongly recommended. 
+
Since Wi-Fi cards require firmware to operate, it is also recommended that you emerge the linux-firmware ebuild:
+
 
+
{{console|body=(chroot) # ##i##emerge linux-firmware networkmanager
+
(chroot) ###i## rc-update add NetworkManager default
+
 
}}
 
}}
The above command will ensure that NetworkManager starts after you boot into Funtoo Linux. Once you've completed these installation steps and have booted into Funtoo Linux, you can use the {{c|addwifi}} command to connect to a Wi-Fi access point:
+
Thereafter we invoke <code>grub-mkconfig</code> to generate a new grub config file.
{{console|body=# ##i##addwifi -S wpa -K 'wifipassword' mywifinetwork}}
+
For more information about NetworkManager, see the [[Package:NetworkManager|NetworkManager package page]].
+
 
+
{{Note|wpa_supplicant is also a good choice for wireless network connections. See the {{package|net-wireless/wpa_supplicant}} package for steps involved in setting up wpa_supplicant.}}
+
 
+
==== Desktop (Wired DHCP) ====
+
 
+
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 {{c|dhcpcd}} to the default runlevel:
+
 
+
{{console|body=
+
(chroot) # ##i##rc-update add dhcpcd default}}
+
When you reboot, {{c|dhcpcd}} will run in the background and manage all network interfaces and use DHCP to acquire network addresses from a DHCP server.
+
 
+
If your upstream DHCP server is dnsmasq, it can be configured to assign addresses via mac address to make servers on DHCP feasible.
+
 
+
==== Server (Static IP) ====
+
 
+
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.
+
 
+
==== Hostname ====
+
By default Funtoo uses "localhost" as hostname. Although the system will work perfectly fine using this name, some ebuilds refuse to install when detecting localhost as hostname. It also may create confusion if several systems use the same hostname. Therefore, it is advised to change it to a more meaningful name. The hostname itself is arbitrary, meaning you can choose almost any combination of characters, as long as it makes sense to the system administrator. To change the hostname, edit
+
 
+
{{console|body=
+
(chroot) # ##i##nano /etc/conf.d/hostname
+
}}
+
 
+
Look for the line starting with hostname and change the entry between the quotes. Save the file, on the next boot Funtoo will use the new hostname.
+
 
+
{{warning|Do not use special characters in the hostname, as the shell may interpret these, leading to unpredictable results. Use the Latin alphabet: a-z, A-Z, 0-9}}
+
{{tip|Use short hostnames (up to 8 or 10 characters) to prevent the terminal screen being filled with the hostname, leaving little space for the command itself. This become particularly poignant when coding long command strings in various programming languages like Bash, Python, SQL and Perl}}
+
 
+
=== Finishing Steps ===
+
==== Set your root password ====
+
It's imperative that you set your root password before rebooting so that you can log in.
+
 
<console>
 
<console>
(chroot) # ##i##passwd
+
# ##i##grub-mkconfig -o /boot/grub/grub.cfg
 
</console>
 
</console>
 
+
==== Finally install the grub bootloader ====
===Restart your system ===  
+
As last step, we need to install the grub bootloader properly:
 
+
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.
+
 
+
Leave the chroot, change directory to /mnt, unmount your Funtoo partitions, and reboot.
+
 
<console>
 
<console>
(chroot) # ##i##exit
+
# ##i##grub-install $(readlink -f /dev/disk/by-id/...disk1)
# ##i##cd /mnt
+
# ##i##grub-install $(readlink -f /dev/disk/by-id/...disk2)
# ##i##umount -lR funtoo
+
# ##i##reboot
+
 
</console>
 
</console>
 +
If all went through, without any error report, you have installed now a mirrored whole disk zpool, which may boot from any of the two disks. In any failure of one of the two disks, the system may be booted and recovered easily from the other one.
  
{{fancynote|System Rescue CD will gracefully unmount your new Funtoo filesystems as part of its normal shutdown sequence.}}
+
== 4. Final steps & cleanup ==
 
+
The final steps and the cleanup can be done according [[ZFS_Install_Guide]].
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 <code>login:</code> prompt. Funtoo Linux has been successfully installed!
+
Further installation should be guided by [[Install]] and [[Funtoo_Linux_First_Steps]].
 
+
=== Profiles ===  
+
 
+
Once you have rebooted into Funtoo Linux, you can further customize your system to your needs by using [[Funtoo Profiles]]. A quick introduction to profiles is included below -- consult the [[Funtoo Profiles]] page for more detailed information. There are five basic profile types: arch, build, subarch, flavors and mix-ins:
+
 
+
{{TableStart}}
+
{{2ColHead|Sub-Profile Type|Description}}
+
{{2Col|{{c|arch}}|Typically {{c|x86-32bit}} or {{c|x86-64bit}}, this defines the processor type and support of your system. This is defined when your stage was built and should not be changed.}}
+
{{2Col|{{c|build}}|Defines whether your system is a {{c|current}}, {{c|stable}} or {{c|experimental}} build. {{c|current}} systems will have newer packages unmasked than {{c|stable}} systems. This is defined when your stage is built and is typically not changed.}}
+
{{2Col|{{c|subarch}}|Defines CPU optimizations for your system. The subarch is set at the time the stage3 is built, but can be changed later to better settings if necessary. Be sure to pick a setting that is compatible with your CPU.}}
+
{{2Col|{{c|flavor}}|Defines the general type of system, such as {{c|server}} or {{c|desktop}}, and will set default USE flags appropriate for your needs.}}
+
{{2Col|{{c|mix-ins}}|Defines various optional settings that you may be interested in enabling.}}
+
{{TableEnd}}
+
 
+
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. Often, flavors and mix-ins inherit settings from other sub-profiles. Use {{c|epro show}} to view your current profile settings, in addition to any inheritance information:
+
{{console|body=
+
(chroot) # ##i## epro show
+
 
+
=== ##g##Enabled Profiles##!g##: ===
+
 
+
        arch: ##c## x86-64bit
+
      build: ##c## current
+
    subarch: ##c## intel64-haswell
+
      flavor: ##c## desktop
+
    mix-ins: ##c## gnome
+
 
+
 
+
=== ##g##All inherited flavors from desktop flavor##!g##: ===
+
 
+
                    ##c##workstation##!c## (from desktop flavor)
+
                            ##c##core##!c## (from workstation flavor)
+
                        ##c##minimal##!c## (from core flavor)
+
 
+
=== ##g##All inherited mix-ins from desktop flavor##!g##: ===
+
 
+
                              ##c##X##!c## (from workstation flavor)
+
                          ##c##audio##!c## (from workstation flavor)
+
                            ##c##dvd##!c## (from workstation flavor)
+
                          ##c##media##!c## (from workstation flavor)
+
      ##c##mediadevice-audio-consumer##!c## (from media mix-in)
+
                ##c##mediadevice-base##!c## (from mediadevice-audio-consumer mix-in)
+
      ##c##mediadevice-video-consumer##!c## (from media mix-in)
+
                ##c##mediadevice-base##!c## (from mediadevice-video-consumer mix-in)
+
        ##c##mediaformat-audio-common##!c## (from media mix-in)
+
          ##c##mediaformat-gfx-common##!c## (from media mix-in)
+
        ##c##mediaformat-video-common##!c## (from media mix-in)
+
                  ##c##console-extras##!c## (from workstation flavor)
+
                          ##c##print##!c## (from desktop flavor)
+
}}
+
Here are some basic examples of {{c|epro}} usage:
+
{{TableStart}}
+
{{2ColHead|Description|Command}}
+
{{2Col|View available profiles. Enabled profiles will be highlighted in cyan. Directly enabled profiles will be in bold and have a {{c|*}} appended.|{{console|body=(chroot) # ##i##epro list}}}}
+
{{2Col|Change the system flavor.|{{console|body=(chroot) # ##i##epro flavor desktop}}}}
+
{{2Col|Add a mix-in.|{{console|body=(chroot) # ##i##epro mix-in +gnome}}}}
+
{{TableEnd}}
+
 
+
===Next Steps===
+
 
+
If you are brand new to Funtoo Linux and Gentoo Linux, please check out [[Funtoo Linux First Steps]], which will help get you acquainted with your new system. We also have a category for our [[:Category:Official Documentation|official documentation]], which includes all docs that we officially maintain for installation and operation of Funtoo Linux.
+
 
+
We also have a number of pages dedicated to setting up your system. See [[:Category:First Steps|First Steps]] for a list of these pages.
+
  
If your system did not boot correctly, see [[Installation Troubleshooting]] for steps you can take to resolve the problem.
+
{{important|'''enjoy it!'''}}
[[Category:HOWTO]]
+
[[Category:Install]]
+
[[Category:Official Documentation]]
+

Revision as of 06:34, September 12, 2015

0. Introduction

ZFS seams to be one of the future filesystems. At the time of writing (31.08.2015) booting on ZFS is still a headache. Some linux distributions boot on ext2 partition and run zfs as rootfs like ZFS_Install_Guide and some are able to boot from zfs, some do support zfs only as a filesystem.

Funtoo linux supports ZFS as filesystem and as rootfs, however it does not support it as boot/grub filesystem. For easier search by search engines, it is referred to in this document as whole disk ZFS.

Funtoo linux uses the grub bootloader. So it has been not really understandable, why whole disk ZFS could not be supported by funtoo, as grub is able to do so. Or better, some linux distribution, using the grub bootloader run "whole disk ZFS". What they can, ... yes, we can! ... as well.

This guide is based on many trial and errors - caused by lack of knowledge - the actual ZFS_Install_Guide and a guide for whole disk ZFS for ubuntu. Ubuntu runs als grub bootloader, so some ideas are adapted from there.

Disclaimers

Warning

This guide is a working pretty well on one computer - that is mine! If it does not run on your's, or if it breaks on your's, than you should try to sort the issue out and report it to this page.

So, you may expect that it MAY work! ... and you should be aware that it MAY break your installation. This guide is not developed enough to ENSURE a stable production environment.

... however, I use it for that! ;-) - crazzy as I am.

Important

ZFS will run properly only on 64Bit machines. If you plan to run ZFS with 32Bit, you may also try russian roulette with six bullets. The outcome is clear, and sure not that what you want!

Not covered in this Guide are:

- obvious steps from the regular funtoo installation guide Install and the ZFS installation guide ZFS_Install_Guide

- other partition layouts than GPT

- other kernel sources than gentoo-sources as debian-sources do not work for sure

- usb bootable whole disk ZFS devices (as they need a proper set of udev rules)

- and may be many items more ... ;-)

1. Preparations

In this section, we will prepare everything, to be used during system and boot loader installation.

Create an installation envirnment

To be able to install funtoo on zfs, we need a suitable installation environment. The next steps describe the setup:

Downloading the ISO (With ZFS)

This is a copy by the date of 31.08.2015 from the ZFS_Install_Guide.

In order for us to install Funtoo on ZFS, you will need an environment that already provides the ZFS tools. Therefore we will download a customized version of System Rescue CD with ZFS included.

Name: sysresccd-4.2.0_zfs_0.6.2.iso  (545 MB)
Release Date: 2014-02-25
md5sum 01f4e6929247d54db77ab7be4d156d85
Download System Rescue CD with ZFS

Creating a bootable USB from ISO (From a Linux Environment)

This is a copy by the date of 31.08.2015 from the ZFS_Install_Guide.

After you download the iso, you can do the following steps to create a bootable USB:

Make a temporary directory
# mkdir /tmp/loop

Mount the iso
# mount -o ro,loop /root/sysresccd-4.2.0_zfs_0.6.2.iso /tmp/loop

Run the usb installer
# /tmp/loop/usb_inst.sh

That should be all you need to do to get your flash drive working.

Booting the ISO

While booting the above mentioned iso image - you should use exactly that one, unless you are writing another guide - you shoud use the option E) Alternative 64bit kernel (altker64) with more choice.... 64Bit, as mentioned above.

On the next page you should select 7. SystemRecsueCd with the default graphic environment. The system will come up with a small graphical environment and some tools. One of them is a graphical version of GParted, which will be used in this guide.

Preparing the harddrives

The preparation of the harddrives envolves the following steps:

Cleaning the disks

This guide was developed using GPT partition layout. Any other layout type is not included here.

All below this note is a copy by the date of 31.08.2015 from the respective section of the ZFS_Install_Guide.

First lets make sure that the disk is completely wiped from any previous disk labels and partitions. We will also assume that /dev/sda is the target drive.

# sgdisk -Z /dev/sda
Warning

This is a destructive operation and the program will not ask you for confirmation! Make sure you really don't want anything on this disk.

Note

Do not forget to run this command for each drive participating the new pool. In this guide a mirror pool is created and the devices /dev/sda and /dev/sdb are used.

Create a pool

In this section, we create a whole disk ZFS / zpool. For the convenience of this guide, a mirror pool with the name tank will be created and not mounted (option -m none). Single disk ZFS or even zraid could be used respectively.

The option ashift=12 is set for hard drives with a 4096 sector size commonly used by SSD drives.

#   zpool create -f -o ashift=12 -m none -R /mnt/funtoo tank mirror /dev/sda /dev/sdb 
Important

Here we use the devices /dev/sda and /dev/sdb, and not the partitions as described in the ZFS_Install_Guide. The devices will be partitioned with a GPT partition label and the respective pool including the ZFS filesystems will be created in one step.

The cachefile is omitted, as it only speeds booting and unfortunately creates destructive issues while manipulating the pool later on.

Note

It is preferred to use /dev/disk/by-id/ ... Here it does not really matter, and at the important points we will use the reference to the drives by ID.

zpool status can be used to verify the pool.

Create the zfs datasets

This is a copy by the date of 31.08.2015 from the ZFS_Install_Guide, unless the root dataset has been changed to ROOT to avoid confusions with the normal linux root home directory /root.

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, /usr/src, and /usr/portage. Notice, datasets are examples only and not strictly required.

Create some empty containers for organization purposes, and make the dataset that will hold /
#  zfs create -p tank/funtoo
#  zfs create -o mountpoint=/ tank/funtoo/ROOT

Optional, but recommended datasets: /home
#  zfs create -o mountpoint=/home tank/funtoo/home

Optional datasets: /usr/src, /usr/portage/{distfiles,packages}
#  zfs create -o mountpoint=/usr/src tank/funtoo/src
#  zfs create -o mountpoint=/usr/portage -o compression=off tank/funtoo/portage
#  zfs create -o mountpoint=/usr/portage/distfiles tank/funtoo/portage/distfiles
#  zfs create -o mountpoint=/usr/portage/packages tank/funtoo/portage/packages

df -k can be used to verify the mountpoints.

Create empty snapshot of the pool (purely optional)

Expecting some trial and error during the system installation, a snapshot of the empty disks makes it easy to return this point ... of the game ...

#   zfs snapshot -r tank@000-empty_pool  

zfs list -t snapshot allows to list the existing snapshots. The rollback will be descibed further down in the troubleshooting guide...

Flag the bios_grub partition

The freshly created GPT partition tables of the devices used in the pool contains two partitions. The first and larger one contains the zfs filesystem, the second (number 9), 8.0MiB in size, is reserved by Solaris (BF07).

We use now the graphical tool GParted selecting the partition 9 of each device and set the bios_grub flag. This action will add the flag and changes the partition type to BIOS boot partition (EF02).

This can be done by command line as well ...

2. Basic Funtoo installation

Now the installation environment has been set up, and the harddrives laid out. The next step will be the basic funtoo installation according to the following steps:

Import the pool

For installation purpose, the pool created will be imported under the mountpoint /mnt/funtoo. ashift=12 option which is used for a hard drives with a 4096 sector size.

#   zpool import -f -d /dev/disk/by-id -R /mnt/funtoo tank  

Using zpool status and / or df -k can be used to verify the pool and the mountpoint.

Change directory to the pool's root directory

Then we should change into the pool's mountpoint directory. At the same time this is the root directory of the intended funtoo installation. That is the directory where you will chroot into.

# cd /mnt/funtoo

Download and extract funtoo stage3

It is strongly recommended to use the generic_64 funtoo stage 3 tarball, to avoid a broken build. The download should be done using wget:

# wget http://build.funtoo.org/funtoo-current/x86-64bit/generic_64/stage3-latest.tar.xz
Note

A snapshot is recommended to allow the rollback to this stage.

The tarball should be extracted using the following command:

# tar xpf stage3-latest.tar.xz
Important

Omitting the option p will result in a broken system!

Note

More information could be found under Now download and extract the Funtoo stage3 ...

Bind the kernel related directories

# mount -t proc none proc
# mount --rbind /dev dev
# mount --rbind /sys sys

Copy network settings

# cp -f /etc/resolv.conf etc

zpool.cache

zpool.cache is omitted as described above.

Chroot into Funtoo

# env -i HOME=/root TERM=$TERM chroot . bash -l
Note

Using the graphical installation environment as described above, allows now to open several windows and changing the root into the chroot environment usind the following steps:

# cd /mnt/funtoo
# env -i HOME=/root TERM=$TERM chroot . bash -l

This allows you to prepare allready the next steps, while the previous is still busy.

Setup portage

Now you should think a little about how to set up MAKEOPTS, LINGUAS and VIDEO_CARDS in your portage make.conf file.

Setup /etc/fstab

/etc/fstab
# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

tank/funtoo/ROOT               /           zfs            noatime        0 0

Setup /etc/mtab

zfs and zpool will need it:

# grep -v rootfs /proc/mounts > /etc/mtab

Emerge portage tree

Before we install zfs and the bootchain, we should update our portage tree using:

# emerge --sync

Update the system

Now we will update the system using the following command:

# emerge --uaDN @world
Note

Here consider to make a snapshot, so we could rollback to a clean and updated system... This must be done outside the chroot environment, because here we still have no zfs / zpool installation.

Emerge genkernel

genkernel is the tool used by gentoo and funtoo to build kernel and initramfs from sources. it supports zfs for the gentoo-sources as mentioned above.

# emerge genkernel

Generate initial (unbootable) kernel

We need to build one first kernel. The zfs needs to find a valid kernel to configure itself properly.

# genkernel kernel
Note

No options are needed... And once the genkernel starts to build the kernel modules, the build may be interrupted with ctrl c. We have, what we need, and the system is still none-bootable.

Note

As we have done now some cpu consuming tasks, consider to make a snapshot, so we could rollback to a clean and updated system... This must be done outside the chroot environment, because here we still have no zfs / zpool installation.

The debian-sources

From mid 2015 on, funtoo comes with a debian kernel and initramfs preinstalled. At the same time it is configured for debian-sources. Basically the debian distribution has a much better automatic hardware detection and configuration support. That is the advantage. The disadvantage is, we will have to recompile it, and it will take a long time! So first of all, we may delete the preinstalled kernel and initramfs:

# rm /boot*

3. Add ZFS support

Now we will add the ZFS support to the basic funtoo system:

The debian-sources

Using the debian-sources we have to ensure that the following kernel configuration is set:

CONFIG_CALL_SYMS=y

CONFIG_PREEMPT_NONE=y

Installing the ZFS userspace tools

This is a nearly indetical copy by the date of 31.08.2015 from the ZFS_Install_Guide. Emerge sys-fs/zfs (package not on wiki - please add). This package will bring in sys-kernel/spl (package not on wiki - please add), and sys-fs/zfs-kmod (package not on wiki - please add) as its dependencies:

# emerge zfs

Check to make sure that the zfs tools are working.

# zpool status
# zfs list
# zfs list -t snapshot
Note

If /etc/mtab is missing, these two commands will complaine. In that case solve that with:

# grep -v rootfs /proc/mounts > /etc/mtab

Add the zfs tools to openrc.

# rc-update add zfs boot
Note

A snapshot is recommended to allow the rollback to this stage. Now you can and should make the snapshot within the chroot environment.

Installing the ZFS initramfs, kernel and kernel modules

Build now kernel and initramfs and kernel modules:

# genkernel all --zfs --no-clean --callback="emerge @module-rebuild"
It looks like the following is working better module-rebuild is fetching debian-sources as well, and overwrites own configuration..
# genkernel all --zfs --no-clean --callback="emerge spl zfs-kmod zfs"
Note

To force to get a specific kernek configuration, you may use:

# genkernel all --zfs --no-clean --kerneldir=/usr/src/linux -- kernel-config=/usr/src/<path_to_config> --callback="emerge spl zfs-kmod zfs"

The result should be the same.

Emerge, install und configure grub bootloader

This section now describes how to setup our boot configuration to boot from and into the whole disk ZFS.

Emerge grub

To emerge grub, we need to set some permanent USE flags first:

# echo "sys-boot/grub libzfs truetype" >> /etc/portage/package.use
# emerge grub
Note

Be aware that it is not -truetype but truetype. We will need some fonts to display the grub menu...

Check grub zfs support

The zfs support of grub may be checked by invoking grub-probe:

# grub-probe .

it should return zfs for a directory on the zfs filesystem.

Install grub into /boot/grub directory

The command grub-install is basically a script taking care off all installation issues. Presently we tweak it a little to do what we want. In the first step, it will be invoked as usual with standard parameters for only one pool device.

# grub-install /dev/sda

That will create the /boot/grub directory and installs grub into it. It also installs the bootloader into the BIOS grub partition, which will be overwritten later on.

Add zfs parameters to grub config

Now we need to tell grub to use our whole disk zfs during boot time. That is done in two steps. First we edit /etc/default/boot

/etc/default/boot
GRUB_CMDLINE_LINUX="boot=zfs rpool=tank bootfs=tank/funtoo/ROOT"

Thereafter we invoke grub-mkconfig to generate a new grub config file.

# grub-mkconfig -o /boot/grub/grub.cfg

Finally install the grub bootloader

As last step, we need to install the grub bootloader properly:

# grub-install $(readlink -f /dev/disk/by-id/...disk1)
# grub-install $(readlink -f /dev/disk/by-id/...disk2)

If all went through, without any error report, you have installed now a mirrored whole disk zpool, which may boot from any of the two disks. In any failure of one of the two disks, the system may be booted and recovered easily from the other one.

4. Final steps & cleanup

The final steps and the cleanup can be done according ZFS_Install_Guide. Further installation should be guided by Install and Funtoo_Linux_First_Steps.

Important

enjoy it!