LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 08-12-2014, 07:00 PM   #1
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-Current
Posts: 6,445
Blog Entries: 15

Rep: Reputation: 2015Reputation: 2015Reputation: 2015Reputation: 2015Reputation: 2015Reputation: 2015Reputation: 2015Reputation: 2015Reputation: 2015Reputation: 2015Reputation: 2015
Exclamation [How-To] Add ZFS to the Linux kernel


ZFS-On-Linux is a port of the highly advanced ZFS File System that originated from the Solaris UNIX operating system. Unfortunately due to license issues that have YET to be resolved by the GPL side of things, and trust me this is petty squabbling at it's best and worst, you can't unfortunately get a Linux distribution with ZFS...

...but nobody said anything about building it from scratch yourself, and LFS is a peanut butter sandwich just waiting for some ZFS jelly. Sound tasty?

So do you want the most advanced file system for your own private build? Was that a yes? Is BtrFS still useless to you? Thought so, then, get ready to unpack some sources, and let's proceed.

First off you'll need a working kernel config. I HIGHLY recommend you use a feature complete kernel for this... such as Slackware's.

Let's unpack the sources and copy the config in.

Code:
cd /sources
tar -xvf linux-*.tar.*
cd linux-*
The (*) is mostly to target whatever kernel you may be using.

Now, grab a copy of SPL (the Solaris Porting Layer) from the zfs-on-linux website located at the link below, along with the zfs sources:

http://zfsonlinux.org/

Versions 0.6.3 should be current.

Now let's first get the kernel prepped:

Code:
cd /sources/linux-*
cp -v /boot/config-* .config
make prepare scripts
Now let's get SPL ready and fold it into Linux and the core system

For the next two steps, make sure you replace <version here> with the kernel version number:

Code:
cd ..
tar -xvf spl-*.tar.*
cd spl-*
./configure \
    --prefix=/ \
    --libdir=/lib \
    --includedir=/usr/include \
    --datarootdir=/usr/share \
    --enable-linux-builtin=yes \
    --with-linux=/sources/linux-<version here> \
    --with-linux-obj=/sources/linux-<version here>
./copy-builtin /sources/linux-<version here>
make
make install
Now we'll get the ZFS sources ready and fold them in as well:

Code:
cd ..
tar -xvf zfs-*.tar.*
cd zfs-*
./configure \
    --prefix=/ \
    --libdir=/lib \
    --includedir=/usr/include \
    --datarootdir=/usr/share \
    --enable-linux-builtin=yes \
    --with-linux=/sources/linux-<version here> \
    --with-linux-obj=/sources/linux-<version here> \
    --with-spl=/root/src/spl-0.6.3
    --with-spl-obj=/root/src/spl-0.6.3
./copy-builtin /sources/linux-<version here>
make
make install
Now you should have the SPL and ZFS utilities and libraries installed, now back in the kernel directory:

Code:
cd /sources/linux-*
make menuconfig
You should see options to add SPL and ZFS into the kernel. Make them as modules or as built-in (recommended), and then build your kernel.

You should also add in a dummy fsck.zfs utility as well since ZFS doesn't use this.

Code:
cat > /sbin/fsck.zfs << "EOF"
#!/bin/sh
exit 0
"EOF"
In theory, you could pipe the command to "zpool scrub", but that's not well advised.

Congratulations! You've now got a Linux kernel with support for the most advanced filesystem, ZFS.

Final word of advice:

If you want to create a zpool that mounts using good ol' mount and fstab style options, use something like this command when you configure the zpool:

Code:
zfs set mountpoint=legacy zfs-root
Have fun kiddies!!!

Last edited by ReaperX7; 08-13-2014 at 09:44 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: ZFS File-System Tests On The Linux 3.10 Kernel LXer Syndicated Linux News 0 08-04-2013 07:50 AM
LXer: ZFS as a Linux kernel module? What is the point? LXer Syndicated Linux News 1 08-27-2010 10:54 PM
LXer: Article ZFS data integrity testing and more random ZFS thoughts. LXer Syndicated Linux News 0 05-15-2010 12:51 PM
ZFS Add Disk ? routers Solaris / OpenSolaris 3 06-24-2009 09:48 AM
ZFS Root / Boot into ZFS from a usb flash drive Kataku Solaris / OpenSolaris 1 07-15-2006 04:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 09:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration