]>
git.proxmox.com Git - mirror_zfs-debian.git/blob - dracut/90zfs/mount-zfs.sh.in
7 if getargbool
0 zfs_force
-y zfs.force
-y zfsforce
; then
8 warn
"ZFS: Will force-import pools if necessary."
14 # We have ZFS modules loaded, so we're able to import pools now.
15 if [ "$root" = "zfs:AUTO" ] ; then
16 # Need to parse bootfs attribute
17 info
"ZFS: Attempting to detect root from imported ZFS pools."
19 # Might be imported by the kernel module, so try searching before
21 zfsbootfs
=`zpool list -H -o bootfs | sed 'q'`
22 if [ "$?" != "0" ] ||
[ "$zfsbootfs" = "" ] || \
23 [ "$zfsbootfs" = "no pools available" ] ; then
24 # Not there, so we need to import everything.
25 info
"ZFS: Attempting to import additional pools."
26 zpool import
-N -a ${ZPOOL_FORCE}
27 zfsbootfs
=`zpool list -H -o bootfs | sed 'q'`
28 if [ "$?" != "0" ] ||
[ "$zfsbootfs" = "" ] || \
29 [ "$zfsbootfs" = "no pools available" ] ; then
33 warn
"ZFS: No bootfs attribute found in importable pools."
35 # Re-export everything since we're not prepared to take
36 # responsibility for them.
37 zpool list
-H |
while read fs rest
; do
44 info
"ZFS: Using ${zfsbootfs} as root."
46 # Should have an explicit pool set, so just import it and we're done.
47 zfsbootfs
="${root#zfs:}"
48 pool
="${zfsbootfs%%/*}"
49 if ! zpool list
-H $pool > /dev
/null
; then
50 # pool wasn't imported automatically by the kernel module, so
52 info
"ZFS: Importing pool ${pool}..."
53 if ! zpool import
-N ${ZPOOL_FORCE} $pool ; then
54 warn
"ZFS: Unable to import pool ${pool}."
62 # Above should have left our rpool imported and pool/dataset in $root.
63 # We need zfsutil for non-legacy mounts and not for legacy mounts.
64 mountpoint
=`zfs get -H -o value mountpoint $zfsbootfs`
65 if [ "$mountpoint" = "legacy" ] ; then
66 mount
-t zfs
"$zfsbootfs" "$NEWROOT" && ROOTFS_MOUNTED
=yes
68 mount
-o zfsutil
-t zfs
"$zfsbootfs" "$NEWROOT" && ROOTFS_MOUNTED
=yes