zfs icon indicating copy to clipboard operation
zfs copied to clipboard

CentOS 7. Not mount/import pool after reboot

Open x09 opened this issue 12 years ago • 52 comments

Hi,

When power is turned off ZFS pool do not correctly export/unmount. After reboot - "no datasets available"

zfs-import-cache.service say:

авг 06 17:10:38 skynet zpool[2245]: cannot import 'STORE': pool may be in use from other system авг 06 17:10:38 skynet zpool[2245]: use '-f' to import anyway авг 06 17:10:38 skynet systemd[1]: zfs-import-cache.service: main process exited, code=exited, status=1/FAILURE авг 06 17:10:38 skynet systemd[1]: Failed to start Import ZFS pools by cache file.

'zpool import STORE' say 'pool may be in use from other system'

zpool import -f STORE work, but until next reboot. Then repeat again.

x09 avatar Aug 07 '14 02:08 x09

Can you check what hostid is being used on your system.

$ dmesg | grep "using hostid"
[    7.066071] SPL: using hostid 0x00000000

# With the pool imported run zdb and look for `hostid`.
$ zdb

behlendorf avatar Aug 07 '14 17:08 behlendorf

dmesg | grep "using hostid" [ 8.642394] SPL: using hostid 0x00000000

sudo zdb STORE: version: 5000 name: 'STORE' state: 0 txg: 101502 pool_guid: 11910095750819889089 errata: 0 hostname: 'skynet' vdev_children: 1 vdev_tree: type: 'root' id: 0 guid: 11910095750819889089 children[0]: type: 'mirror' id: 0 guid: 17803502091298809412 whole_disk: 0 metaslab_array: 33 metaslab_shift: 31 ashift: 9 asize: 400074211328 is_log: 0 create_txg: 4 children[0]: type: 'disk' id: 0 guid: 1967309005541862445 path: '/dev/disk/by-vdev/z4-part1' whole_disk: 1 DTL: 108 create_txg: 4 children[1]: type: 'disk' id: 1 guid: 18368084852077688544 path: '/dev/disk/by-vdev/z500-part1' whole_disk: 1 DTL: 46 create_txg: 4 features_for_read:

x09 avatar Aug 08 '14 02:08 x09

Does everything work properly for a clean shutdown?

behlendorf avatar Aug 08 '14 15:08 behlendorf

after any reboot does not work.

x09 avatar Aug 08 '14 15:08 x09

Saw exactly the same problem. No /etc/hostid file exists after fresh zfs installation. Workaround, after https://github.com/zfsonlinux/zfs/issues/703

dd if=/dev/urandom of=/etc/hostid bs=4 count=1 zpool import -f STORE

Everything fine in subsequent reboot.

ghost avatar Aug 09 '14 00:08 ghost

dd if=/dev/urandom of=/etc/hostid bs=4 count=1 zpool import -f STORE

did not help. ... авг 11 10:41:22 skynet systemd[1]: zfs-import-cache.service: main process exited, code=exited, status=1/FAILURE авг 11 10:41:22 skynet systemd[1]: Failed to start Import ZFS pools by cache file. авг 11 10:41:22 skynet systemd[1]: Unit zfs-import-cache.service entered failed state. авг 11 10:41:22 skynet systemd[1]: Starting Mount ZFS filesystems... авг 11 10:41:22 skynet systemd[1]: Started Mount ZFS filesystems. авг 11 10:41:22 skynet systemd[1]: Starting Sound Card. авг 11 10:41:22 skynet systemd[1]: Reached target Sound Card. авг 11 10:41:22 skynet kernel: EXT4-fs (sda2): re-mounted. Opts: (null) авг 11 10:41:22 skynet zpool[459]: cannot import 'STORE': no such pool or dataset авг 11 10:41:22 skynet zpool[459]: Destroy and re-create the pool from авг 11 10:41:22 skynet zpool[459]: a backup source. ....

x09 avatar Aug 12 '14 05:08 x09

But something has changed. Before you had cannot import 'STORE': pool may be in use from other system Now the error is cannot import 'STORE': no such pool or dataset So it seems the hostid issue is fixed, but somehow you lost the 'STORE' pool along the way.

Does zdb still show any pool? If not, have you tried to create a new pool?

ghost avatar Aug 13 '14 05:08 ghost

i run zpool import STORE (without -f) manually (not via startup service) pool is mounted.

STORE: version: 5000 name: 'STORE' state: 0 txg: 182457 pool_guid: 11910095750819889089 errata: 0 hostid: 1051535331 hostname: 'skynet' vdev_children: 1 vdev_tree: type: 'root' id: 0 guid: 11910095750819889089 children[0]: type: 'mirror' id: 0 guid: 17803502091298809412 whole_disk: 0 metaslab_array: 33 metaslab_shift: 31 ashift: 9 asize: 400074211328 is_log: 0 create_txg: 4 children[0]: type: 'disk' id: 0 guid: 1967309005541862445 path: '/dev/disk/by-vdev/z4-part1' whole_disk: 1 DTL: 108 create_txg: 4 children[1]: type: 'disk' id: 1 guid: 18368084852077688544 path: '/dev/disk/by-vdev/z500-part1' whole_disk: 1 DTL: 46 create_txg: 4

