diff options
-rwxr-xr-x | crypt-make | 17 | ||||
-rwxr-xr-x | crypt-mount | 16 | ||||
-rwxr-xr-x | crypt-umount | 15 | ||||
-rwxr-xr-x | monitor-hdd-temp | 15 |
4 files changed, 63 insertions, 0 deletions
diff --git a/crypt-make b/crypt-make new file mode 100755 index 0000000..65cb4bf --- /dev/null +++ b/crypt-make @@ -0,0 +1,17 @@ +#!/bin/zsh + +. $(dirname $0:A)/func.zsh +check_root + +if [ "$#" -ne 2 ]; then + echo "missing args: make_crypt </dev/device> <name>" + exit +fi + +DEVICE=$1 +NAME=$2 + +cryptsetup -c aes-xts-plain64 -s 256 -h sha256 -i 1000 --use-random -y luksFormat $DEVICE +cryptsetup luksOpen $DEVICE $NAME +mkfs.xfs -L $NAME /dev/mapper/$NAME + diff --git a/crypt-mount b/crypt-mount new file mode 100755 index 0000000..9faa47f --- /dev/null +++ b/crypt-mount @@ -0,0 +1,16 @@ +#!/bin/zsh + +. $(dirname $0:A)/func.zsh +check_root + +if [ "$#" -ne 2 ]; then + echo "missing args: mount_crypt </dev/device> <name>" + exit +fi + +DEVICE=$1 +NAME=$2 + +cryptsetup luksOpen $DEVICE $NAME +mount /dev/mapper/$NAME + diff --git a/crypt-umount b/crypt-umount new file mode 100755 index 0000000..9b99e10 --- /dev/null +++ b/crypt-umount @@ -0,0 +1,15 @@ +#!/bin/zsh + +. $(dirname $0:A)/func.zsh +check_root + +if [ "$#" -ne 1 ]; then + echo "missing args: umount_crypt <name>" + exit +fi + +NAME=$1 + +umount /media/$NAME +cryptsetup luksClose /dev/mapper/$NAME + diff --git a/monitor-hdd-temp b/monitor-hdd-temp new file mode 100755 index 0000000..6f2e0fb --- /dev/null +++ b/monitor-hdd-temp @@ -0,0 +1,15 @@ +#!/bin/zsh + +. $(dirname $0:A)/func.zsh +check_root + +MAX_TEMP=$1 + +for i in `ls -1 /dev/disk/by-id/ | grep -v -P "^wwn-|\-part\d$|md-name|md-uuid"`; do + DRIVE="/dev/disk/by-id/$i" + TEMP=$(/usr/sbin/hddtemp -n $DRIVE 2>/dev/null) + if [ "$TEMP" != "" ]; then + if [ $TEMP -gt $MAX_TEMP ]; then logger "$DRIVE temp at $TEMP"; fi + fi +done + |