I tried to run a full node on pi 4 8GB, and the initial blockchain download is really a pain in the neck, especially that i use HDD. It's a bad decision that I made to use HDD.
Yeah, using an HDD for the IBD is going to be very slow on the Pi... it's already processor limited, and you're just knee-capping it further using the HDD.
I setup Raspiblitz using a Pi 4B 8GB with an HDD... but I used the "copy" option that it has to transfer the data from my desktop to the Pi HDD. My first attempt I used WiFi (which was incredibly slow) and I didn't copy the "indexes" folder, only the "blocks" and "chainstate" folders as per the RaspiBlitz install instructions.
This was a huge mistake as using some of the other features of RaspiBlitz like electrs (Electrum Server) or the block explorers requires txindex=1... so then I had to wait for the node to complete the transaction indexing... which took something like 24 hrs to index 75%... but I suspect some of the slowdown might have been because I tried to enable several of the extra services at the same time so electrs was creating it's database while bitcoind was txindexing etc.
I eventually had the bright idea of copying the txindex from my desktop as well... so, I wiped the Pi... and this time copied "blocks", "chainstate"
and "indexes" from my desktop node datadir (making sure the node was not running of course):
scp -r ./chainstate ./blocks ./indexes bitcoin@pi.ip.addr.here:/mnt/hdd/bitcoin
I also used an ethernet cable... which improved the transfer speed by a factor of around 10 (ie. it was taking 2 seconds to transfer a 130GB block file instead of around 18-20 seconds).
So after a couple of hours copying the blockdata, I had bitcoind/lnd up and running... I then installed the mempool/btc-explorer services on the RaspiBlitz and was able to use the block explorer functionality immediately as the node was already indexed.
I then installed the electrs service and it took a few hours to create it's database... and then an hour or so more to compact the database... and now everything is running fairly smoothly.
So, after about a full 24 hours, I have my own personal Bitcoin/LND Node + Electrum Server + Block explorer... and it's all running behind Tor.
I'm actually pretty impressed with RaspiBlitz.
Recently, I got power failures on the pi, which made the blockchain data corrupt, I had to run -reindex-chainstate on it but I guess I got the CPU throttled. So, I tried to reindex it on my PC, I use the permission bitcoin:bitcoin as it the same on pi. Latter if I move it back to pi it shouldn't be a problem, right?
Are you running plain bitcoind on the Pi or are you attempting to use something like RaspiBolt/RaspiBlitz/MyNode?
If you're using plain bitcoind, you should be able to copy the data without issue. Just make sure that your desktop node is stopped first, then copy the data. You will need to copy "blocks" and "chainstate" (and "indexes" if your desktop is set to use txindex=1 and you also want the Pi to do the same) from the desktop node datadir.
Also, is there any chance to prevent the data from corrupted if it got unclean/forcefully shut down? Is the thing on the Linux OS/file system side or there should be some way on the bitcoin node that able to make the data safe even if it is got unclean shutdown?
There isn't really much you can do... even on a desktop, or Windows... an unclean shutdown can corrupt data. Usually, this should only affect the last block file, so a reindex (while time consuming) should fix it.
Are you using an "official" Pi powersupply? Or just a generic USB adapter? The Pi's can be quite power sensitive and an external HDD will require more power than an external SSD... using a generic USB adapter might be causing power delivery issues.
I got an official power supply... it was like US$8 from my local Pi stockist. I've not had any issues as yet (touch wood)... it seems pretty solid.