ZFS: Difference between revisions

imported>Mic92
This script is just not doing the right thing.
imported>Mic92
replace post command with an ssh oneliner
Line 170: Line 170:
       authorizedKeys = [ "ssh-rsa AAAA..." ];
       authorizedKeys = [ "ssh-rsa AAAA..." ];
     };
     };
    # this will automatically load the zfs password prompt on login
    # and kill the other prompt so boot can continue
    postCommands = ''
      cat <<EOF > /root/.profile
      if pgrep -x "zfs" > /dev/null
      then
        zpool import -a
        zfs load-key -a
        killall zfs
      else
        echo "zfs not running -- maybe the pool is taking some time to load for some unforseen reason."
      fi
      EOF
    '';
   };
   };
};
};
Line 191: Line 177:
boot.kernelModules = [ "r8169" ];
boot.kernelModules = [ "r8169" ];
boot.initrd.kernelModules = [ "r8169" ];</syntaxhighlight>
boot.initrd.kernelModules = [ "r8169" ];</syntaxhighlight>
After that you can unlock your datasets using the following ssh command:
<syntaxhighlight>
ssh root@host -p 2222 "zpool import -a; zfs load-key -a && killall zfs"
</syntaxhighlight>


== NFS share ==
== NFS share ==