You are not logged in.

#1 2016-02-07 22:19:12

Sweyn78
Member
From: Alpharetta, Georgia
Registered: 2016-02-07
Posts: 9

Root on a zvol

Is it possible to install root onto a zvol?  I've followed all the instructions and then some for installation onto ZFS, but the boot process is ultimately quitting with the following errors: 

:: running early hook [udev]
starting version 228
:: running hook [zfs]
ash: 1: unknown operand
ERROR: device '' not found. Skipping fsck.
cannot open 'ROOT': no such pool
ZFS: Importing pool ROOT readonly.
:: running late hook [zfs]
:: running cleanup hook [udev]
ERROR: Root device mounted successfully, but /sbin/init does not exist.
Bailing out, you are on your own. Good luck.

I've got an XFS zvol named 'ROOT' inside of a zpool named 'ROOT'.  Any ideas on how to get this to work? 
I tried mounting ROOT/ROOT in the shell, but it complained that the initramfs didn't have XFS support.  Getting that support in there might be a next course-of-action, but I'd have no way of knowing whether that would be enough to get this working. 
Oh, and yes, arch-chroot'ing into the system and such from the ISO works totally fine. 

You can skip this next paragraph;  it's largely gratuitous. 
And to pre-empt the inevitable questions to this effect:  I'm using an XFS-formatted zvol instead of a ZFS dataset because:  (1) I really just wanted to have LVM-esque features like snapshotting and RAID, but LVM's snapshots are terrible, pure mdadm doesn't do snapshots, and btrfs doesn't yet support swapfiles (which means no RAID0'ing or transparently compressing swap) and I don't want to mix systems (it's just weird having swap be the only thing in a zpool while root and prst (see below) are in btrfs), which left ZFS as the only remaining LV manager (and it is honestly the best one out there;  stable and feature-filled);  (2) this is a PC, and ZFS the FS is a lot of overkill and overhead for my usage;  and (3) XFS is, unlike ext4, still actively being developed, and is, as of late, as fast or better in most use cases, according to Phoronix. 

You can skip this paragraph, if you'd like;  I've provided a more legible layout-description in post #6. 
I have four partitions, with an equal layout on both disks (each of which is a 1TB SSHD with a different manufacturing date).  The first partition on each is a VFAT (used for /boot and UEFI), the second is a RAID0 zpool containing a zvol formatted as swap (striping + lz4 is sexy (and inb4 "swap is already striped", no it isn't;  it's only load-balanced.)), the third is a RAID1 zpool containing a zvol formatted as XFS, and the fourth is also a RAID1 zpool containing a zvol formatted as XFS.  The third partition is used for root, and the fourth for directories that are rather portable between distros (thus allowing me to, in theory, reformat partition 3 in its entirety and even install another distro, without worrying about the stuff on partition 4 (I've used Arch on my main computer for the past three years, though, so this is mostly just relevant for a theoretical reinstallation of Arch onto, say, btrfs, sometime in the future)).  The directories in partition 4 are /etc, /var, /usr/local, and /home.  I mount partition 4's zvol to /.prst and then bind-mount its subdirectories into /.  I'm using fstab to mount my zvols, rather than using ZFS to do so.  One of the partition 1's is not used, so I use it for backup of the other partition 1.  RAID1 is being used on 3 and 4 so that I, especially given snapshots, will never have to back my stuff up again >:D (which is great, because I never could be arsed to, anyway). 

You should, however, read this paragraph. 
Okay, so, there's your background info.  So, as a quick reiteration of my question:  Is it possible to have root on a zvol?  If so, how does one go about doing so? 
The only thing I could really find which was relevant to this was:  https://forums.freebsd.org/threads/can- … vol.21275/ .  Idk if this will help any answerers out. 
Thanks in advance!  smile

Last edited by Sweyn78 (2016-02-12 22:44:22)

Offline

#2 2016-02-08 03:37:22

Sweyn78
Member
From: Alpharetta, Georgia
Registered: 2016-02-07
Posts: 9

Re: Root on a zvol

Just found this:  https://bbs.archlinux.org/viewtopic.php?id=174720
I've implemented its recommended solution, and it's fixed some of the errors, but I'm still left with the below: 

:: running early hook [udev]
starting version 228
:: running hook [zfs]
ERROR: device '' not found. Skipping fsck.
cannot open 'ROOT': no such pool
ZFS: Importing pool ROOT.
filesystem 'ROOT/ROOT' cannot be mounted, unable to open the dataset
:: running late hook [zfs]
:: running cleanup hook [udev]
ERROR: Failed to mount the real root device.
Bailing out, you are on your own. Good luck.

I've also gotten XFS working in the initramfs (I'd missed a hook), and the pool isn't read-only anymore, so I know I'm *really* close to getting this, but I don't know the next step(s) to take.

Last edited by Sweyn78 (2016-02-12 16:15:19)

Offline

#3 2016-02-12 17:17:01

Sweyn78
Member
From: Alpharetta, Georgia
Registered: 2016-02-07
Posts: 9

Re: Root on a zvol

I have an idea that should fix it, but unfortunately there's very little info about how to do so:  making a custom hook for initcpio that mounts /. 
If anyone knows how to do this, I would be very grateful.  Thus far, my attempts to do so have failed.

Offline

#4 2016-02-12 17:58:37

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: Root on a zvol

Output of zpool and zfs commands might better communicate your layout than the wall of text in OP. Contents of fstab might also be useful. Most importantly though, what exactly is the situation when you're dropped into initram shell?

And this probably has nothing to do with your problem, but I'm dying to know why you created 2 pools (partitions 3 & 4) with one zvol each, instead of one pool with 2 zvols?


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#5 2016-02-12 18:08:51

Sweyn78
Member
From: Alpharetta, Georgia
Registered: 2016-02-07
Posts: 9

Re: Root on a zvol

It was so I could reformat one of the zpools as something else later on (like btrfs), without affecting the other.  Since I'm using only zvols anyway, the fact that I don't have the space pooled together shouldn't matter. 
And I actually just got it booting, but I had to manually mount stuff in the recovery shell in order to do so.  So the setup works;  I just need it automated. 
And thanks!  I'll remember those tips for posting in the future.  smile
EDIT:  Just realized that having a zvol take up the entire space of a zpool means no room for snapshots (hurr-durr).  So that kind of defeats the purpose.  XD
EDIT:  Just learned about sparse zvols.  Maybe those would get this to work?  Going to reformat and reinstall and see!
EDIT:  Yep, using sparse zvols got snapshotting working.  See the message below for the layout info you wanted.

Last edited by Sweyn78 (2016-02-12 22:24:38)

Offline

#6 2016-02-12 22:10:19

Sweyn78
Member
From: Alpharetta, Georgia
Registered: 2016-02-07
Posts: 9

Re: Root on a zvol

Okay, got that sorted.  Layout is now: 

sda & sdb:  
1: ef00 vfat "BOOT" (on sda) "BBAK" (on sdb)
2: 8200 zfs "zvg0"
3: 8300 zfs mirror "zvg1"
zvols:  
* swap "SWAP" in zvg0
* xfs "ROOT" in zvg1
* xfs "PRST" in zvg1
mount:  
* zvg0/SWAP as swap
* zvg1/ROOT at /
* sda1 at /boot
* sdb1 at /boot/bak
* zvg1/PRST at /.prst
* /.prst/etc at /etc
* /.prst/home at /home
* /.prst/usr/local at /usr/local
* /.prst/var at var

If that's not clear enough, I can get some actual terminal output in here;  it's just I'd have to enter it by hand, so it'd take a sec.

And I put zvg1/ROOT and zvg1/PRST into the same zpool this time, since sparse zvols *can* pool data (wish I'd known they'd existed earlier!).

Last edited by Sweyn78 (2016-02-12 22:39:19)

Offline

#7 2016-02-12 22:29:50

Sweyn78
Member
From: Alpharetta, Georgia
Registered: 2016-02-07
Posts: 9

Re: Root on a zvol

Alright, onto the question you considered most important: 

alphaniner wrote:

Most importantly though, what exactly is the situation when you're dropped into initram shell?

I'm not really sure what you mean.  You wouldn't mean when it happens, because that's included in the transcripts above.  You also probably don't mean which shell I'm using, since Arch's initrams default to ash, and the transcripts above showed I was indeed using ash.  Do you mean the directories visible to me when I drop in?  /new_root is empty, if that's what you're asking;  but I *can* manually mount real root into there and boot up the system, as long as I don't provide any "root=" or "zfs=" arguments at boot.  Otherwise, it kernel-panics when I exit.

Last edited by Sweyn78 (2016-02-12 22:48:16)

Offline

#8 2016-04-11 22:01:33

avi9526
Member
Registered: 2015-05-15
Posts: 116

Re: Root on a zvol

I tried playing with zfs and got "same" (I not sure really) error
It looks like fixed to me, but there were two things I've done and I not sure which one make fix
1) zpool set cachefile=/etc/zfs/zpool.cache $PoolName
**AFTER** zpool import -d /dev/disk/by-partlabel/ -R "$Mount" $PoolName
because of "-R"
2) Removed separated legacy mount point for /etc, not sure if it is important, was afraid that cache file not reachable during boot time

too lazy to read docs…

Last edited by avi9526 (2016-04-11 22:08:17)

Offline

Board footer

Powered by FluxBB