bundles/zfs: use zfs-import-scan instead of zfs-import-cache
Last night, rx300 rebooted. After a reboot, the disks were detected in another order (but still, all were detected!), so the cachefile did no longer match, leading to breaking the import. Running `zpool import` manually worked, because that will ignore the cachefile. So, why do we depend on the cache file on boot up? The added reliability of zfs-import-scan beats the speed of zfs-import-cache in any way.
This commit is contained in:
parent
42a66751e1
commit
72cf616114
2 changed files with 39 additions and 7 deletions
10
bundles/zfs/files/zfs-import-scan-override.service
Normal file
10
bundles/zfs/files/zfs-import-scan-override.service
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
ConditionPathExists=
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=
|
||||||
|
% if node.os == 'arch':
|
||||||
|
ExecStart=/usr/bin/zpool import -aN -o cachefile=none
|
||||||
|
% else:
|
||||||
|
ExecStart=/usr/sbin/zpool import -aN -o cachefile=none
|
||||||
|
% endif
|
|
@ -23,11 +23,6 @@ if node.os == 'debian':
|
||||||
'comment': 'If this fails, do a dist-upgrade, reinstall zfs-dkms, reboot',
|
'comment': 'If this fails, do a dist-upgrade, reinstall zfs-dkms, reboot',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
elif node.os == 'arch':
|
|
||||||
for service in ('zfs-import-scan.service', 'zfs-mount.service'):
|
|
||||||
svc_systemd[service] = {}
|
|
||||||
for service in ('zfs.target', 'zfs-import.target'):
|
|
||||||
svc_systemd[service] = {'running': None}
|
|
||||||
|
|
||||||
files = {
|
files = {
|
||||||
'/etc/modprobe.d/zfs.conf': {
|
'/etc/modprobe.d/zfs.conf': {
|
||||||
|
@ -35,6 +30,13 @@ files = {
|
||||||
'content_type': 'mako',
|
'content_type': 'mako',
|
||||||
'mode': '0755',
|
'mode': '0755',
|
||||||
},
|
},
|
||||||
|
'/etc/systemd/system/zfs-import-scan.service.d/bundlewrap.conf': {
|
||||||
|
'source': 'zfs-import-scan-override.service',
|
||||||
|
'content_type': 'mako',
|
||||||
|
'triggers': {
|
||||||
|
'action:systemd-reload',
|
||||||
|
},
|
||||||
|
},
|
||||||
'/etc/zfs-snapshot-config.json': {
|
'/etc/zfs-snapshot-config.json': {
|
||||||
'content': dumps(
|
'content': dumps(
|
||||||
node.metadata.get('zfs/snapshots', {}),
|
node.metadata.get('zfs/snapshots', {}),
|
||||||
|
@ -75,7 +77,27 @@ files = {
|
||||||
}
|
}
|
||||||
|
|
||||||
svc_systemd = {
|
svc_systemd = {
|
||||||
|
'zfs-import-scan.service': {
|
||||||
|
'needs': {
|
||||||
|
'file:/etc/systemd/system/zfs-import-scan.service.d/bundlewrap.conf',
|
||||||
|
},
|
||||||
|
'before': {
|
||||||
|
'svc_systemd:zfs-import-cache.service',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'zfs-import-cache.service': {
|
||||||
|
'running': None,
|
||||||
|
'enabled': False,
|
||||||
|
'masked': True,
|
||||||
|
},
|
||||||
|
'zfs-mount.service': {},
|
||||||
'zfs-zed': {},
|
'zfs-zed': {},
|
||||||
|
'zfs.target': {
|
||||||
|
'running': None,
|
||||||
|
},
|
||||||
|
'zfs-import.target': {
|
||||||
|
'running': None,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, attrs in node.metadata.get('zfs/datasets', {}).items():
|
for name, attrs in node.metadata.get('zfs/datasets', {}).items():
|
||||||
|
@ -90,8 +112,8 @@ for name, attrs in node.metadata.get('zfs/datasets', {}).items():
|
||||||
for name, attrs in node.metadata.get('zfs/pools', {}).items():
|
for name, attrs in node.metadata.get('zfs/pools', {}).items():
|
||||||
zfs_pools[name] = attrs
|
zfs_pools[name] = attrs
|
||||||
|
|
||||||
if node.os_version[0] > 10:
|
if (not node.os == 'debian' or node.os_version[0] > 10) and 'autotrim' not in attrs:
|
||||||
zfs_pools[name]['autotrim'] = attrs.get('autotrim', True)
|
zfs_pools[name]['autotrim'] = True
|
||||||
|
|
||||||
directories = {
|
directories = {
|
||||||
"/etc/zfs-snapshot-backup-pre.d": {
|
"/etc/zfs-snapshot-backup-pre.d": {
|
||||||
|
|
Loading…
Reference in a new issue