Winston Hoy hat die Gist bearbeitet 6 years ago. Zu Änderung gehen
1 file changed, 1 deletion
arm64-bionic-zfs
| @@ -144,7 +144,6 @@ echo 'HD_IDLE_OPTS="-i 0 -a sda -i $hdd_spindown_timeout -a sdb -i $hdd_spindown | |||
| 144 | 144 | ||
| 145 | 145 | # blacklist UAS driver for unstable devices (OWC Mercury Elite Pro Dual below) | |
| 146 | 146 | echo "options usb-storage quirks=1e91:a3a6:u" > /etc/modprobe.d/rk3328-usb-storage-quirks.conf | |
| 147 | - | echo "options usb-storage quirks=1d6b:0003:u" > /etc/modprobe.d/rk3328-usb-storage-quirks.conf | |
| 148 | 147 | ||
| 149 | 148 | #### Reboot | |
| 150 | 149 | systemctl reboot | |
Winston Hoy hat die Gist bearbeitet 6 years ago. Zu Änderung gehen
1 file changed, 1 insertion
arm64-bionic-zfs
| @@ -144,6 +144,7 @@ echo 'HD_IDLE_OPTS="-i 0 -a sda -i $hdd_spindown_timeout -a sdb -i $hdd_spindown | |||
| 144 | 144 | ||
| 145 | 145 | # blacklist UAS driver for unstable devices (OWC Mercury Elite Pro Dual below) | |
| 146 | 146 | echo "options usb-storage quirks=1e91:a3a6:u" > /etc/modprobe.d/rk3328-usb-storage-quirks.conf | |
| 147 | + | echo "options usb-storage quirks=1d6b:0003:u" > /etc/modprobe.d/rk3328-usb-storage-quirks.conf | |
| 147 | 148 | ||
| 148 | 149 | #### Reboot | |
| 149 | 150 | systemctl reboot | |
Winston Hoy hat die Gist bearbeitet 6 years ago. Zu Änderung gehen
1 file changed, 3 insertions
arm64-bionic-zfs
| @@ -142,5 +142,8 @@ sed -i 's/START_HD_IDLE=.*/START_HD_IDLE=true/' /etc/default/hd-idle | |||
| 142 | 142 | # NOTE: you'll want to edit the next command to target your disks and for your desired timeout | |
| 143 | 143 | echo 'HD_IDLE_OPTS="-i 0 -a sda -i $hdd_spindown_timeout -a sdb -i $hdd_spindown_timeout -l /var/log/hd-idle.log"' >> /etc/default/hd-idle | |
| 144 | 144 | ||
| 145 | + | # blacklist UAS driver for unstable devices (OWC Mercury Elite Pro Dual below) | |
| 146 | + | echo "options usb-storage quirks=1e91:a3a6:u" > /etc/modprobe.d/rk3328-usb-storage-quirks.conf | |
| 147 | + | ||
| 145 | 148 | #### Reboot | |
| 146 | 149 | systemctl reboot | |
Winston Hoy hat die Gist bearbeitet 6 years ago. Zu Änderung gehen
1 file changed, 32 insertions, 17 deletions
arm64-bionic-zfs
| @@ -8,13 +8,17 @@ | |||
| 8 | 8 | hostname='YOUR_DESIRED_HOSTNAME' | |
| 9 | 9 | user='YOUR_USERNAME' | |
| 10 | 10 | hdd_spindown_timeout=1800 | |
| 11 | + | kernel=$(uname -r) | |
| 12 | + | tz='America/New_York' | |
| 13 | + | zpool_name='pool0' | |
| 14 | + | zpool_mount_point='some path' | |
| 11 | 15 | ||
| 12 | 16 | ###### with bionic already installed, ssh as rock64, pass rock64 | |
| 13 | 17 | # gain superuser privilege | |
| 14 | 18 | sudo su | |
| 15 | 19 | ||
| 16 | 20 | # set timezone | |
| 17 | - | timedatectl set-timezone America/New_York | |
| 21 | + | timedatectl set-timezone $tz | |
| 18 | 22 | ||
| 19 | 23 | # adduser | |
| 20 | 24 | adduser "$user" | |
| @@ -41,59 +45,70 @@ passwd -l rock64 | |||
| 41 | 45 | hostnamectl set-hostname "$hostname" | |
| 42 | 46 | ||
| 43 | 47 | # install packages | |
| 44 | - | apt-get install -y \ | |
| 48 | + | apt update && apt upgrade -y | |
| 49 | + | apt install -y \ | |
| 45 | 50 | zfsutils-linux zfs-dkms spl \ | |
| 46 | 51 | samba \ | |
| 47 | - | debhelper hdparm | |
| 52 | + | debhelper hdparm unzip | |
| 48 | 53 | ||
| 49 | 54 | #### fix for kernel module builds | |
| 50 | 55 | #### https://forum.armbian.com/topic/6789-build-zfs-on-rk3328/?tab=comments#comment-53681 | |
| 51 | 56 | # copy kernel source | |
| 52 | 57 | # NOTE: you may need to change these paths for your kernel version | |
| 53 | - | wget -qO- https://github.com/ayufan-rock64/linux-kernel/archive/4.4.167-1169-rockchip-ayufan.tar.gz | tar xvz -C /usr/src | |
| 58 | + | wget -qO- https://github.com/ayufan-rock64/linux-kernel/archive/4.4.190-1233-rockchip-ayufan.tar.gz | tar xvz -C /usr/src | |
| 54 | 59 | ||
| 55 | 60 | # copy kernel source tools + scripts folder for builds to work | |
| 56 | 61 | # NOTE: you may need to change these paths for your kernel version | |
| 57 | - | rsync -a /usr/src/linux-kernel-4.4.167-1169-rockchip-ayufan/tools/ /usr/src/linux-headers-4.4.167-1169-rockchip-ayufan-g3cde5c624c9c/tools/ | |
| 58 | - | rsync -a /usr/src/linux-kernel-4.4.167-1169-rockchip-ayufan/scripts/ /usr/src/linux-headers-4.4.167-1169-rockchip-ayufan-g3cde5c624c9c/scripts/ | |
| 62 | + | rsync -a "/usr/src/linux-kernel-4.4.190-1233-rockchip-ayufan/tools/" "/usr/src/linux-headers-$(uname -r)/tools/" | |
| 63 | + | rsync -a "/usr/src/linux-kernel-4.4.190-1233-rockchip-ayufan/scripts/" "/usr/src/linux-headers-$(uname -r)/scripts/" | |
| 59 | 64 | ||
| 60 | 65 | # comment out selinux | |
| 61 | 66 | # NOTE: read instructions at link, this sed command doesn't work | |
| 62 | - | # sed -i 's/subdir\-\$\(CONFIG_SECURITY_SELINUX\)/#subdir-$(CONFIG_SECURITY_SELINUX)/' /usr/src/linux-headers-4.4.167-1169-rockchip-ayufan-g3cde5c624c9c/scripts/Makefile | |
| 67 | + | # sed -i 's/subdir\-\$\(CONFIG_SECURITY_SELINUX\)/#subdir-$(CONFIG_SECURITY_SELINUX)/' "/usr/src/linux-headers-$(uname -r)/scripts/Makefile" | |
| 63 | 68 | ||
| 64 | 69 | # make kernel scripts | |
| 65 | 70 | # NOTE: you may need to change these paths for your kernel version | |
| 66 | - | cd /usr/src/linux-headers-4.4.167-1169-rockchip-ayufan-g3cde5c624c9c/ | |
| 67 | - | make scripts | |
| 71 | + | cd "/usr/src/linux-headers-$(uname -r)/" | |
| 72 | + | make scripts -j4 | |
| 68 | 73 | ||
| 69 | 74 | #### fix for spl kernel module | |
| 70 | 75 | #### https://forum.armbian.com/topic/6789-build-zfs-on-rk3328/?tab=comments#comment-53681 | |
| 71 | 76 | # remove some KUID lines | |
| 72 | 77 | # NOTE: read instructions at link, didn't get a chance to script it | |
| 73 | - | # vi /var/lib/dkms/spl/0.7.5/source/configure | |
| 78 | + | vi /var/lib/dkms/spl/0.7.5/source/configure | |
| 74 | 79 | ||
| 75 | - | # NOTE: path may vary based on spl version | |
| 80 | + | # NOTE: path may vary based on spl/zfs version | |
| 76 | 81 | dkms build spl/0.7.5 | |
| 77 | - | dkms install --force spl/ | |
| 82 | + | dkms install --force spl/0.7.5 | |
| 78 | 83 | modprobe spl | |
| 79 | 84 | ||
| 85 | + | dkms build zfs/0.7.5 | |
| 86 | + | # this next one failed a few times before succeeding | |
| 87 | + | dkms install --force zfs/0.7.5 | |
| 88 | + | modprobe zfs | |
| 89 | + | ||
| 80 | 90 | # attempt to install again | |
| 81 | - | apt-get install -y \ | |
| 91 | + | apt install -y \ | |
| 82 | 92 | zfsutils-linux zfs-dkms spl \ | |
| 83 | 93 | samba \ | |
| 84 | 94 | debhelper hdparm | |
| 95 | + | ||
| 96 | + | # create directory to mount | |
| 97 | + | mkdir -p some/path | |
| 98 | + | chmod 755 some/path | |
| 99 | + | # create or import zpool | |
| 100 | + | # zpool import some_pool | |
| 85 | 101 | ||
| 86 | 102 | #### configure samba | |
| 87 | 103 | #### https://www.computerbeginnersguides.com/blog/2018/04/27/install-and-configure-samba-in-ubuntu-18-04-bionic-beaver/ | |
| 88 | - | # add curiouser user | |
| 89 | 104 | smbpasswd -a "$user" | |
| 90 | 105 | ||
| 91 | 106 | # add share | |
| 92 | 107 | cat <<EOF >> /etc/samba/smb.conf | |
| 93 | - | [curiouser-backup] | |
| 94 | - | path = SOME_PATH | |
| 108 | + | [NAME OF SHARE] | |
| 109 | + | path = PATH TO SHARE | |
| 95 | 110 | available = yes | |
| 96 | - | valid users = SOME_USER | |
| 111 | + | valid users = $user | |
| 97 | 112 | read only = no | |
| 98 | 113 | browseable = yes | |
| 99 | 114 | public = no | |
Winston Hoy hat die Gist bearbeitet 6 years ago. Zu Änderung gehen
1 file changed, 131 insertions
arm64-bionic-zfs(Datei erstellt)
| @@ -0,0 +1,131 @@ | |||
| 1 | + | #!/bin/bash | |
| 2 | + | ||
| 3 | + | # | |
| 4 | + | # Read this script and modify it before running. It's not tested as is and is not | |
| 5 | + | # meant to be run unsupervised. | |
| 6 | + | # | |
| 7 | + | ||
| 8 | + | hostname='YOUR_DESIRED_HOSTNAME' | |
| 9 | + | user='YOUR_USERNAME' | |
| 10 | + | hdd_spindown_timeout=1800 | |
| 11 | + | ||
| 12 | + | ###### with bionic already installed, ssh as rock64, pass rock64 | |
| 13 | + | # gain superuser privilege | |
| 14 | + | sudo su | |
| 15 | + | ||
| 16 | + | # set timezone | |
| 17 | + | timedatectl set-timezone America/New_York | |
| 18 | + | ||
| 19 | + | # adduser | |
| 20 | + | adduser "$user" | |
| 21 | + | ||
| 22 | + | # add to sudo group | |
| 23 | + | usermod -aG sudo "$user" | |
| 24 | + | ||
| 25 | + | ###### login as user | |
| 26 | + | # generate ssh folder and keys | |
| 27 | + | ssh-keygen -t rsa -b 4096 -C "rock64" | |
| 28 | + | ||
| 29 | + | # add your remote host key to authorized_keys | |
| 30 | + | touch ~/.ssh/authorized_keys | |
| 31 | + | chmod 600 ~/.ssh/authorized_keys | |
| 32 | + | vi ~/.ssh/authorized_keys | |
| 33 | + | ||
| 34 | + | # gain superuser access | |
| 35 | + | sudo su | |
| 36 | + | ||
| 37 | + | # lock default rock64 account | |
| 38 | + | passwd -l rock64 | |
| 39 | + | ||
| 40 | + | # update hostname | |
| 41 | + | hostnamectl set-hostname "$hostname" | |
| 42 | + | ||
| 43 | + | # install packages | |
| 44 | + | apt-get install -y \ | |
| 45 | + | zfsutils-linux zfs-dkms spl \ | |
| 46 | + | samba \ | |
| 47 | + | debhelper hdparm | |
| 48 | + | ||
| 49 | + | #### fix for kernel module builds | |
| 50 | + | #### https://forum.armbian.com/topic/6789-build-zfs-on-rk3328/?tab=comments#comment-53681 | |
| 51 | + | # copy kernel source | |
| 52 | + | # NOTE: you may need to change these paths for your kernel version | |
| 53 | + | wget -qO- https://github.com/ayufan-rock64/linux-kernel/archive/4.4.167-1169-rockchip-ayufan.tar.gz | tar xvz -C /usr/src | |
| 54 | + | ||
| 55 | + | # copy kernel source tools + scripts folder for builds to work | |
| 56 | + | # NOTE: you may need to change these paths for your kernel version | |
| 57 | + | rsync -a /usr/src/linux-kernel-4.4.167-1169-rockchip-ayufan/tools/ /usr/src/linux-headers-4.4.167-1169-rockchip-ayufan-g3cde5c624c9c/tools/ | |
| 58 | + | rsync -a /usr/src/linux-kernel-4.4.167-1169-rockchip-ayufan/scripts/ /usr/src/linux-headers-4.4.167-1169-rockchip-ayufan-g3cde5c624c9c/scripts/ | |
| 59 | + | ||
| 60 | + | # comment out selinux | |
| 61 | + | # NOTE: read instructions at link, this sed command doesn't work | |
| 62 | + | # sed -i 's/subdir\-\$\(CONFIG_SECURITY_SELINUX\)/#subdir-$(CONFIG_SECURITY_SELINUX)/' /usr/src/linux-headers-4.4.167-1169-rockchip-ayufan-g3cde5c624c9c/scripts/Makefile | |
| 63 | + | ||
| 64 | + | # make kernel scripts | |
| 65 | + | # NOTE: you may need to change these paths for your kernel version | |
| 66 | + | cd /usr/src/linux-headers-4.4.167-1169-rockchip-ayufan-g3cde5c624c9c/ | |
| 67 | + | make scripts | |
| 68 | + | ||
| 69 | + | #### fix for spl kernel module | |
| 70 | + | #### https://forum.armbian.com/topic/6789-build-zfs-on-rk3328/?tab=comments#comment-53681 | |
| 71 | + | # remove some KUID lines | |
| 72 | + | # NOTE: read instructions at link, didn't get a chance to script it | |
| 73 | + | # vi /var/lib/dkms/spl/0.7.5/source/configure | |
| 74 | + | ||
| 75 | + | # NOTE: path may vary based on spl version | |
| 76 | + | dkms build spl/0.7.5 | |
| 77 | + | dkms install --force spl/ | |
| 78 | + | modprobe spl | |
| 79 | + | ||
| 80 | + | # attempt to install again | |
| 81 | + | apt-get install -y \ | |
| 82 | + | zfsutils-linux zfs-dkms spl \ | |
| 83 | + | samba \ | |
| 84 | + | debhelper hdparm | |
| 85 | + | ||
| 86 | + | #### configure samba | |
| 87 | + | #### https://www.computerbeginnersguides.com/blog/2018/04/27/install-and-configure-samba-in-ubuntu-18-04-bionic-beaver/ | |
| 88 | + | # add curiouser user | |
| 89 | + | smbpasswd -a "$user" | |
| 90 | + | ||
| 91 | + | # add share | |
| 92 | + | cat <<EOF >> /etc/samba/smb.conf | |
| 93 | + | [curiouser-backup] | |
| 94 | + | path = SOME_PATH | |
| 95 | + | available = yes | |
| 96 | + | valid users = SOME_USER | |
| 97 | + | read only = no | |
| 98 | + | browseable = yes | |
| 99 | + | public = no | |
| 100 | + | writable = yes | |
| 101 | + | access based share enum = yes | |
| 102 | + | EOF | |
| 103 | + | ||
| 104 | + | #### HDD Power management | |
| 105 | + | ## Allow disks to standby after 5 minutes of inactivty | |
| 106 | + | # NOTE: this may be all you need depending on your disks + enclosure, but for my use case | |
| 107 | + | # this doesn't spin the disks down, just uses less power | |
| 108 | + | cat <<EOF >> /etc/rc.local | |
| 109 | + | #!/bin/bash | |
| 110 | + | hdparm -B127 -S60 /dev/sda | |
| 111 | + | hdparm -B127 -S60 /dev/sdb | |
| 112 | + | exit 0 | |
| 113 | + | EOF | |
| 114 | + | chmod u+x /etc/rc.local | |
| 115 | + | ||
| 116 | + | ## Spin down disks after 30 minutes of inactivity using hd-idle | |
| 117 | + | # download, extract and install | |
| 118 | + | wget https://github.com/h31/hd-idle/archive/master.zip \ | |
| 119 | + | && unzip master.zip \ | |
| 120 | + | && cd hd-idle-master \ | |
| 121 | + | && dpkg-buildpackage \ | |
| 122 | + | && dpkg -i ../hd-idle_*.deb | |
| 123 | + | ||
| 124 | + | # configure hd-idle to start on boot | |
| 125 | + | sed -i 's/START_HD_IDLE=.*/START_HD_IDLE=true/' /etc/default/hd-idle | |
| 126 | + | # configure hd-idle to not spin down disks by default, but spin down our curiouser-backup after 30 minutes | |
| 127 | + | # NOTE: you'll want to edit the next command to target your disks and for your desired timeout | |
| 128 | + | echo 'HD_IDLE_OPTS="-i 0 -a sda -i $hdd_spindown_timeout -a sdb -i $hdd_spindown_timeout -l /var/log/hd-idle.log"' >> /etc/default/hd-idle | |
| 129 | + | ||
| 130 | + | #### Reboot | |
| 131 | + | systemctl reboot | |