mirror of
https://github.com/terem42/zfs-hetzner-vm.git
synced 2025-12-22 23:08:36 +00:00
Merge pull request #20 from terem42/mountservice
remove zfs-boot helper service, obsolete in OpenZFS 2.0
This commit is contained in:
@@ -542,10 +542,12 @@ echo "======= create zfs pools and datasets =========="
|
|||||||
|
|
||||||
zpool create \
|
zpool create \
|
||||||
$v_bpool_tweaks -O canmount=off -O devices=off \
|
$v_bpool_tweaks -O canmount=off -O devices=off \
|
||||||
|
-o cachefile=/etc/zfs/zpool.cache \
|
||||||
-O mountpoint=/boot -R $c_zfs_mount_dir -f \
|
-O mountpoint=/boot -R $c_zfs_mount_dir -f \
|
||||||
$v_bpool_name $pools_mirror_option "${bpool_disks_partitions[@]}"
|
$v_bpool_name $pools_mirror_option "${bpool_disks_partitions[@]}"
|
||||||
|
|
||||||
echo -n "$v_passphrase" | zpool create \
|
echo -n "$v_passphrase" | zpool create \
|
||||||
|
-o cachefile=/etc/zfs/zpool.cache \
|
||||||
$v_rpool_tweaks \
|
$v_rpool_tweaks \
|
||||||
"${encryption_options[@]}" \
|
"${encryption_options[@]}" \
|
||||||
-O mountpoint=/ -R $c_zfs_mount_dir -f \
|
-O mountpoint=/ -R $c_zfs_mount_dir -f \
|
||||||
@@ -728,25 +730,8 @@ chroot_execute "dpkg-reconfigure openssh-server -f noninteractive"
|
|||||||
echo "======= set root password =========="
|
echo "======= set root password =========="
|
||||||
chroot_execute "echo root:$(printf "%q" "$v_root_password") | chpasswd"
|
chroot_execute "echo root:$(printf "%q" "$v_root_password") | chpasswd"
|
||||||
|
|
||||||
echo "======= setting up zfs services =========="
|
echo "======= setting up zfs cache =========="
|
||||||
chroot_execute "cat > /etc/systemd/system/zfs-import-bpool.service <<UNIT
|
cp /etc/zfs/zpool.cache /mnt/etc/zfs/zpool.cache
|
||||||
[Unit]
|
|
||||||
DefaultDependencies=no
|
|
||||||
Before=zfs-import-scan.service
|
|
||||||
Before=zfs-import-cache.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStartPre=/bin/sh -c '[ -f /etc/zfs/zpool.cache ] && mv /etc/zfs/zpool.cache /etc/zfs/preboot_zpool.cache || true'
|
|
||||||
ExecStart=/sbin/zpool import -N -o cachefile=none -d /dev/disk/by-id $v_bpool_name
|
|
||||||
ExecStartPost=/bin/sh -c '[ -f /etc/zfs/preboot_zpool.cache ] && mv /etc/zfs/preboot_zpool.cache /etc/zfs/zpool.cache || true'
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=zfs-import.target
|
|
||||||
UNIT"
|
|
||||||
|
|
||||||
chroot_execute "systemctl enable zfs-import-bpool.service"
|
|
||||||
|
|
||||||
echo "========setting up zfs module parameters========"
|
echo "========setting up zfs module parameters========"
|
||||||
chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024)) >> /etc/modprobe.d/zfs.conf"
|
chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024)) >> /etc/modprobe.d/zfs.conf"
|
||||||
@@ -841,7 +826,7 @@ fi
|
|||||||
|
|
||||||
echo "======= setting mountpoints =========="
|
echo "======= setting mountpoints =========="
|
||||||
chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/debian"
|
chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/debian"
|
||||||
chroot_execute "echo $v_bpool_name/BOOT/debian /boot zfs nodev,relatime,x-systemd.requires=zfs-import-bpool.service 0 0 > /etc/fstab"
|
chroot_execute "echo $v_bpool_name/BOOT/debian /boot zfs nodev,relatime,x-systemd.requires=zfs-mount.service,x-systemd.device-timeout=10 0 0 > /etc/fstab"
|
||||||
|
|
||||||
chroot_execute "zfs set mountpoint=legacy $v_rpool_name/var/log"
|
chroot_execute "zfs set mountpoint=legacy $v_rpool_name/var/log"
|
||||||
chroot_execute "echo $v_rpool_name/var/log /var/log zfs nodev,relatime 0 0 >> /etc/fstab"
|
chroot_execute "echo $v_rpool_name/var/log /var/log zfs nodev,relatime 0 0 >> /etc/fstab"
|
||||||
|
|||||||
@@ -542,11 +542,13 @@ echo "======= create zfs pools and datasets =========="
|
|||||||
|
|
||||||
zpool create \
|
zpool create \
|
||||||
$v_bpool_tweaks -O canmount=off -O devices=off \
|
$v_bpool_tweaks -O canmount=off -O devices=off \
|
||||||
|
-o cachefile=/etc/zfs/zpool.cache \
|
||||||
-O mountpoint=/boot -R $c_zfs_mount_dir -f \
|
-O mountpoint=/boot -R $c_zfs_mount_dir -f \
|
||||||
$v_bpool_name $pools_mirror_option "${bpool_disks_partitions[@]}"
|
$v_bpool_name $pools_mirror_option "${bpool_disks_partitions[@]}"
|
||||||
|
|
||||||
echo -n "$v_passphrase" | zpool create \
|
echo -n "$v_passphrase" | zpool create \
|
||||||
$v_rpool_tweaks \
|
$v_rpool_tweaks \
|
||||||
|
-o cachefile=/etc/zfs/zpool.cache \
|
||||||
"${encryption_options[@]}" \
|
"${encryption_options[@]}" \
|
||||||
-O mountpoint=/ -R $c_zfs_mount_dir -f \
|
-O mountpoint=/ -R $c_zfs_mount_dir -f \
|
||||||
$v_rpool_name $pools_mirror_option "${rpool_disks_partitions[@]}"
|
$v_rpool_name $pools_mirror_option "${rpool_disks_partitions[@]}"
|
||||||
@@ -728,25 +730,9 @@ chroot_execute "dpkg-reconfigure openssh-server -f noninteractive"
|
|||||||
echo "======= set root password =========="
|
echo "======= set root password =========="
|
||||||
chroot_execute "echo root:$(printf "%q" "$v_root_password") | chpasswd"
|
chroot_execute "echo root:$(printf "%q" "$v_root_password") | chpasswd"
|
||||||
|
|
||||||
echo "======= setting up zfs services =========="
|
echo "======= setting up zfs cache =========="
|
||||||
chroot_execute "cat > /etc/systemd/system/zfs-import-bpool.service <<UNIT
|
|
||||||
[Unit]
|
|
||||||
DefaultDependencies=no
|
|
||||||
Before=zfs-import-scan.service
|
|
||||||
Before=zfs-import-cache.service
|
|
||||||
|
|
||||||
[Service]
|
cp /etc/zfs/zpool.cache /mnt/etc/zfs/zpool.cache
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStartPre=/bin/sh -c '[ -f /etc/zfs/zpool.cache ] && mv /etc/zfs/zpool.cache /etc/zfs/preboot_zpool.cache || true'
|
|
||||||
ExecStart=/sbin/zpool import -N -o cachefile=none -d /dev/disk/by-id $v_bpool_name
|
|
||||||
ExecStartPost=/bin/sh -c '[ -f /etc/zfs/preboot_zpool.cache ] && mv /etc/zfs/preboot_zpool.cache /etc/zfs/zpool.cache || true'
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=zfs-import.target
|
|
||||||
UNIT"
|
|
||||||
|
|
||||||
chroot_execute "systemctl enable zfs-import-bpool.service"
|
|
||||||
|
|
||||||
echo "========setting up zfs module parameters========"
|
echo "========setting up zfs module parameters========"
|
||||||
chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024)) >> /etc/modprobe.d/zfs.conf"
|
chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024)) >> /etc/modprobe.d/zfs.conf"
|
||||||
@@ -844,7 +830,7 @@ fi
|
|||||||
|
|
||||||
echo "======= setting mountpoints =========="
|
echo "======= setting mountpoints =========="
|
||||||
chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/debian"
|
chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/debian"
|
||||||
chroot_execute "echo $v_bpool_name/BOOT/debian /boot zfs nodev,relatime,x-systemd.requires=zfs-import-bpool.service 0 0 > /etc/fstab"
|
chroot_execute "echo $v_bpool_name/BOOT/debian /boot zfs nodev,relatime,x-systemd.requires=zfs-mount.service,x-systemd.device-timeout=10 0 0 > /etc/fstab"
|
||||||
|
|
||||||
chroot_execute "zfs set mountpoint=legacy $v_rpool_name/var/log"
|
chroot_execute "zfs set mountpoint=legacy $v_rpool_name/var/log"
|
||||||
chroot_execute "echo $v_rpool_name/var/log /var/log zfs nodev,relatime 0 0 >> /etc/fstab"
|
chroot_execute "echo $v_rpool_name/var/log /var/log zfs nodev,relatime 0 0 >> /etc/fstab"
|
||||||
|
|||||||
@@ -509,11 +509,13 @@ echo "======= create zfs pools and datasets =========="
|
|||||||
|
|
||||||
zpool create \
|
zpool create \
|
||||||
$v_bpool_tweaks -O canmount=off -O devices=off \
|
$v_bpool_tweaks -O canmount=off -O devices=off \
|
||||||
|
-o cachefile=/etc/zfs/zpool.cache \
|
||||||
-O mountpoint=/boot -R $c_zfs_mount_dir -f \
|
-O mountpoint=/boot -R $c_zfs_mount_dir -f \
|
||||||
$v_bpool_name $pools_mirror_option "${bpool_disks_partitions[@]}"
|
$v_bpool_name $pools_mirror_option "${bpool_disks_partitions[@]}"
|
||||||
|
|
||||||
echo -n "$v_passphrase" | zpool create \
|
echo -n "$v_passphrase" | zpool create \
|
||||||
$v_rpool_tweaks \
|
$v_rpool_tweaks \
|
||||||
|
-o cachefile=/etc/zfs/zpool.cache \
|
||||||
"${encryption_options[@]}" \
|
"${encryption_options[@]}" \
|
||||||
-O mountpoint=/ -R $c_zfs_mount_dir -f \
|
-O mountpoint=/ -R $c_zfs_mount_dir -f \
|
||||||
$v_rpool_name $pools_mirror_option "${rpool_disks_partitions[@]}"
|
$v_rpool_name $pools_mirror_option "${rpool_disks_partitions[@]}"
|
||||||
@@ -710,25 +712,8 @@ chroot_execute "dpkg-reconfigure openssh-server -f noninteractive"
|
|||||||
echo "======= set root password =========="
|
echo "======= set root password =========="
|
||||||
chroot_execute "echo root:$(printf "%q" "$v_root_password") | chpasswd"
|
chroot_execute "echo root:$(printf "%q" "$v_root_password") | chpasswd"
|
||||||
|
|
||||||
echo "======= setting up zfs services =========="
|
echo "======= setting up zfs cache =========="
|
||||||
chroot_execute "cat > /etc/systemd/system/zfs-import-bpool.service <<UNIT
|
cp /etc/zfs/zpool.cache /mnt/etc/zfs/zpool.cache
|
||||||
[Unit]
|
|
||||||
DefaultDependencies=no
|
|
||||||
Before=zfs-import-scan.service
|
|
||||||
Before=zfs-import-cache.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStartPre=/bin/sh -c '[ -f /etc/zfs/zpool.cache ] && mv /etc/zfs/zpool.cache /etc/zfs/preboot_zpool.cache || true'
|
|
||||||
ExecStart=/sbin/zpool import -N -o cachefile=none $v_bpool_name
|
|
||||||
ExecStartPost=/bin/sh -c '[ -f /etc/zfs/preboot_zpool.cache ] && mv /etc/zfs/preboot_zpool.cache /etc/zfs/zpool.cache || true'
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=zfs-import.target
|
|
||||||
UNIT"
|
|
||||||
|
|
||||||
chroot_execute "systemctl enable zfs-import-bpool.service"
|
|
||||||
|
|
||||||
echo "========setting up zfs module parameters========"
|
echo "========setting up zfs module parameters========"
|
||||||
chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024)) >> /etc/modprobe.d/zfs.conf"
|
chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024)) >> /etc/modprobe.d/zfs.conf"
|
||||||
@@ -833,7 +818,7 @@ chroot_execute "zfs set canmount=noauto rpool"
|
|||||||
|
|
||||||
echo "======= setting mountpoints =========="
|
echo "======= setting mountpoints =========="
|
||||||
chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/ubuntu"
|
chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/ubuntu"
|
||||||
chroot_execute "echo $v_bpool_name/BOOT/ubuntu /boot zfs nodev,relatime,x-systemd.requires=zfs-import-bpool.service 0 0 > /etc/fstab"
|
chroot_execute "echo $v_bpool_name/BOOT/ubuntu /boot zfs nodev,relatime,x-systemd.requires=zfs-mount.service,x-systemd.device-timeout=10 0 0 > /etc/fstab"
|
||||||
|
|
||||||
chroot_execute "zfs set mountpoint=legacy $v_rpool_name/var/log"
|
chroot_execute "zfs set mountpoint=legacy $v_rpool_name/var/log"
|
||||||
chroot_execute "echo $v_rpool_name/var/log /var/log zfs nodev,relatime 0 0 >> /etc/fstab"
|
chroot_execute "echo $v_rpool_name/var/log /var/log zfs nodev,relatime 0 0 >> /etc/fstab"
|
||||||
|
|||||||
@@ -509,11 +509,13 @@ echo "======= create zfs pools and datasets =========="
|
|||||||
|
|
||||||
zpool create \
|
zpool create \
|
||||||
$v_bpool_tweaks -O canmount=off -O devices=off \
|
$v_bpool_tweaks -O canmount=off -O devices=off \
|
||||||
|
-o cachefile=/etc/zfs/zpool.cache \
|
||||||
-O mountpoint=/boot -R $c_zfs_mount_dir -f \
|
-O mountpoint=/boot -R $c_zfs_mount_dir -f \
|
||||||
$v_bpool_name $pools_mirror_option "${bpool_disks_partitions[@]}"
|
$v_bpool_name $pools_mirror_option "${bpool_disks_partitions[@]}"
|
||||||
|
|
||||||
echo -n "$v_passphrase" | zpool create \
|
echo -n "$v_passphrase" | zpool create \
|
||||||
$v_rpool_tweaks \
|
$v_rpool_tweaks \
|
||||||
|
-o cachefile=/etc/zfs/zpool.cache \
|
||||||
"${encryption_options[@]}" \
|
"${encryption_options[@]}" \
|
||||||
-O mountpoint=/ -R $c_zfs_mount_dir -f \
|
-O mountpoint=/ -R $c_zfs_mount_dir -f \
|
||||||
$v_rpool_name $pools_mirror_option "${rpool_disks_partitions[@]}"
|
$v_rpool_name $pools_mirror_option "${rpool_disks_partitions[@]}"
|
||||||
@@ -711,25 +713,8 @@ chroot_execute "dpkg-reconfigure openssh-server -f noninteractive"
|
|||||||
echo "======= set root password =========="
|
echo "======= set root password =========="
|
||||||
chroot_execute "echo root:$(printf "%q" "$v_root_password") | chpasswd"
|
chroot_execute "echo root:$(printf "%q" "$v_root_password") | chpasswd"
|
||||||
|
|
||||||
echo "======= setting up zfs services =========="
|
echo "======= setting up zfs cache =========="
|
||||||
chroot_execute "cat > /etc/systemd/system/zfs-import-bpool.service <<UNIT
|
cp /etc/zfs/zpool.cache /mnt/etc/zfs/zpool.cache
|
||||||
[Unit]
|
|
||||||
DefaultDependencies=no
|
|
||||||
Before=zfs-import-scan.service
|
|
||||||
Before=zfs-import-cache.service
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=yes
|
|
||||||
ExecStartPre=/bin/sh -c '[ -f /etc/zfs/zpool.cache ] && mv /etc/zfs/zpool.cache /etc/zfs/preboot_zpool.cache || true'
|
|
||||||
ExecStart=/sbin/zpool import -N -o cachefile=none $v_bpool_name
|
|
||||||
ExecStartPost=/bin/sh -c '[ -f /etc/zfs/preboot_zpool.cache ] && mv /etc/zfs/preboot_zpool.cache /etc/zfs/zpool.cache || true'
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=zfs-import.target
|
|
||||||
UNIT"
|
|
||||||
|
|
||||||
chroot_execute "systemctl enable zfs-import-bpool.service"
|
|
||||||
|
|
||||||
echo "========setting up zfs module parameters========"
|
echo "========setting up zfs module parameters========"
|
||||||
chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024)) >> /etc/modprobe.d/zfs.conf"
|
chroot_execute "echo options zfs zfs_arc_max=$((v_zfs_arc_max_mb * 1024 * 1024)) >> /etc/modprobe.d/zfs.conf"
|
||||||
@@ -834,7 +819,7 @@ chroot_execute "zfs set canmount=noauto rpool"
|
|||||||
|
|
||||||
echo "======= setting mountpoints =========="
|
echo "======= setting mountpoints =========="
|
||||||
chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/ubuntu"
|
chroot_execute "zfs set mountpoint=legacy $v_bpool_name/BOOT/ubuntu"
|
||||||
chroot_execute "echo $v_bpool_name/BOOT/ubuntu /boot zfs nodev,relatime,x-systemd.requires=zfs-import-bpool.service 0 0 > /etc/fstab"
|
chroot_execute "echo $v_bpool_name/BOOT/ubuntu /boot zfs nodev,relatime,x-systemd.requires=zfs-mount.service,x-systemd.device-timeout=10 0 0 > /etc/fstab"
|
||||||
|
|
||||||
chroot_execute "zfs set mountpoint=legacy $v_rpool_name/var/log"
|
chroot_execute "zfs set mountpoint=legacy $v_rpool_name/var/log"
|
||||||
chroot_execute "echo $v_rpool_name/var/log /var/log zfs nodev,relatime 0 0 >> /etc/fstab"
|
chroot_execute "echo $v_rpool_name/var/log /var/log zfs nodev,relatime 0 0 >> /etc/fstab"
|
||||||
|
|||||||
Reference in New Issue
Block a user