Difference between revisions of "Installing Arch Linux on ZFS"

From ArchWiki
Jump to: navigation, search
(Rewrite article.)
(Add ZFS setup procedures.)
Line 15: Line 15:
 
==Notes before installation==
 
==Notes before installation==
  
* This guide uses the unofficial archzfs repository hosted at http://demizerone.com/archzfs. This repository is packaged by Jesus Alvarez and is signed with his PGP key: [http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x5E1ABF240EE7A126 0EE7A126].
+
* This guide uses the unofficial archzfs repository hosted at http://demizerone.com/archzfs. This repository is maintained by Jesus Alvarez and is signed with his PGP key: [http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0x5E1ABF240EE7A126 0EE7A126].
  
 
* The ZFS packages are tied to the kernel version they were built against. This means it will not be possible to perform kernel updates until new packages (or package sources) are released by the ZFS package maintainer.
 
* The ZFS packages are tied to the kernel version they were built against. This means it will not be possible to perform kernel updates until new packages (or package sources) are released by the ZFS package maintainer.
 +
 +
* This guide currently targets UEFI compatible systems. It should be relatively easy to install ZFS on bios compatible systems using this guide. The sections for BIOS installions exist in this article as stubs to allow easy contributions of content.
 +
 +
==Boot from the installation media==
 +
 +
