From c927aa6c17c041f96e1089c0b863ee0082185f7a Mon Sep 17 00:00:00 2001 From: "hapax.io" <39811582+thehapax@users.noreply.github.com> Date: Sat, 23 Feb 2019 00:15:18 -0800 Subject: [PATCH 01/17] detect os and print corresponding QR command --- home.admin/97addMobileWalletZap.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/home.admin/97addMobileWalletZap.sh b/home.admin/97addMobileWalletZap.sh index 116db47..1c77e92 100755 --- a/home.admin/97addMobileWalletZap.sh +++ b/home.admin/97addMobileWalletZap.sh @@ -77,7 +77,21 @@ else lndconnect --host=${dynDomain} fi -echo "(To shrink QR code: OSX->CMD- / LINUX-> CTRL-) Press ENTER when finished." + +platform='unknown' +unamestr=`uname` +if [[ "$unamestr" == 'Linux' ]]; then + platform='linux' +elif [[ "$unamestr" == 'Darwin' ]]; then + platform='Darwin' # mac OSX +fi + +if [[ $platform == 'Linux' ]]; then + echo "(To shrink QR code: CTRL-) Press ENTER when finished." +elif [[ $platform == 'Darwin' ]]; then + echo "(To shrink QR code: CMD-) Press ENTER when finished." +fi + read key clear From 2705685e9828dd58827ec8f5104edc585332408e Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 24 Feb 2019 17:20:35 +0100 Subject: [PATCH 02/17] extra sync on shutdown #348 --- home.admin/00mainMenu.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/home.admin/00mainMenu.sh b/home.admin/00mainMenu.sh index 5f40455..ddf9bce 100755 --- a/home.admin/00mainMenu.sh +++ b/home.admin/00mainMenu.sh @@ -462,7 +462,9 @@ case $CHOICE in sleep 10 echo "stop ${network}d (2) - please wait .." sudo systemctl stop ${network}d - echo "starting shutdown" + sleep 3 + sync + echo "starting shutdown ..." sudo shutdown now exit 0 ;; From a514b7e9a6c08fee742191a8035351bcaf66ea5f Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 24 Feb 2019 18:58:58 +0100 Subject: [PATCH 03/17] smal correction --- FAQ.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FAQ.md b/FAQ.md index c5b4e94..79e54e0 100644 --- a/FAQ.md +++ b/FAQ.md @@ -61,7 +61,7 @@ The torrent and FTP download use a prepared blockchain to kick start the RaspiBl Copying a already synced blockchain from another computer (for example your Laptop) can be a quick way to get the RaspiBlitz started or replacing a corrupted blockchain with a fresh one. Also that way you synced and verified the blockchain yourself and not trusting the RaspiBlitz FTP/Torrent downloads (dont trust, verify). -One requirement is that the blockchain is from another bitcoin-core client with version greater or equal to 0.17.1 with transaction index switched on (`txindex=1` in the `bitcoin.conf`). +One requirement is that the blockchain is from another bitcoin-core client with version greater or equal to 0.17.0.1 with transaction index switched on (`txindex=1` in the `bitcoin.conf`). But we dont copy the data via USB to the device, because the HDD needs to be formatted in EXT4 and that is usually not read/writeable by Windows or Mac computers. So I will explain a way to copy the data through your local network. This should work from Windows, Mac, Linux and even from another already synced RaspiBlitz. From c7eaf0af6372593186da97a865ccd8723fb68052 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 24 Feb 2019 20:20:41 +0100 Subject: [PATCH 04/17] make custom LND port upgrade safe --- home.admin/_bootstrap.provision.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/home.admin/_bootstrap.provision.sh b/home.admin/_bootstrap.provision.sh index 7eb2c1e..3015c8c 100644 --- a/home.admin/_bootstrap.provision.sh +++ b/home.admin/_bootstrap.provision.sh @@ -156,6 +156,14 @@ else echo "Provisioning TOR - keep default" >> ${logFile} fi +# CUSTOM LND PORT +# if a custom LND port was set, then run config for that +portNumber=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep "^listen=" | cut -f2 -d':') +if [ ${#portNumber} -gt 0 ]; then + echo "Provisioning Custom LND Port ${portNumber}- run config script" >> ${logFile} + sudo /home/admin/config.scripts/lnd.setportsh ${portNumber} >> ${logFile} 2>&1 +fi + sudo sed -i "s/^message=.*/message='Setup Done'/g" ${infoFile} echo "DONE - Give raspi some cool off time after hard building .... 20 secs sleep" >> ${logFile} From c6d3030d7e862bb561501acd3cac09d35469e01d Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sun, 24 Feb 2019 20:21:03 +0100 Subject: [PATCH 05/17] remove debug message --- home.admin/40addHDD.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home.admin/40addHDD.sh b/home.admin/40addHDD.sh index 41c418b..56ca324 100755 --- a/home.admin/40addHDD.sh +++ b/home.admin/40addHDD.sh @@ -48,7 +48,7 @@ if [ ${existsHDD} -gt 0 ]; then # init the RASPIBLITZ Config configFile="/mnt/hdd/raspiblitz.conf" - configExists=$(sudo ls ${configFile} | grep -c 'raspiblitz.conf') + configExists=$(sudo ls ${configFile} 2>/dev/null | grep -c 'raspiblitz.conf') if [ ${configExists} -eq 0 ]; then # create file and use init values from raspiblitz.info From 06c489ae5379b39985ae4ea83c65e512ae3cfd5d Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Mon, 25 Feb 2019 00:31:02 +0100 Subject: [PATCH 06/17] first test data storage script #329 --- home.admin/config.scripts/blitz.datadrive.sh | 46 ++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 home.admin/config.scripts/blitz.datadrive.sh diff --git a/home.admin/config.scripts/blitz.datadrive.sh b/home.admin/config.scripts/blitz.datadrive.sh new file mode 100644 index 0000000..9125cd1 --- /dev/null +++ b/home.admin/config.scripts/blitz.datadrive.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# command info +if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then + echo "managing additional data storage" + echo "blitz.datadrive.sh [on|off]" + echo "exits on 0 = needs reboot" + exit 1 +fi + +# check if sudo +if [ "$EUID" -ne 0 ] + then echo "Please run as root (with sudo)" + exit +fi + +# update install sources +echo "make sure BTRFS is installed" +sudo apt-get install -y btrfs-tools + + +# detect the two usb drives +lsblk -o NAME | grep "^sd" | grep -v "sda" | while read -r line ; do + echo "Processing: $line" +done + +exit 0 + + +lsblk -o UUID,NAME,FSTYPE,SIZE,LABEL,MODEL | greap "^sd" +# TODO: find the drives + + +# TODO: DETECT if they is already data +lsblk -o UUID,NAME,FSTYPE,SIZE,LABEL,MODEL + +# check if there is already data on there + +# create +sudo mkfs.btrfs -L DATASTORE -f /dev/sdb +sudo mkdir -p /mnt/data +sudo mount /dev/sdb1 /mnt/data +sudo btrfs filesystem show /mnt/data +sudo btrfs device add -f /dev/sdc /mnt/data +sudo btrfs filesystem df /mnt/data +sudo btrfs filesystem balance start -dconvert=raid1 -mconvert=raid1 /mnt/data \ No newline at end of file From 3ac9324913a0903fc45493fbb97a535fc86364e5 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Mon, 25 Feb 2019 02:10:42 +0100 Subject: [PATCH 07/17] find tweo devices of same size --- home.admin/config.scripts/blitz.datadrive.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/home.admin/config.scripts/blitz.datadrive.sh b/home.admin/config.scripts/blitz.datadrive.sh index 9125cd1..e4472b8 100644 --- a/home.admin/config.scripts/blitz.datadrive.sh +++ b/home.admin/config.scripts/blitz.datadrive.sh @@ -20,9 +20,24 @@ sudo apt-get install -y btrfs-tools # detect the two usb drives -lsblk -o NAME | grep "^sd" | grep -v "sda" | while read -r line ; do - echo "Processing: $line" +echo "Detecting two USB sticks with same size ..." +dev1="" +dev2="" +lsblk -o NAME | grep "^sd" | grep -v "sda" | while read -r test1 ; do + size1=$(lsblk -o NAME,SIZE -b | grep "^${test1}") + echo "Checking : ${test1} -> ${size1}" + lsblk -o NAME | grep "^sd" | grep -v "sda" | while read -r test2 ; do + size2=$(lsblk -o NAME,SIZE -b | grep "^${test2}") + echo " compare with ${test2} -> ${size2}" + if [ "${size1}" = "${size2}" ]; then + echo " MATCH ${test1} = ${test2}" + # remember last match + dev1="${test1}" + dev2="${test2}" + fi + done done +echo "RESULT: ${dev1} & ${dev2}" exit 0 From 6a72e4822868dea19aa149c761084e2f70217ed4 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Mon, 25 Feb 2019 02:15:42 +0100 Subject: [PATCH 08/17] fix same size detection --- home.admin/config.scripts/blitz.datadrive.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/home.admin/config.scripts/blitz.datadrive.sh b/home.admin/config.scripts/blitz.datadrive.sh index e4472b8..5ec3074 100644 --- a/home.admin/config.scripts/blitz.datadrive.sh +++ b/home.admin/config.scripts/blitz.datadrive.sh @@ -20,15 +20,15 @@ sudo apt-get install -y btrfs-tools # detect the two usb drives -echo "Detecting two USB sticks with same size ..." +echo "Detecting two USB sticks/drives with same size ..." dev1="" dev2="" -lsblk -o NAME | grep "^sd" | grep -v "sda" | while read -r test1 ; do +lsblk -o NAME | grep "^sd" | while read -r test1 ; do size1=$(lsblk -o NAME,SIZE -b | grep "^${test1}") - echo "Checking : ${test1} -> ${size1}" - lsblk -o NAME | grep "^sd" | grep -v "sda" | while read -r test2 ; do + echo "Checking : ${test1} size(${size1})" + lsblk -o NAME | grep "^sd" | grep -v "${test1}" | while read -r test2 ; do size2=$(lsblk -o NAME,SIZE -b | grep "^${test2}") - echo " compare with ${test2} -> ${size2}" + echo " compare ${test2} size(${size2})" if [ "${size1}" = "${size2}" ]; then echo " MATCH ${test1} = ${test2}" # remember last match From fccfbf7649c6c07bc8e5cd6a6d7fa61a5e10d98b Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Mon, 25 Feb 2019 02:17:27 +0100 Subject: [PATCH 09/17] fix size detection --- home.admin/config.scripts/blitz.datadrive.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home.admin/config.scripts/blitz.datadrive.sh b/home.admin/config.scripts/blitz.datadrive.sh index 5ec3074..b563974 100644 --- a/home.admin/config.scripts/blitz.datadrive.sh +++ b/home.admin/config.scripts/blitz.datadrive.sh @@ -24,10 +24,10 @@ echo "Detecting two USB sticks/drives with same size ..." dev1="" dev2="" lsblk -o NAME | grep "^sd" | while read -r test1 ; do - size1=$(lsblk -o NAME,SIZE -b | grep "^${test1}") + size1=$(lsblk -o NAME,SIZE -b | grep "^${test1}" | awk '$1=$1' | cut -d " " -f 2) echo "Checking : ${test1} size(${size1})" lsblk -o NAME | grep "^sd" | grep -v "${test1}" | while read -r test2 ; do - size2=$(lsblk -o NAME,SIZE -b | grep "^${test2}") + size2=$(lsblk -o NAME,SIZE -b | grep "^${test2}" | awk '$1=$1' | cut -d " " -f 2) echo " compare ${test2} size(${size2})" if [ "${size1}" = "${size2}" ]; then echo " MATCH ${test1} = ${test2}" From c53906350e4037b97905745a1c534ecee3d4a3d0 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Mon, 25 Feb 2019 02:24:25 +0100 Subject: [PATCH 10/17] fix size detection --- home.admin/config.scripts/blitz.datadrive.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/home.admin/config.scripts/blitz.datadrive.sh b/home.admin/config.scripts/blitz.datadrive.sh index b563974..33d2fce 100644 --- a/home.admin/config.scripts/blitz.datadrive.sh +++ b/home.admin/config.scripts/blitz.datadrive.sh @@ -28,16 +28,18 @@ lsblk -o NAME | grep "^sd" | while read -r test1 ; do echo "Checking : ${test1} size(${size1})" lsblk -o NAME | grep "^sd" | grep -v "${test1}" | while read -r test2 ; do size2=$(lsblk -o NAME,SIZE -b | grep "^${test2}" | awk '$1=$1' | cut -d " " -f 2) - echo " compare ${test2} size(${size2})" if [ "${size1}" = "${size2}" ]; then - echo " MATCH ${test1} = ${test2}" - # remember last match - dev1="${test1}" - dev2="${test2}" + echo " MATCHING ${test2} size(${size2})" + dev1=$(echo "${test1}") + dev2=$(echo "${test2}") + else + echo " different ${test2} size(${size2})" fi done done -echo "RESULT: ${dev1} & ${dev2}" +echo "RESULTS:" +echo "dev1(${dev1})" +echo "dev2(${dev2})" exit 0 From 37235c974395085eb54782e812dc22a30d9fdf81 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Mon, 25 Feb 2019 02:29:57 +0100 Subject: [PATCH 11/17] fix while loop scope --- home.admin/config.scripts/blitz.datadrive.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/home.admin/config.scripts/blitz.datadrive.sh b/home.admin/config.scripts/blitz.datadrive.sh index 33d2fce..20b569c 100644 --- a/home.admin/config.scripts/blitz.datadrive.sh +++ b/home.admin/config.scripts/blitz.datadrive.sh @@ -18,11 +18,8 @@ fi echo "make sure BTRFS is installed" sudo apt-get install -y btrfs-tools - # detect the two usb drives echo "Detecting two USB sticks/drives with same size ..." -dev1="" -dev2="" lsblk -o NAME | grep "^sd" | while read -r test1 ; do size1=$(lsblk -o NAME,SIZE -b | grep "^${test1}" | awk '$1=$1' | cut -d " " -f 2) echo "Checking : ${test1} size(${size1})" @@ -30,13 +27,17 @@ lsblk -o NAME | grep "^sd" | while read -r test1 ; do size2=$(lsblk -o NAME,SIZE -b | grep "^${test2}" | awk '$1=$1' | cut -d " " -f 2) if [ "${size1}" = "${size2}" ]; then echo " MATCHING ${test2} size(${size2})" - dev1=$(echo "${test1}") - dev2=$(echo "${test2}") + echo "${test1}" > .dev1.tmp + echo "${test2}" > .dev2.tmp else echo " different ${test2} size(${size2})" fi done done +dev1=$(cat .dev1.tmp) +dev2=$(cat .dev2.tmp) +rm -f .dev1.tmp +rm -f .dev2.tmp echo "RESULTS:" echo "dev1(${dev1})" echo "dev2(${dev2})" From 6a85b23b7c32e3797fa2b8dd15210a61c03df620 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Mon, 25 Feb 2019 04:46:32 +0100 Subject: [PATCH 12/17] checking for old data --- home.admin/config.scripts/blitz.datadrive.sh | 32 ++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/home.admin/config.scripts/blitz.datadrive.sh b/home.admin/config.scripts/blitz.datadrive.sh index 20b569c..9f05b46 100644 --- a/home.admin/config.scripts/blitz.datadrive.sh +++ b/home.admin/config.scripts/blitz.datadrive.sh @@ -11,12 +11,13 @@ fi # check if sudo if [ "$EUID" -ne 0 ] then echo "Please run as root (with sudo)" - exit + exit 1 fi # update install sources -echo "make sure BTRFS is installed" +echo "make sure BTRFS is installed ..." sudo apt-get install -y btrfs-tools +echo "" # detect the two usb drives echo "Detecting two USB sticks/drives with same size ..." @@ -41,6 +42,33 @@ rm -f .dev2.tmp echo "RESULTS:" echo "dev1(${dev1})" echo "dev2(${dev2})" +echo "" + +# check that results are available +if [ ${#dev1} -eq 0 ] || [ ${#dev2} -eq 0 ]; then + echo "!! FAIL -> was not able to detect two devices with the same size" + exit 1 +fi + +# check size (at least 4GB minus some tolerance) +size=$(lsblk -o NAME,SIZE -b | grep "^${dev1}" | awk '$1=$1' | cut -d " " -f 2) +if [ ${size} -lt 3500000000 ]; then + echo "!! FAIL -> too small - additional storage needs to be bigger than 4GB" + exit 1 +fi + +# check if devices are containing old data +echo "Analysing Drives ..." +nameDev1=$(lsblk -o NAME,LABEL | grep "^${dev1}" | awk '$1=$1' | cut -d " " -f 2) +nameDev2=$(lsblk -o NAME,LABEL | grep "^${dev2}" | awk '$1=$1' | cut -d " " -f 2) +if [ "${nameDev1}" = "DATASTORE" ] || [ "${nameDev2}" = "DATASTORE" ]; then + # TODO: once implemented -> also make sure that dev1 is named "DATASTORE" and if 2nd is other -> format and add as raid + echo "!! NOT IMPLEMENTED YET -> devices seem contain old data, because name is 'DATASTORE'" + echo "if you dont care about that data: format devices devices on other computer with FAT(32) named TEST" + exit 1 +fi +echo "OK drives dont contain old data." +echo "" exit 0 From 6d3633eb7cccfccaa237a495dbd4d9800da79a98 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Mon, 25 Feb 2019 05:33:52 +0100 Subject: [PATCH 13/17] formatting BTRFS --- home.admin/config.scripts/blitz.datadrive.sh | 143 ++++++++++++------- 1 file changed, 94 insertions(+), 49 deletions(-) diff --git a/home.admin/config.scripts/blitz.datadrive.sh b/home.admin/config.scripts/blitz.datadrive.sh index 9f05b46..7f12817 100644 --- a/home.admin/config.scripts/blitz.datadrive.sh +++ b/home.admin/config.scripts/blitz.datadrive.sh @@ -19,9 +19,34 @@ echo "make sure BTRFS is installed ..." sudo apt-get install -y btrfs-tools echo "" -# detect the two usb drives -echo "Detecting two USB sticks/drives with same size ..." -lsblk -o NAME | grep "^sd" | while read -r test1 ; do +# check on/off state +dataStorageNotAvailableYet=$(sudo btrfs filesystem df /mnt/data 2>&1 | grep -c "ERROR: not a btrfs filesystem") +if [ "$1" = "1" ] || [ "$1" = "on" ]; then + echo "Trying to switch additional data storage on ..." + if [ ${dataStorageNotAvailableYet} -eq 0 ]; then + echo "FAIL -> data storage is already on" + exit 1 + fi +elif [ "$1" = "0" ] || [ "$1" = "off" ]; then + echo "Trying to switch additional data storage off ..." + if [ ${dataStorageNotAvailableYet} -eq 1 ]; then + echo "FAIL -> data storage is already off" + exit 1 + fi +else + echo "FAIL -> Parameter '${$1}' not known." + exit 1 +fi + +################### +# SWITCH ON +################### + +if [ "$1" = "1" ] || [ "$1" = "on" ]; then + + # detect the two usb drives + echo "Detecting two USB sticks/drives with same size ..." + lsblk -o NAME | grep "^sd" | while read -r test1 ; do size1=$(lsblk -o NAME,SIZE -b | grep "^${test1}" | awk '$1=$1' | cut -d " " -f 2) echo "Checking : ${test1} size(${size1})" lsblk -o NAME | grep "^sd" | grep -v "${test1}" | while read -r test2 ; do @@ -34,59 +59,79 @@ lsblk -o NAME | grep "^sd" | while read -r test1 ; do echo " different ${test2} size(${size2})" fi done -done -dev1=$(cat .dev1.tmp) -dev2=$(cat .dev2.tmp) -rm -f .dev1.tmp -rm -f .dev2.tmp -echo "RESULTS:" -echo "dev1(${dev1})" -echo "dev2(${dev2})" -echo "" + done + dev1=$(cat .dev1.tmp) + dev2=$(cat .dev2.tmp) + rm -f .dev1.tmp + rm -f .dev2.tmp + echo "RESULTS:" + echo "dev1(${dev1})" + echo "dev2(${dev2})" + echo "" -# check that results are available -if [ ${#dev1} -eq 0 ] || [ ${#dev2} -eq 0 ]; then - echo "!! FAIL -> was not able to detect two devices with the same size" - exit 1 -fi + # check that results are available + if [ ${#dev1} -eq 0 ] || [ ${#dev2} -eq 0 ]; then + echo "!! FAIL -> was not able to detect two devices with the same size" + exit 1 + fi -# check size (at least 4GB minus some tolerance) -size=$(lsblk -o NAME,SIZE -b | grep "^${dev1}" | awk '$1=$1' | cut -d " " -f 2) -if [ ${size} -lt 3500000000 ]; then - echo "!! FAIL -> too small - additional storage needs to be bigger than 4GB" - exit 1 -fi + # check size (at least 4GB minus some tolerance) + size=$(lsblk -o NAME,SIZE -b | grep "^${dev1}" | awk '$1=$1' | cut -d " " -f 2) + if [ ${size} -lt 3500000000 ]; then + echo "!! FAIL -> too small - additional storage needs to be bigger than 4GB" + exit 1 + fi -# check if devices are containing old data -echo "Analysing Drives ..." -nameDev1=$(lsblk -o NAME,LABEL | grep "^${dev1}" | awk '$1=$1' | cut -d " " -f 2) -nameDev2=$(lsblk -o NAME,LABEL | grep "^${dev2}" | awk '$1=$1' | cut -d " " -f 2) -if [ "${nameDev1}" = "DATASTORE" ] || [ "${nameDev2}" = "DATASTORE" ]; then - # TODO: once implemented -> also make sure that dev1 is named "DATASTORE" and if 2nd is other -> format and add as raid - echo "!! NOT IMPLEMENTED YET -> devices seem contain old data, because name is 'DATASTORE'" - echo "if you dont care about that data: format devices devices on other computer with FAT(32) named TEST" - exit 1 -fi -echo "OK drives dont contain old data." -echo "" + # check if devices are containing old data + echo "Analysing Drives ..." + nameDev1=$(lsblk -o NAME,LABEL | grep "^${dev1}" | awk '$1=$1' | cut -d " " -f 2) + nameDev2=$(lsblk -o NAME,LABEL | grep "^${dev2}" | awk '$1=$1' | cut -d " " -f 2) + if [ "${nameDev1}" = "DATASTORE" ] || [ "${nameDev2}" = "DATASTORE" ]; then + # TODO: once implemented -> also make sure that dev1 is named "DATASTORE" and if 2nd is other -> format and add as raid + echo "!! NOT IMPLEMENTED YET -> devices seem contain old data, because name is 'DATASTORE'" + echo "if you dont care about that data: format devices devices on other computer with FAT(32) named TEST" + exit 1 + fi + echo "OK drives dont contain old data." + echo "" -exit 0 + # format first drive + echo "Formatting /dev/${dev1} with BTRFS ..." + sudo mkfs.btrfs -L DATASTORE -f /dev/${dev1} + echo "OK" + echo "" + # mount the BTRFS drive + echo "Mounting under /mnt/data ..." + sudo mkdir -p /mnt/data + sudo mount /dev/sdb1 /mnt/data + echo "OK" + echo "" -lsblk -o UUID,NAME,FSTYPE,SIZE,LABEL,MODEL | greap "^sd" -# TODO: find the drives + # adding the second device + echo "Adding the second device as RAID1 .." + sudo btrfs device add -f /dev/sdc /mnt/data + sudo btrfs filesystem balance start -dconvert=raid1 -mconvert=raid1 /mnt/data + echo "" + exit 0 + #uuid=$(lsblk -o NAME,UUID | grep "^${dev1}" | awk '$1=$1' | cut -d " " -f 2) + +fi -# TODO: DETECT if they is already data -lsblk -o UUID,NAME,FSTYPE,SIZE,LABEL,MODEL +################### +# SWITCH OFF +################### -# check if there is already data on there +if [ "$1" = "0" ] || [ "$1" = "off" ]; then -# create -sudo mkfs.btrfs -L DATASTORE -f /dev/sdb -sudo mkdir -p /mnt/data -sudo mount /dev/sdb1 /mnt/data -sudo btrfs filesystem show /mnt/data -sudo btrfs device add -f /dev/sdc /mnt/data -sudo btrfs filesystem df /mnt/data -sudo btrfs filesystem balance start -dconvert=raid1 -mconvert=raid1 /mnt/data \ No newline at end of file + echo "TODO -> Turn off" + + sudo btrfs filesystem show /mnt/data + sudo btrfs filesystem df /mnt/data + + sudo umount /mnt/data + + exit 0 + +fi From 0f1a0b0fa8efdb240114b6b79fc7241522e225da Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Mon, 25 Feb 2019 05:40:13 +0100 Subject: [PATCH 14/17] establishing RAID1 --- home.admin/config.scripts/blitz.datadrive.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/home.admin/config.scripts/blitz.datadrive.sh b/home.admin/config.scripts/blitz.datadrive.sh index 7f12817..07d911e 100644 --- a/home.admin/config.scripts/blitz.datadrive.sh +++ b/home.admin/config.scripts/blitz.datadrive.sh @@ -104,13 +104,13 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then # mount the BTRFS drive echo "Mounting under /mnt/data ..." sudo mkdir -p /mnt/data - sudo mount /dev/sdb1 /mnt/data + sudo mount /dev/${dev1} /mnt/data echo "OK" echo "" # adding the second device echo "Adding the second device as RAID1 .." - sudo btrfs device add -f /dev/sdc /mnt/data + sudo btrfs device add -f /dev/${dev2} /mnt/data sudo btrfs filesystem balance start -dconvert=raid1 -mconvert=raid1 /mnt/data echo "" exit 0 @@ -129,7 +129,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then sudo btrfs filesystem show /mnt/data sudo btrfs filesystem df /mnt/data - + sudo umount /mnt/data exit 0 From f88bd5adafd8f36545509a59c7e27a160629cf15 Mon Sep 17 00:00:00 2001 From: ZeusLN <47701173+ZeusLN@users.noreply.github.com> Date: Wed, 27 Feb 2019 22:24:03 -0500 Subject: [PATCH 15/17] transmission typo --- home.admin/90finishSetup.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home.admin/90finishSetup.sh b/home.admin/90finishSetup.sh index 0843578..94a1951 100755 --- a/home.admin/90finishSetup.sh +++ b/home.admin/90finishSetup.sh @@ -63,7 +63,7 @@ echo "allow: lightning gRPC" sudo ufw allow 10009 comment 'lightning gRPC' echo "allow: lightning REST API" sudo ufw allow 8080 comment 'lightning REST API' -echo "allow: trasmission" +echo "allow: transmission" sudo ufw allow 51413 comment 'transmission' echo "allow: local web admin" sudo ufw allow from 192.168.0.0/16 to any port 80 comment 'allow local LAN web' @@ -81,4 +81,4 @@ sudo apt-get update echo "OK - System is now up to date" # mark setup is done -sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info \ No newline at end of file +sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info From 5cba95bcfec4bd48e36814c5c0cb80603a2ed843 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Thu, 28 Feb 2019 14:56:53 +0100 Subject: [PATCH 17/17] detecting UUID --- home.admin/config.scripts/blitz.datadrive.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/home.admin/config.scripts/blitz.datadrive.sh b/home.admin/config.scripts/blitz.datadrive.sh index 07d911e..a235f6b 100644 --- a/home.admin/config.scripts/blitz.datadrive.sh +++ b/home.admin/config.scripts/blitz.datadrive.sh @@ -115,7 +115,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then echo "" exit 0 - #uuid=$(lsblk -o NAME,UUID | grep "^${dev1}" | awk '$1=$1' | cut -d " " -f 2) + # adding the second device + uuid=$(sudo btrfs filesystem show /mnt/data | grep "uuid:" | awk '$1=$1' | cut -d " " -f 4) fi