LFS with zfsroot (ZFS-On-Linux)
Okay before anyone says License Incompatibility between CDDL and GPL, yes I already know so let's get to the meat and potatoes of this topic.
I have ZFS-On-Linux built on my LFS compliant host (Slackware 14.1 x64) and installed. I have little experience outside of FreeBSD with ZFS (which tends to fairly automate the process), so I would like to know how to actually setup a ZFSRoot partition, zpool, with the exception of my 50MB ext2 boot partition on /dev/sda1. I know you can create a swap partition on ZFS, but I know off hand the methods to create zpools is rather complex compared to setting up JFS, Ext4, or any other Linux based native File System. In the tradition of the LFS books, I would simply like to know the proper command sequences to create a zpool on /dev/sda2 with the remaining file space only with zpool label zfsroot. Just curious, but is this the correct command for creating a zpool, as well as any sequential commands to setup the partitions and the root file system? Code:
zpool create -f -m $LFS ztank /dev/sda2 Code:
zfs create ztank/swap -V 2G -b 4K Code:
/dev/zvol/ztank/swap none swap discard 0 0 Many thanks ahead of time however. :hattip: |
Okay I think I got it.
This is what I used: Code:
zpool create -f -m zroot /mnt/lfs /dev/sda4 Code:
zfs create ztank/swap -V 2G -b 4K I'll have to learn how to dismount these partitions but so far so good. :) I think I have to run: Code:
zpool export zroot |
Thanks for the solution and update.
|
I don't think I'm anywhere near done however. This is still an ongoing effort and until I can get the system actually booted, no way to tell if it'll work.
Still a working Z-LFS would be nice. And actually that Z-LFS has a nice ring to it. |
You are out in space without a tether on this one. Not sure how many people have attempted this. Worthy experiment I'd think.
|
Quote:
If desired, I can post it here (since I keep a journal of virtually everything I do) but be cautioned that a cascade of text will follow and some is specific to my system. Also be advised that I did it atop GPT. Furthermore, I use my own highly-customized initramfs. I'll share everything I have about this but I don't want to imply any warranty above "...it works for me" and I want to keep the hand-holding to a bare minimum. In short, I'll share it with those caveats and a cautionary note you're on your own thereafter. |
Post away good sir!!!
I'm basing mine off of MBR for now, but it should be a fairly straight forward process for either. I know it recommends you add the zpool scrub <pool> to the cron jobs on a weekly basis. I don't mind being out in space on this one. I like how featureful ZFS is and know GNU/Linux+ZFS is fairly much do-it-yourself due to the license. One thing I do like, because LFS is distributed mostly as a book rather than an actual physical distribution, there is not license restriction on redistributing a how-to guide. I wonder if LFS has any hints regarding this? One thing I do know, you have to set up a initrd to load the SPL and ZFS modules ahead of times, cron job, and some other stuff setup like fstab and all, but I've got several guides that all explain different stuff so I'm hoping everything works. |
Quote:
...and remember, it will be provided "as is". At our company, it truly is March Madness. We have several people out of the office and a torrent of tasks that have us working long hours. So, what you see is what you get! |
Quote:
http://www.onairusa.com/ZFS-LFS/ZFS-LFS_20140322.tar.xz Do NOT download it or unpack it until you fully understand and agree to the terms of the following disclaimer, which is also included in the tarball in a longer version: Quote:
|
Quote:
Code:
insmod part_gpt |
I'm already compiling a guide from all of this. Thanks for sharing this. The ZFS sysvinit script was useful. I'm also working on an import of dracut to make loading a proper initramfs more simplified to preload SPL and ZFS modules. I'm hoping to get the first build up and running by Tuesday at least, Friday at most.
If all goes as planned, and my system doesn't take a dump, I'll report back with hopefully good news. I'm still reading through the journal though and have a good question. How long does a zpool scrub take on average? |
System build started today as of 1:00 PM Pacific Time.
Partition label as such: /dev/sda3 - 100MB - ext4 - mounted to /boot /dev/sda4 - 79GB - zfs - mounted to / via $LFS(/mnt/lfs) lz4 compression enabled Ran commands: zpool create -f -m $LFS zroot /dev/sda4 Set zpool cache with: zpool set cachefile=/etc/zfs/zpool.cache zroot enabled lz4 compression with: zfs set compression=lz4 zroot Created zswap and mounted: zfs create zroot/swap -V 2G -b 4K mkswap -f /dev/zroot/swap swapon -v /dev/zroot/swap Create boot directory and mounted sda3 to /boot with: mount -v -t ext4 $LFS/boot /dev/sda3 Began download of all files for LFS... (No errors so far.) Update before I sign off for the day... Currently compiling the system. Should be done with the bootstrap system in about a day or so. Should have the full system built by the weekend maybe, but we'll see. Stopping at Binutils-2.24 Pass 2 for the day. |
Had a nasty incident today. Not sure what happened but the zroot became corrupted on boot up and refused to remount.
Had to destroy the z-volume entirely and start all over again. Not sure what exactly happened there. Going to continue on with LFS using JFS as a temporary measure until I can completely tarball the completed system up, rebuild the ZFS volume and then untar the backup onto the ZFS volume, reset it, and then try again that way. I used the proper dismounting techniques but it claims the volume got corrupted. Very strange. Going to attempt to restore it with the tables as: zvol/root zvol/swap ...as the volume partitions. I really wish there was an easier way to do this, but unfortunately there isn't ArchLinux has a good tutorial I'm going to try after I tarball the system up upon completion. |
All times are GMT -5. The time now is 11:49 AM. |