If you have an existing Arch Linux installation handy, it is possible to create a custom archiso installation media with the ZFS tools pre-installed by following [http://kroweer.wordpress.com/2011/09/07/creating-a-custom-arch-linux-live-usb/ this guide].
 +
 +
Otherwise, you will need the latest archise installation media burned to a CD or a USB key. If you are installing onto a UEFI system, see [[Unified Extensible Firmware Interface#Create UEFI bootable USB from ISO]] for creating UEFI compatible installation media.
 +
 +
==Setup pacman==
 +
 +
Activate the required network connection and then edit {{ic|/etc/pacman.d/mirrorlist}} and configure the mirrors for pacman to use.  Once that is done, edit {{ic|/etc/pacman.conf}} and add the archzfs repository:
 +
 +
{{hc|# nano /etc/pacman.conf|<nowiki>
 +
[archzfs]
 +
Server = http://demizerone.com/archzfs/archiso/$arch</nowiki>
 +
}}
 +
 +
Next, add the archzfs maintainer's PGP key to the local trust:
 +
 +
    # pacman-key -r 0EE7A126
 +
    # pacman-key --lsign-key 0EE7A126
 +
 +
Finally, update the pacman databases,
 +
 +
    # pacman -Syy
 +
 +
==Install needed packages==
 +
 +
This is also the best time to install your favorite text editor, otherwise nano will have to be used.
 +
 +
    # pacman -S archzfs dosfstools gptfdisk vim
 +
 +
==Partition the destination drive==
 +
 +
===UEFI systems===
 +
 +
Use the cgdisk partition utility and create a GPT partition table:
 +
 +
  Part    Size  Type
 +
  ====    =====  =============
 +
      1    512M  EFI (ef00)
 +
      2    512M  Ext4 (8200)
 +
      2    XXXG  Solaris Root (bf00)
 +
 +
{{Note|The EFI partion will be formatted to FAT32 and contain the UEFI boot loader. The Ext4 partition will contain the boot partition and kernel images.}}
 +
 +
{{Note|The filesystem type codes for cgdisk are indicated in the parenthesis after the filesystem name.}}
 +
 +
{{Warning|The EFI partition must be at least 512MB specified by the UEFI standard.}}
 +
 +
===BIOS systems===
 +
 +
This section has not been written yet.
 +
 +
==Format the destination disk==
 +
 +
===UEFI systems===
 +
 +
Format the EFI partition to FAT32
 +
 +
    mkfs.vfat -F 32 /dev/sda1 -n EFIBOOT
 +
 +
Format the Ext4 boot partition
 +
 +
    mkfs.ext4 /dev/sda2 -L BOOT
 +
 +
===BIOS systems===
 +
 +
This section has not been written yet.
 +
 +
==Setup the ZFS filesystem==
 +
 +
First, make sure the ZFS modules are loaded,
 +
 +
    # modprobe zfs
 +
 +
===Create the root zpool===
 +
 +
    # zpool create rpool /dev/disk/by-id/<id-to-partition>
 +
 +
{{Warning|Always use id names when working with ZFS, otherwise import errors will occur.}}
 +
 +
===Create the root filesystem===
 +
 +
    # zfs create rpool/ROOT
 +
 +
create the decendent file system that will hold the installation:
 +
 +
    # zfs create rpool/ROOT/arch
 +
 +
We will set the mountpoints after we have created the filesystems so that they are not mounted automatically by ZFS.
 +
 +
If so desired, sub-filesystem mount points such as /home and /root can be created with the following commands:
 +
 +
    # zfs create rpool/HOME
 +
    # zfs create rpool/HOME/root
 +
 +
For safety, umount all zfs filesystems if they are mounted:
 +
 +
    # zfs umount -a
 +
 +
===Configure the root filesystem===
 +
 +
Now it is time to set the mount point of the root filesystem:
 +
 +
    # zfs set mountpoint=/ rpool/ROOT/arch
 +
 +
and optionally, any sub-filesystems:
 +
 +
    # zfs set mountpoint=/home rpool/HOME
 +
    # zfs set mountpoint=/root rpool/HOME/root
 +
 +
Set the bootfs property on the decendent root filesystem so the bootloader knows where to find the operating system.
 +
 +
    # zpool set bootfs=rpool/ROOT/arch rpool
 +
 +
Export the pool,
 +
 +
    # zpool export rpool
 +
 +
{{Warning|Don't skip this, otherwise you will be required to use -f when importing your pools. This unloads the imported pool.}}
 +
 +
Finally, re-import the pool,
 +
 +
    # zpool import -d /dev/disk/by-id -R /mnt rpool
 +
 +
{{Note|"-d" is not the actual device id, but the /dev/by-id directory containing the symlinks.}}
 +
 +
If there is an error in this step, you can export the pool to redo the command. The ZFS filesystem is now ready to use.

Revision as of 06:16, 5 January 2013

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary end

The Zettabyte File System (ZFS) is an advanced copy-on-write filesystem designed to preserve data integrity from a multitude of possible corruption scenarios as well as provide simple administration features. ZFS makes disk administration effortless with support ZFS storage pools (zpools) and automatic mount handling. First released in 2005 for Solaris OS, ZFS has since become the flag bearer for next generation filesystems.

ZFS was first developed and released by Sun (now owned by Oracle) as Open Source Software licensed under the Common Development and Distribution License (CDDL) which is famously incompatible with the GNU Public License. This incompatiblity prevents ZFS from being merged into the mainline kernel, and generally presents some obsticles for users that want to use ZFS in Linux.

ZFSonLinux.org is a project funded by the Lawrence Livermore National Laboratory to develop a native Linux kernel module for its massive storage requirements and super computers.

Notes before installation

  • The ZFS packages are tied to the kernel version they were built against. This means it will not be possible to perform kernel updates until new packages (or package sources) are released by the ZFS package maintainer.
  • This guide currently targets UEFI compatible systems. It should be relatively easy to install ZFS on bios compatible systems using this guide. The sections for BIOS installions exist in this article as stubs to allow easy contributions of content.

Boot from the installation media

If you have an existing Arch Linux installation handy, it is possible to create a custom archiso installation media with the ZFS tools pre-installed by following this guide.

Otherwise, you will need the latest archise installation media burned to a CD or a USB key. If you are installing onto a UEFI system, see Unified Extensible Firmware Interface#Create UEFI bootable USB from ISO for creating UEFI compatible installation media.

Setup pacman

Activate the required network connection and then edit /etc/pacman.d/mirrorlist and configure the mirrors for pacman to use. Once that is done, edit /etc/pacman.conf and add the archzfs repository:

# nano /etc/pacman.conf
[archzfs]
Server = http://demizerone.com/archzfs/archiso/$arch

Next, add the archzfs maintainer's PGP key to the local trust:

   # pacman-key -r 0EE7A126
   # pacman-key --lsign-key 0EE7A126

Finally, update the pacman databases,

   # pacman -Syy

Install needed packages

This is also the best time to install your favorite text editor, otherwise nano will have to be used.

   # pacman -S archzfs dosfstools gptfdisk vim

Partition the destination drive

UEFI systems

Use the cgdisk partition utility and create a GPT partition table:

  Part     Size   Type
  ====     =====  =============
     1     512M   EFI (ef00)
     2     512M   Ext4 (8200)
     2     XXXG   Solaris Root (bf00)
Note: The EFI partion will be formatted to FAT32 and contain the UEFI boot loader. The Ext4 partition will contain the boot partition and kernel images.
Note: The filesystem type codes for cgdisk are indicated in the parenthesis after the filesystem name.
Warning: The EFI partition must be at least 512MB specified by the UEFI standard.

BIOS systems

This section has not been written yet.

Format the destination disk

UEFI systems

Format the EFI partition to FAT32

   mkfs.vfat -F 32 /dev/sda1 -n EFIBOOT

Format the Ext4 boot partition

   mkfs.ext4 /dev/sda2 -L BOOT

BIOS systems

This section has not been written yet.

Setup the ZFS filesystem

First, make sure the ZFS modules are loaded,

   # modprobe zfs

Create the root zpool

   # zpool create rpool /dev/disk/by-id/<id-to-partition>
Warning: Always use id names when working with ZFS, otherwise import errors will occur.

Create the root filesystem

   # zfs create rpool/ROOT

create the decendent file system that will hold the installation:

   # zfs create rpool/ROOT/arch

We will set the mountpoints after we have created the filesystems so that they are not mounted automatically by ZFS.

If so desired, sub-filesystem mount points such as /home and /root can be created with the following commands:

   # zfs create rpool/HOME
   # zfs create rpool/HOME/root

For safety, umount all zfs filesystems if they are mounted:

   # zfs umount -a

Configure the root filesystem

Now it is time to set the mount point of the root filesystem:

   # zfs set mountpoint=/ rpool/ROOT/arch

and optionally, any sub-filesystems:

   # zfs set mountpoint=/home rpool/HOME
   # zfs set mountpoint=/root rpool/HOME/root

Set the bootfs property on the decendent root filesystem so the bootloader knows where to find the operating system.

   # zpool set bootfs=rpool/ROOT/arch rpool

Export the pool,

   # zpool export rpool
Warning: Don't skip this, otherwise you will be required to use -f when importing your pools. This unloads the imported pool.

Finally, re-import the pool,

   # zpool import -d /dev/disk/by-id -R /mnt rpool
Note: "-d" is not the actual device id, but the /dev/by-id directory containing the symlinks.

If there is an error in this step, you can export the pool to redo the command. The ZFS filesystem is now ready to use.