Browse Source

change copy hdd options

dev
openoms 6 years ago
parent
commit
4b70844809
  1. 22
      README.md
  2. 4
      home.admin/10setupBlitz.sh
  3. 106
      home.admin/50adapterHDD
  4. 2
      home.admin/50copyHDD.sh

22
README.md

@ -1,10 +1,6 @@
[ [Hardware](#hardware-needed-amazon-shopping-list) ] -- [ [Setup](#boot-your-raspiblitz) ] -- [ [Documentation](#documentation) ] -- [ [Development](#further-development-of-raspiblitz) ]
-----
# RaspiBlitz on DietPi
see: [install_on_DietPi.md](install_on_DietPi.md) and setup continues from [Documentation](#documentation)
# RaspiBlitz
Fastest and cheapest way to get your own Lightning Node running - on a RaspberryPi with a nice LCD.
@ -420,3 +416,21 @@ Everybody is welcome to join, improve and extend the RaspiBlitz - its a work in
Join me on twitter [@rootzoll](https://twitter.com/rootzoll), visit us at a [#lightninghackday](https://twitter.com/hashtag/LightningHackday?src=hash) in Berlin or drop by the Bitcoin Assembly at the [#35C3](https://twitter.com/hashtag/35C3).
IRC channel on Freenode `irc://irc.freenode.net/raspiblitz` (unmoderated)
# RaspiBlitz on DietPi
DietPi is a lightweight operating system based Debian (just like Raspbian).
It is compatible with a range of ARM based SBC-s.
Check it out on: [dietpi.com](https://dietpi.com)
This guide was tested on:
* Odroid HC1
see the instructions: [install_on_DietPi.md](install_on_DietPi.md)
(after installing DietPi and buliding the SDcard the setup continues from [Documentation](#documentation))
* Odroid HC2 is the same board except it accommodates a 3.5" 12V HDD
* hoping to extend this list with more compatible boards especially the ROCK64

4
home.admin/10setupBlitz.sh

@ -132,7 +132,7 @@ if [ ${mountOK} -eq 1 ]; then
echo "Sometimes a reboot helps --> sudo shutdown -r now"
exit 1
else
echo "Got mounted blockchain, but no config and runnign service yet --> finish HDD"
echo "Got mounted blockchain, but no config and running service yet --> finish HDD"
./60finishHDD.sh
exit 1
fi
@ -163,7 +163,7 @@ if [ ${mountOK} -eq 1 ]; then
--menu "You need a copy of the Bitcoin Blockchain - you have 5 options:" 13 75 5 \
T "TORRENT --> MAINNET + TESTNET thru Torrent (DEFAULT)" \
D "DOWNLOAD --> MAINNET + TESTNET per FTP (FALLBACK)" \
C "COPY --> BLOCKCHAINDATA from another computer with SCP" \
C "COPY --> BLOCKCHAINDATA from another node with SCP" \
A "ADAPTER --> BLOCKCHAINDATA from 2nD HDD with a powered adapter cable"\
S "SYNC --> MAINNET thru Bitcoin Network (ULTRA SLOW)" 2>&1 >/dev/tty)

106
home.admin/50adapterHDD

@ -44,6 +44,7 @@ echo "If you see on LCD a error on connecting the 2nd HDD do a restart."
echo ""
echo "You can use the HDD of another RaspiBlitz for this."
echo "The 2nd HDD needs to be formatted Ext4/exFAT and the folder '${network}' is in root of HDD."
echo "The the folder '${network}' needs to be in root of the 1st or 2nd partition on the HDD."
echo ""
echo "**********************************"
echo "--> Please connect now the 2nd HDD"
@ -103,29 +104,102 @@ fi
echo ""
echo "*** Copy Blockchain ***"
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin /mnt/hdd/
echo "cleaning up - ok if files do not exists"
sudo rm /mnt/hdd/${network}/${network}.conf
sudo rm /mnt/hdd/${network}/${network}.pid
sudo rm /mnt/hdd/${network}/banlist.dat
sudo rm /mnt/hdd/${network}/debug.log
sudo rm /mnt/hdd/${network}/fee_estimates.dat
sudo rm /mnt/hdd/${network}/mempool.dat
sudo rm /mnt/hdd/${network}/peers.dat
sudo rm /mnt/hdd/${network}/testnet3/banlist.dat
sudo rm /mnt/hdd/${network}/testnet3/debug.log
sudo rm /mnt/hdd/${network}/testnet3/fee_estimates.dat
sudo rm /mnt/hdd/${network}/testnet3/mempool.dat
sudo rm /mnt/hdd/${network}/testnet3/peers.dat
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin/chainstate /mnt/hdd/bitcoin
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin/indexes /mnt/hdd/bitcoin
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin/testnet3 /mnt/hdd/bitcoin
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin/blocks /mnt/hdd/bitcoin
# echo "cleaning up - ok if files do not exists"
# sudo rm /mnt/hdd/${network}/${network}.conf
# sudo rm /mnt/hdd/${network}/${network}.pid
# sudo rm /mnt/hdd/${network}/banlist.dat
# sudo rm /mnt/hdd/${network}/debug.log
# sudo rm /mnt/hdd/${network}/fee_estimates.dat
# sudo rm /mnt/hdd/${network}/mempool.dat
# sudo rm /mnt/hdd/${network}/peers.dat
# sudo rm /mnt/hdd/${network}/testnet3/banlist.dat
# sudo rm /mnt/hdd/${network}/testnet3/debug.log
# sudo rm /mnt/hdd/${network}/testnet3/fee_estimates.dat
# sudo rm /mnt/hdd/${network}/testnet3/mempool.dat
# sudo rm /mnt/hdd/${network}/testnet3/peers.dat
sudo umount -l /mnt/genesis
echo "OK - Copy done :)"
echo ""
echo "---> You can now disconnect the 2nd HDD"
# set SetupState
sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
# sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
sleep 5
# sleep 5
#./60finishHDD.sh
# unlink bitcoin user (will created later in setup again)
sudo unlink /home/bitcoin/.bitcoin
# make quick check if data is there
anyDataAtAll=0
quickCheckOK=1
count=$(sudo ls /mnt/hdd/bitcoin/blocks 2>/dev/null | grep -c '.dat')
if [ ${count} -gt 0 ]; then
echo "Found data in /mnt/hdd/bitcoin/blocks"
anyDataAtAll=1
fi
if [ ${count} -lt 3000 ]; then
echo "FAIL: transfere seems invalid - less then 3000 .dat files (${count})"
quickCheckOK=0
fi
count=$(sudo ls /mnt/hdd/bitcoin/chainstate 2>/dev/null | grep -c '.ldb')
if [ ${count} -gt 0 ]; then
echo "Found data in /mnt/hdd/bitcoin/chainstate"
anyDataAtAll=1
fi
if [ ${count} -lt 1400 ]; then
echo "FAIL: transfere seems invalid - less then 1400 .ldb files (${count})"
quickCheckOK=0
fi
count=$(sudo ls /mnt/hdd/bitcoin/indexes/txindex 2>/dev/null | grep -c '.ldb')
if [ ${count} -gt 0 ]; then
echo "Found data in /mnt/hdd/bitcoin/indexes/txindex"
anyDataAtAll=1
fi
# if [ ${count} -lt 5200 ]; then
# echo "FAIL: less then 5200 .ldb files (${count}) in /mnt/hdd/bitcoin/chainstate (transfere seems invalid)"
if [ ${count} -lt 2300 ]; then
echo "FAIL: less then 2300 .ldb files (${count}) in /mnt/hdd/bitcoin/chainstate (transfere seems invalid)"
quickCheckOK=0
fi
# just if any data transferred ..
if [ ${anyDataAtAll} -eq 1 ]; then
# data was invalid - ask user to keep?
if [ ${quickCheckOK} -eq 0 ]; then
echo "*********************************************"
echo "There seems to be an invalid transfer."
echo "Wait 5 secs ..."
sleep 5
dialog --title " INVALID TRANSFER - DELETE DATA?" --yesno "Quickcheck shows the data you transferred is invalid/incomplete. This can lead further RaspiBlitz setup to get stuck in error state.\nDo you want to reset/delete data data?" 8 60
response=$?
echo "response(${response})"
case $response in
1) quickCheckOK=1 ;;
esac
fi
if [ ${quickCheckOK} -eq 0 ]; then
echo "Deleting invalid Data ..."
sudo rm -rf /mnt/hdd/bitcoin
sudo rm -rf /home/bitcoin/.bitcoin
sleep 2
fi
else
# when no data transferred - just delete bitcoin base dir again
sudo rm -rf /mnt/hdd/bitcoin
fi
# setup script will decide the next logical step
./10setupBlitz.sh

2
home.admin/50copyHDD.sh

@ -23,7 +23,7 @@ echo ""
echo "Both computers (your RaspberryPi and the other computer with the full blockchain on) need"
echo "to be connected to the same local network."
echo ""
echo "Open a terminal on the source computer and change into the directory that constains the"
echo "Open a terminal on the source computer and change into the directory that contains the"
echo "blockchain data. You should see directories 'blocks', 'chainstate' & 'indexes'".
echo "Make sure the bitcoin client on that computer is stopped."
echo ""

Loading…
Cancel
Save