Add files via upload

This commit is contained in:
kneutron 2023-11-19 13:46:44 -07:00 committed by GitHub
parent 51c2c879cd
commit 01e398ec0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 198 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,98 @@
#!/bin/bash
# NOTE mod for osx
# NOTE dataset will be encrypted!
# =LLC= © (C)opyright 2017 Boojum Consulting LLC / Dave Bechtel, All rights reserved.
# cre8 a new ZFS dataset with options
echo "$0 opt1=(1)compression opt2=(1)sharesmb, 0 == OFF zpool dirname"
# TODO -e /tmp/infile read it and process it
source ~/bin/failexit.mrg
logfile=/var/root/boojum-zfs-newds.log
# TODO editme
#zp=zredpool2; myds=home/vmtmpdir/vmware-virtmachines
zp="$2"; myds="$3"
user=davebechtel
zfskeyloc=/Users/"$user"/zfskey
mkdir -pv "$zfskeyloc"
# defaults
compr=lz4
shrwin=off
# opt1=compression, opt2=sharesmb
case "$1" in
"10" )
# use defaults
compr=lz4; shrwin=off
;;
"11" )
compr=lz4; shrwin="on -o xattr=sa "
;;
"01" )
compr=off; shrwin="on -o xattr=sa "
;;
"00" )
compr=off; shrwin=off
;;
"" )
# no arg passed; print help and exit
failexit 101 "No arg passed!"
;;
* )
failexit 201 "Invalid arg passed, +$1+ not recognized"
;;
esac
encrkey="$zfskeyloc/zek-$zp-$user"
[ -e "$encrkey" ] || dd if=/dev/urandom of="$encrkey" bs=1 count=32 # dont overwrite if exists!
#zfs create -o atime=off -o compression=lz4 -o sharesmb=off -o recordsize=1024k
#-o encryption=aes-128-ccm -o keyformat=raw -o keylocation=file:///var/root/zek-testencr-zfs.key
#-o normalization=formD -o xattr=sa zint500/Test-aes-128-ccm
set -x
##create encrypted dataset
##for description of options see section 2.4b:
##https://github.com/zfsonlinux/zfs/wiki/Debian-Buster-Encrypted-Root-on-ZFS
##Note options with -O are file-system-properties. options with -o aren't. need to use upper and lowercase correctly.
##use create -n for dry-run
zfs create -o encryption=aes-192-gcm \
-o keyformat=raw \
-o keylocation=file://"$encrkey" \
-o compression=$compr \
-o sharesmb=${shrwin} \
-o atime=off \
-o recordsize=1024k \
$zp/$myds || failexit 99 "! Failed to create encrypted $zp/$myds"
# trace on
#(set -x
#zfs create -o \
# atime=off -o compression=$compr -o sharesmb=${shrwin} -o recordsize=1024k \
# $zp/$myds || failexit 99 "! Failed to create ZFS $zp/$myds"
#)
echo "$(date) + $zp/$myds + compr=$compr:shr=${shrwin} + Owner:$user" >> $logfile
# NOTE does not take into account alt.mountpoints like /home!
chown -v $user /Volumes/$zp/$myds; ls -al /Volumes/$zp/$myds
#df -h /$zp/$myds
gdf -hT |head -n 1
gdf -hT |grep $myds
exit;
# MAC mods
/var/root/bin/boojum/zfs-newds.sh: line 57: /root/boojum-zfs-newds.log: No such file or directory
chown: /zwdgreentera/dvnotshrcompr: No such file or directory
ls: /zwdgreentera/dvnotshrcompr: No such file or directory
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
zwdgreentera/dvnotshrcompr 449Gi 324Ki 449Gi 1% 10 942667768 0% /Volumes/zwdgreentera/dvnotshrcompr
40 root ~ # pwd
/var/root

97
ZFS/zpool-export-fast.sh Normal file
View File

