2

I am running CentOS7 on a virtual instance at Softlayer. There is a block storage device available to the instance via multipath/iscsi

I have successfully had this block device mounted as XFS. I decided I would give ZFS a try. When I manually issue commands to 'mount' this ZFS volume, it works fine.

zpool import -f zfs-data

There are two issues that I am having with ZFS on CentOS7.

  • a.) my zpool isn't automatically mounted on boot
  • b.) the system hangs on reboot

I suspect the solution for (a) could also fix (b).

Lets have a look at (a) first.

There is this discussion on the github page for zfsonlinux CentOs 7. Not mount/import pool after reboot

It appears that the /etc/hostid file is not created when ZFS is installed via yum. So as suggested on this page I run the following command to create it.

dd if=/dev/urandom of=/etc/hostid bs=4 count=1

Then it suddenly occurred to me that it cannot mount automatically because as the machine is booting, ZFS is being loaded before the iSCSI stuff.

from /var/log/boot.log - first column is the line number

81     Starting Import ZFS pools by cache file...
147    Starting Open-iSCSI...

How do I change the load order?

(b) hangs on reboot

If I import the pool and don't write anything to it, I can reboot fine. However as soon as any data is exchanged on the mount, the reboot/shutdown log contains these lines..

Stopping Import network configuration from initramfs...


[  550.096199] end_request: I/O error, dev dm-0, sector 5514152

^^ repeated ten times with different numbers.

WARNING: Pool 'zfs-data' has encountered an uncorrectable I/O failure and has been suspended
[...]
Unmounting /zfs-data...
[...]
A stop job is running for /zfs-data

This never finishes and a HARD reboot is required to get back into the instance.

Any insight would be appreciated.

1 Answer 1

0

Good question... I'm not sure I'd recommend using ZFS in this manner, especially as the block devices are expected to be there at boot. However, remember there are several services associated with ZFS.

zfs-import-cache.service # Import ZFS pools by cache file
zfs-mount.service # Mount ZFS filesystems
zfs-share.service # ZFS file system shares
zfs.target # ZFS startup target

You can modify the timing or dependencies to suit your delayed iSCSI mount.

[Unit]
Description=Import ZFS pools by cache file
DefaultDependencies=no
Requires=systemd-udev-settle.service
After=systemd-udev-settle.service
After=cryptsetup.target
ConditionPathExists=/etc/zfs/zpool.cache

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/sbin/modprobe zfs
ExecStart=/sbin/zpool import -c /etc/zfs/zpool.cache -aN
1
  • I sort of tried this yesterday - the line where you have After=cryptsetup.target, I changed this to After=iscsi.service and then the boot process was so slow and didn't work.
    – anastymous
    Dec 9, 2015 at 10:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .