|
root / base / usr / src / zyginit / services / filesystem
filesystem Plain Text 65 lines 1.8 KB
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# filesystem — Mount all local filesystems from /etc/vfstab + ZFS

[service]
name = "filesystem"
description = "Local filesystem mounts and ZFS imports"
type = "oneshot"

[exec]
start = "/etc/zyginit/services/filesystem/start.sh"
stop = "/etc/zyginit/services/filesystem/stop.sh"

[runlevel]
# /var, /usr, etc. mounts are needed in any operating mode — without
# /var the recovery shell can't even read /var/adm/messages.
mode = "always"

[dependencies]
requires = ["root-fs", "devfs"]

[restart]
on = "never"
#!/bin/zsh
# filesystem — mount local filesystems + import ZFS pools
#
# mountall -l mounts all local-type entries from /etc/vfstab (idempotent
# — skips already-mounted). zpool import -a imports any pools on attached
# disks. ZFS filesystems with mountpoint set auto-mount.

set -e
set -u

# Mount everything in /etc/vfstab with mount-at-boot = yes, excluding /
/usr/sbin/mountall -l

# fdfs (file descriptor pseudo-fs) is in vfstab with mount-at-boot=no per
# illumos convention, but is required by dtrace -C (USDT probe compilation
# preprocesses .d scripts via fd 3 → /dev/fd/3). Mount it explicitly here;
# idempotent (skips if already mounted).
/usr/sbin/mount -F fd fd /dev/fd 2>/dev/null || true

# Import all ZFS pools visible to the system
/usr/sbin/zpool import -a || true

# Auto-mount ZFS filesystems with canmount=on
/usr/sbin/zfs mount -a

exit 0
#!/bin/zsh
# filesystem — umount everything except / before root-fs goes read-only
#
# umountall -l unmounts all local-type filesystems that are NOT /.
# ZFS pools export is handled implicitly by umount of their mountpoints.

set -e
set -u

# Best-effort: anything that can't umount (busy) is logged but doesn't
# block shutdown — ZFS in-kernel state will still checkpoint correctly.
/usr/sbin/umountall -l || true

# Explicitly sync ZFS before root goes ro
/usr/sbin/zpool sync || true

exit 0