At now, i have

  1. CentOS 7 x64
  2. after start OS, i connect to ssh, do zfs import ..... (without -f)
  3. systemctl restart nfs (systemctl enabled nfs, but nfs dont work with zfs after reboot (( )
  4. zfs set sharenfs=on STORE/.../...

all working fine. Until next reboot ))

x09 avatar Aug 13 '14 08:08 x09

Same problem here. I set /etc/hostid, and now that is okay, but still no pool. Looking at /var/log/messages, I see that the mpt2sas driver is enumerating sata disks for that pool, but after this:

Sep 21 19:16:03 centos7-ha3 kernel: SPL: using hostid 0x1bef8b26 Sep 21 19:16:03 centos7-ha3 zpool: cannot import 'tank-copy': no such pool or dataset Sep 21 19:16:03 centos7-ha3 zpool: Destroy and re-create the pool from Sep 21 19:16:03 centos7-ha3 zpool: a backup source. Sep 21 19:16:03 centos7-ha3 systemd: zfs-import-cache.service: main process exited, code=exited, status=1/FAILURE Sep 21 19:16:03 centos7-ha3 systemd: Failed to start Import ZFS pools by cache file. Sep 21 19:16:03 centos7-ha3 systemd: Unit zfs-import-cache.service entered failed state.

Is something being run in the wrong order? The LSI HBA is presenting the drives too slowly? Any ideas on how to address this? Thanks!

dswartz avatar Sep 21 '14 23:09 dswartz

Pinging this to try to get a helpful workaround. In CentOS 7, due to parallelism in the systemd implementation, I supposedly can't be guaranteed that importing the pool in /etc/rc.local will work. At the moment, I have to import the pool manually, which is obviously not good.

dswartz avatar Sep 23 '14 13:09 dswartz

As a simple workaround you could create e.g. the following crontab entry for root:

@reboot sleep 30; zpool import -a

ghost avatar Sep 23 '14 20:09 ghost

Thanks. Doesn't work quite right (at least on CentOS7). I need to use /sbin/zpool due to crontab search path only referencing /bin and /usr/bin. Also, even though I set up vdev_conf to give me the wwn's for the disks, when I did the cron job, I got:

pool: tank-copy state: ONLINE scan: scrub repaired 0 in 0h53m with 0 errors on Sun Sep 21 00:53:05 2014 config:

    NAME                                               STATE     READ WRITE CKSUM
    tank-copy                                          ONLINE       0     0     0
      mirror-0                                         ONLINE       0     0     0
        ata-ST32000644NS_9WM4V7HS                      ONLINE       0     0     0
        pci-0000:1b:00.0-sas-0x4433221105000000-lun-0  ONLINE       0     0     0

Also, for some reason, the NFS share is not being exported. I seem to need to do this:

zfs set sharenfs=on tank-copy/vsphere

even though it was already on. Not sure how much of this is CentOS7 or not...

dswartz avatar Sep 23 '14 21:09 dswartz

Here's what I seem to need to do (it's worked 5 times in a row lol):

sleep 30 zpool import tank-copy sleep 30 zfs set sharenfs=on tank-copy/vsphere

dswartz avatar Sep 23 '14 21:09 dswartz

Second sleep should not be necessary: @reboot sleep 30; /sbin/zpool import -a; /sbin/zfs share -a

How to change dev names is explained here: http://zfsonlinux.org/faq.html#HowDoIChangeNamesOnAnExistingPool

ghost avatar Sep 23 '14 21:09 ghost

I think I was not clear. I created the vdev_id.conf file to define the wwn names as I wanted. That works just fine (except for this one time when I rebooted and did 'zpool import tank-copy' which should have used the wwn names, but didn't (for reasons I can't explain).

dswartz avatar Sep 23 '14 22:09 dswartz

"Second sleep should not be necessary:"

Except it is :( Note also that 'zfs share -a' is not adequate. I need to set the sharenfs property to trigger something. I'm not just speculating here, I've tried this a dozen different ways to get it to work... Like I said, may be some centos7/zed/systemd thing...

dswartz avatar Sep 23 '14 22:09 dswartz

Seems I am not the only one, any information I can provide to solve this?

rhagu avatar Oct 06 '14 15:10 rhagu

Possibly fixed by #2766 if Dracut is used.

l1k avatar Oct 06 '14 19:10 l1k

I have a similar issue, at least if I simply read the title. Also running CentOS7, and ZOL version is 0.6.3.

My system successfully imports the volume. Both zfs-import-cache.service and zfs-mount.service runs and reports success/status 0. However, I still have to either restart the zfs-mount.service or manually run zfs mount -a.

Short, automatic mounting of datasets do not work, but system detects no issue.

AsavarTzeth avatar Oct 24 '14 19:10 AsavarTzeth

I have the same problem as AsavarTzeth. The pool is visible after a reboot via "zpool list", but it is not mounted. A quick "zfs mount -a" mounts everything fine, but should not be necessary. Tried today with and without SELinux enabled on Centos 7.

Package versions: "zfs" - 0.6.3 release 1.1.el7.centos

MagnusMWW avatar Oct 27 '14 14:10 MagnusMWW