@ -0,0 +1,97 @@
#!/bin/bash
zpool list
echo "$(date) - Fast exporting zpools"
time zpool list |grep -v ALLOC \
|awk '{print $1}' \
|xargs -n 1 -P 4 zpool export
date
zpool list
exit;
real 0m25.620s
# Normal zpool export takes >1 min with this many pools/mounts
# zpool list
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zhgstera6 5.09T 2.82T 2.28T - - 0% 55% 1.00x ONLINE -
zimactera4 3.44T 654G 2.80T - - 0% 18% 1.00x ONLINE -
zint1000pro 652G 213G 439G - - 1% 32% 1.00x ONLINE -
zsamt7macpro 424G 232G 192G - - 0% 54% 1.00x ONLINE -
zsgtera4 3.19T 2.34T 873G - - 6% 73% 1.00x ONLINE -
zsgtera4-old 3.19T 1.36T 1.83T - - 1% 42% 1.00x ONLINE -
zsgtera6bkp 5.44T 3.26T 2.18T - - 2% 59% 1.00x ONLINE -
ztoshtera10 9.09T 6.31T 2.79T - - 0% 69% 1.00x ONLINE -
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
zhgstera6 2.82T 2.15T 17.3M /Volumes/zhgstera6
zhgstera6/bkp-from-macpro 2.82T 2.15T 2.82T /Volumes/zhgstera6/bkp-from-macpro
zimactera4 654G 2.69T 380K /Volumes/zimactera4
zimactera4/from-imac5-tmpdel-y 418G 2.69T 418G /Volumes/zimactera4/from-imac5-tmpdel-y
zimactera4/notshrcompr-zimactera4 440K 2.69T 360K /Volumes/zimactera4/notshrcompr-zimactera4
zimactera4/shrcompr-zimactera4 448K 2.69T 368K /Volumes/zimactera4/shrcompr-zimactera4
zimactera4/virtbox-macpro-backup 237G 2.69T 237G /Volumes/zimactera4/virtbox-macpro-backup
zint1000pro 213G 419G 2.01M /Volumes/zint1000pro
zint1000pro/notshrcompr-zint1000pro 2.29M 419G 2.11M /Volumes/zint1000pro/notshrcompr-zint1000pro
zint1000pro/shrNOTcompr-zint1000pro 2.64M 419G 2.32M /Volumes/zint1000pro/shrNOTcompr-zint1000pro
zint1000pro/shrcompr-zint1000pro 31.4G 419G 5.25M /Volumes/zint1000pro/shrcompr-zint1000pro
zint1000pro/shrcompr-zint1000pro/ISO 31.4G 419G 29.8G /Volumes/zint1000pro/shrcompr-zint1000pro/ISO
zint1000pro/virtbox-virtmachines 181G 419G 157G /Volumes/zint1000pro/virtbox-virtmachines
zsamt7macpro 232G 179G 1.96M /Volumes/zsamt7macpro
zsamt7macpro/notshrcompr-samt7 23.2G 179G 23.2G /Volumes/zsamt7macpro/notshrcompr-samt7
zsamt7macpro/shrcompr-zsamt7macpro 101G 179G 101G /Volumes/zsamt7macpro/shrcompr-zsamt7macpro
zsamt7macpro/virtbox-virtmachines-samt7 99.0G 179G 99.0G /Volumes/zsamt7macpro/virtbox-virtmachines-samt7
zsamt7macpro/zvol01 1.38G 179G 1.38G -
zsamt7macpro/zvol02 1.38G 179G 1.38G -
zsamt7macpro/zvol03 1.38G 179G 1.38G -
zsamt7macpro/zvol04 1.38G 179G 1.38G -
zsamt7macpro/zvol05 1.38G 179G 1.38G -
zsamt7macpro/zvol06 1.38G 179G 1.38G -
zsamt7macpro/zvol07 56K 179G 56K -
zsamt7macpro/zvol08 56K 179G 56K -
zsamt7macpro/zvol09 56K 179G 56K -
zsamt7macpro/zvol10 56K 179G 56K -
zsamt7macpro/zvol11 56K 179G 56K -
zsamt7macpro/zvol12 56K 179G 56K -
zsamt7macpro/zvol13 56K 179G 56K -
zsgtera4 2.34T 772G 752K /Volumes/zsgtera4
zsgtera4-old 1.36T 1.73T 22.2G /Volumes/zsgtera4-old
zsgtera4-old/from-imac5-old-zwdblack2 345G 1.73T 345G /Volumes/zsgtera4-old/from-imac5-old-zwdblack2
zsgtera4-old/from-imac5-sgtera2 25.4G 1.73T 24.4G /Volumes/zsgtera4-old/from-imac5-sgtera2
zsgtera4-old/from-imac5-time-machine 3.58G 1.73T 3.58G /Volumes/zsgtera4-old/from-imac5-time-machine
zsgtera4-old/from-imac5-zint500 146G 1.73T 142G /Volumes/zsgtera4-old/from-imac5-zint500
zsgtera4-old/from-imac5-zsam53 141G 1.73T 141G /Volumes/zsgtera4-old/from-imac5-zsam53
zsgtera4-old/notshrcompr-zsgt4B 97.0G 1.73T 54.9G /Volumes/zsgtera4-old/notshrcompr-zsgt4B
zsgtera4-old/notshrcompr-zsgt4B/bkp-bookmarks 42.1G 1.73T 42.1G /Volumes/zsgtera4-old/notshrcompr-zsgt4B/bkp-bookmarks
zsgtera4-old/notshrcompr-zsgt4B/bkp-bookmarks-imac2008 3.80M 1.73T 3.51M /Volumes/zsgtera4-old/notshrcompr-zsgt4B/bkp-bookmarks-imac2008
zsgtera4-old/shrcompr-zsgt4B 44.9G 1.73T 44.9G /Volumes/zsgtera4-old/shrcompr-zsgt4B
zsgtera4-old/tmpdel-xattrsa 3.42G 1.73T 3.42G /Volumes/zsgtera4-old/tmpdel-xattrsa
zsgtera4-old/virtbox-virtmachines-linux 566G 1.73T 566G /Volumes/zsgtera4-old/virtbox-virtmachines-linux
zsgtera4-old/zvol01 56K 1.73T 56K -
zsgtera4/dvdrips-shr 135G 772G 135G /Volumes/zsgtera4/dvdrips-shr
zsgtera4/notshrcompr-zsgt2B 372G 772G 331G /Volumes/zsgtera4/notshrcompr-zsgt2B
zsgtera4/notshrcompr-zsgt2B/bkp-bookmarks 31.9G 772G 31.9G /Volumes/zsgtera4/notshrcompr-zsgt2B/bkp-bookmarks
zsgtera4/notshrcompr-zsgt2B/bkp-bookmarks-imac2008 8.45G 772G 3.50M /Volumes/zsgtera4/notshrcompr-zsgt2B/bkp-bookmarks-imac2008
zsgtera4/shrcompr-gz3 536K 772G 352K /Volumes/zsgtera4/shrcompr-gz3
zsgtera4/shrcompr-zsgt2B 1.09T 772G 1.05T /Volumes/zsgtera4/shrcompr-zsgt2B
zsgtera4/tmpdel-xattrsa 55.5G 772G 55.5G /Volumes/zsgtera4/tmpdel-xattrsa
zsgtera4/virtbox-virtmachines 564G 772G 555G /Volumes/zsgtera4/virtbox-virtmachines
zsgtera4/virtbox-virtmachines-linux 151G 772G 151G /Volumes/zsgtera4/virtbox-virtmachines-linux
zsgtera4/virtbox-virtmachines/nocompr-freebsd 9.09G 772G 9.09G /Volumes/zsgtera4/virtbox-virtmachines/nocompr-freebsd
zsgtera4/zvol01 168K 772G 84K -
zsgtera6bkp 3.26T 2.05T 368K /Volumes/zsgtera6bkp
zsgtera6bkp/bkp-p2300m-win7-p2v--zstd 215G 2.05T 215G /Volumes/zsgtera6bkp/bkp-p2300m-win7-p2v--zstd
zsgtera6bkp/from-imac5 3.05T 2.05T 3.04T /Volumes/zsgtera6bkp/from-imac5
zsgtera6bkp/from-imac5--bkp-osx-zsam53 1.90M 2.05T 1.77M /Volumes/zsgtera6bkp/from-imac5--bkp-osx-zsam53
zsgtera6bkp/notshrcompr 616K 2.05T 360K /Volumes/zsgtera6bkp/notshrcompr
ztoshtera10 6.31T 2.66T 1.83M /Volumes/ztoshtera10
ztoshtera10/enki 35.7G 2.66T 35.7G /Volumes/ztoshtera10/enki
ztoshtera10/fryserver-dvdbackup-shrnocompr-ztoshtera10 6.27T 2.66T 6.27T /Volumes/ztoshtera10/fryserver-dvdbackup-shrnocompr-ztoshtera10
ztoshtera10/notshrcompr-ztoshtera10 2.25G 2.66T 2.25G /Volumes/ztoshtera10/notshrcompr-ztoshtera10
ztoshtera10/shrcompr-ztoshtera10 1.94M 2.66T 1.79M /Volumes/ztoshtera10/shrcompr-ztoshtera10

View File

@ -0,0 +1,3 @@
#!/bin/bash
zpool status -v |egrep 'pool:|scan' #|less