-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Right way to boot from vanilla ZFS pool placed on entire disk? #2028
Comments
read the rlaager zfs guide for more details on the setup you're using https://github.com/rlaager/zfs/wiki/HOWTO-install-Ubuntu-to-a-Native-ZFS-Root-Filesystem On Sun, Jan 5, 2014 at 11:35 AM, Stanislav Seletskiy <
|
@aarcane: Thank, didn't see that guide. It's almost how did I do this stuff. Anyway, what's preferred way to use ZFS: use separate boot partition or install GRUB into spare space on GPT table? |
On Jan 8, 2014 6:21 AM, "Stanislav Seletskiy" [email protected]
There really is no single preferred way. It comes down to personal
|
@aarcane: So, there is no possible performance flaw or any other drawbacks while using ZFS pool built on top of DOS partition? |
Each has minor impacts, but they're more to convenience than anything else. Some people believe that using zfsonlinux without a /boot partition is more
|
My understanding of this (I've done all possible variants, included encrypted /boot and/or root) that using grub on GPT is a hassle... I'm using /boot on an external USB stick (which isn't mounted at all, other than manually when I need to), but everything else now on ZFS. My point of this was to put the encryption keys on that and then ... 'hide' it once it's booted :). I haven't really gotten that far yet, but still. |
Slightly off topic, how did you achieve encrypted /boot? That's a goal of
|
@aarcane Well, I am using the ZFS-Crypto patch by ZFSRogue and the zfs-initram package from the ZoL Debian GNU/Linux Wheezy repository takes care of copying the relevant modules, keys etc to the initrd. The problem was for the boot process to find the key. That, unfortunately, needs to be in a non-encrypted place at the moment (which in some degree makes an encrypted /boot pointless I guess). Last week I did however boot on an encrypted version of my root fs (using my USB stick as storage for the initrd which had the crypto key). Using DM crypt should be easier, because that apparently have the option to 'embed' the key somehow/somewhere - I only took a cursory glance at that while I was trying to figure out how to do encrypted /boot. |
Oh. Not impressive. I thought you had mastered the elusive "nothing
|
Ah, no. Sorry. That was the ultimate goal of course, but I could find no way to embed the key. But as I said, this should be possible with dmcrypt... |
@aarcane: Thanks for answer! I'm using ZFS on kinda production servers, so there simply no need to auto fallback, because of all system updates are performed manually. BTW, what is the "initramfs issue" you're talking about? @FransUrbo: I'm event afraid to imagine how to boot dozen of servers using USB sticks. |
On Wed, Jan 8, 2014 at 9:42 PM, Stanislav Seletskiy <
There is currently no way to tell dkms and initramfs hooks to not touch You have to do all of these checks whether you're using a /boot partition |
@aarcane: Ah, that kind of issue. I'm using Arch and usually there is no such problem, because of there is always recent stable zfs package in repo that built against latest available kernel. Anyway, system can be recovered by booting from live cd and downgrading kernel+zfs packages. |
I am using the exact same setup without /boot partition, i.e. a single root pool with a filesystem for my Ubuntu root fs. However, I put /boot/grub in a separate filesystem, so I have access across all clones of my root filesystem. The downside of this approach is that grub-update doesn't recognize other clones of your root, so it messes up your grub.cfg. However, one can easily roll back and manage entries manually or completely disable the update-grub hook. The main advantage of this approach, is that your system always stays bootable, because you are referring to cloned snapshots of your root filesystem for loading the kernel and initramfs. So in case something goes wrong, when updating, I simply go back to an older clone. Apart from that, I always have an early non-UI (non X) clone, for emergency fallback. The only disadvantage for me is the increased space consumed, but that's up to you, how many snapshots and clones you wanna keep. For every major distribution upgrade, I would always want to boot into a cloned root fs first. Be sure, to not put /var and the like into separate filesystems, as often suggested. This approach is adapted from Solaris boot environments, where beadm managed those for you. Works pretty well. |
Parts of /var belong on /, other parts belong on their own partition. I
There was at one point a fairly popular Solaris based distro that used apt |
|
@aarcane I think what you describe is the apt-clone [0,1] utility from Nexenta--not to be confused with the much more recent package apt-clone [2] in debian and ubuntu which serves a different purpose but was given the same name out of ignorance of Nexenta's work. apt-clone was distributed as part of the apt package, and is a perl script wrapper for apt-get that creates a clone of the current root and then proceeds with package action. Usage is identical to apt-get. Ubuntu has apt-btrfs-snapshot, which could be interesting to compare. Perhaps call whatever results apt-zfs-shapshot. DilOS claims to "contain modified APT and DPKG tools for better works with zones and ZFS features." I have not browsed the DilOS source code, though. |
Not an issue here, but a question.
Let's consider we have ZFS pool
zroot
consisting of one vdev, which is an entire HDD:All OS files are located on that pool, so as /boot directory, and now we need to install a bootloader (GRUB) on that single HDD, nothing special. After some investigations I've figured out how to use GRUB on that configuration, but it is kinda buggy (zfsonlinux/grub#5).
Partition table of /dev/sda is shown below:
As I understand, GRUB needs a partition to be installed to. I've found how to install GRUB on GPT (http://www.wensley.org.uk/gpt), so after pool creating we can install it onto 1 or 9 partition, which is, I think, extremely wrong, because of listed above is not a partitions but a special marks which ZFS uses to store pool data. So if I install GRUB either on 1 or 9 this GRUB data can be easily overwritten by ZFS.
But there is some "free" space in the beginning and the end of the device (which on have size of ~1MB), which can be used to write GRUB. So, I've created a new 1MB partition in the very beginning of the disk and write GRUB onto. Like that:
It makes GRUB recognize partition to install to and it will successfully read kernel from ZFS on the boot time.
All installation guides (even Ubuntu one) that I can find proposes that disk will be partitioned into DOS table contained boot partition on ext filesystem and pool partition contains pool itself (BTW, will performance drop down in that case? when pool is created from a partition, not an entire device?). This is ugly, I think, because of if we need a mirror or raid pool, we should divide every disk into same size partitions, then union all boot partitions (ext) into mdraid device (ugly part), then union all second partitions into ZFS pool.
I somehow managed that it is possible to boot entirely from a GPT and ZFS pool, but I'm not sure how to install GRUB properly in that case. So, my questions are: what is right way to boot from ZFS pool consisting of entire devices, not a partitions? Is booting from GPT as I shown before is reliable one? Is there performance trade-offs when pool is created from a partition, not an entire device? Is it even worth it or should I follow numerous guides and be "happy" with it?
Thanks for attention and sorry for such long reading.
The text was updated successfully, but these errors were encountered: