Migrate Umbrel Server to Raspiblitz Local Node 🇬🇧

lcodes

2021/06/17

Categories: Tutorial Tags: lightning,umbrel,raspiblitz,migration

How to migrate an Umbrel Server Node to a local Raspiblitz

First of all there is a good help explaining the conversion if you run Umbrel on a Raspi4 with the default image. In my particular case, i wanted to shutdown a dedicated server node running umbrel and bring the channels to a local raspiblitz i had bought a fulmo.

The Blitz was already installed, configured as a testnode in mainnet and ran for some time. As a result the blockchain was already synched.So i had a RaspiBlitz external drive with data and an Umbrel node somewhere in the internet with data. After some tinkering, it seemed to me that the easiest approach for transformation would be:

  1. Backup Server and Blitz data
  2. Re-flash the SD Card of the Blitz with a new Image
  3. Setup an Umbrel Filesystemstructure on my external drive
  4. Check if RaspiBlitz will recognize and migrate it

Backup the files

The Blitz is running with an SD Card and the external drive. I shutdown the Blitz, took the sd card and made an image. For this i checked dmesg and grepped for devices like:

# dmesg|grep sd
[870139.791657] sd 2:0:0:0: [sdc] 62521344 512-byte logical blocks: (32.0 GB/29.8 GiB)
[870139.792239] sd 2:0:0:0: [sdc] Write Protect is off
[870139.792241] sd 2:0:0:0: [sdc] Mode Sense: 21 00 00 00
[870139.792772] sd 2:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA

As my card has 32GB size and no other drive inserted had this one, i was pretty sure it is my sdcard. My tool of choice for creating images of drives is dd (This will take a while).

dd if=/dev/sdc | bzip2 -9 | dd of=raspiblitz_2021jun17.img.bz2

Please note sdc is the drive found at my system. Your drive name is probably different. The final backup-size was ~2GB. For flashing i used an image i made when the node arrived some weeks ago. If you do not have a pre-made image or it is to old you can check this link and those instructions.

In my case i simply executed:

# dd if=raspiblitz_orig.img.bz2 | bzip2 -d | dd of=/dev/sdc
3348866+1 records in
3348866+1 records out
1714619873 bytes (1.7 GB, 1.6 GiB) copied, 1275.48 s, 1.3 MB/s
62521344+0 records in
62521344+0 records out
32010928128 bytes (32 GB, 30 GiB) copied, 4729.16 s, 6.8 MB/s

Please note, that a downloaded image comes as gz. You can unpack this with:

# gzip -d raspiblitz.img.gz

Or simply execute:

# dd if=raspiblitz.img.gz | gzip -d | dd of=/dev/sdc

In parallel i mounted the former external Blitzdrive and had a look at the filestructure:

mount /dev/sdb1 /mnt/storage

Filestructure:

# ls
app-data  app-storage  bitcoin  litecoin  lnd  lost+found  raspiblitz.conf  ssh  swapfile  temp  tor  tor-lnd

I checked the size and assumed that there is enough space for saving old blitz data and umbrel data on the same drive. So my old blitz data was simply moved to old_blitz

# df -h\|grep sdb1
/dev/sdb1 916G  379G  491G  44% /mnt/storage
# mkdir old_blitz
# mv * old_blitz
# ls old_blitz/
# ls old_blitz/
app-data  app-storage  bitcoin  litecoin  lnd  lost+found  raspiblitz.conf  ssh  swapfile  temp  tor  tor-lnd

Now it was time for stopping umbrel and downloading the important files. I logged into the remote node with ssh

ssh umbrella@umbrel2
Password:

umbrella@umbrel2:~$ sudo scripts/stop
[sudo] password for umbrella: 
Stopping installed apps ...
Stopping app mempool...
Stopping mempool_mariadb_1 ... done
Stopping mempool_web_1     ... done
Stopping mempool_api_1     ... done
Going to remove mempool_mariadb_1, mempool_web_1, mempool_api_1
Removing mempool_mariadb_1 ... done
Removing mempool_web_1     ... done
Removing mempool_api_1     ... done
[...]
Stopping Docker services...

Stopping middleware ... done
Stopping bitcoin    ... done
Stopping lnd        ... done
Stopping nginx      ... done
Stopping manager    ... done
Stopping dashboard  ... done
Stopping tor        ... done
Stopping electrs    ... done
Removing neutrino-switcher ... done
Removing middleware        ... done
Removing bitcoin           ... done
Removing lnd               ... done
Removing nginx             ... done
Removing manager           ... done
Removing dashboard         ... done
Removing tor               ... done
Removing electrs           ... done
Removing network umbrel_main_network

On another terminal i started a rsync process excluding the huge bitcoin and electrs blocks to minimize the download size. This is possible because we have downloaded the chain already while the Blitz was running beforehand. If you have not a recent chain available, do not exclude these files! Please note that umbrel2 is the hostname of my external server. You might want to replace it with your name or ip address. Also be reminded i have mounted the external drive of the Blitz at /mnt/storage/. Lets sync the remote files to the umbrel directory:

rsync -a -e 'ssh' --exclude 'blocks' --exclude '\*.sst' --exclude 'indexes' --exclude='chainstate' umbrel2:/home/umbrella /mnt/storage/

If you want the chains to get downloaded as well:

rsync -a -e 'ssh' umbrel2:/home/umbrella /mnt/storage/

As i excluded the remote chain i needed to move the local chain to my umbrel directory.

/mnt/storage/old_blitz/bitcoin # ls
anchors.dat  bitcoin.conf  chainstate  fee_estimates.dat  onion_v3_private_key  settings.json
banlist.dat  blocks        debug.log   mempool.dat        peers.dat
/mnt/storage/old_blitz/bitcoin # du -sch blocks/
372G    blocks/
372G    total
/mnt/storage/old_blitz/bitcoin # du -sch chainstate/
4.3G    chainstate/
4.3G    total
/mnt/storage/old_blitz/bitcoin # mv blocks chainstate ../../bitcoin/

After i placed all files at its place i connected SD-Card, external drive and started the Blitz. My first attempt failed, Blitz did not recognize that there was an old Umbrel directory on the drive.

My assumption, that it was looking for the contents in the root of the drive was wrong. It was looking for a certain path. I found this by checking this file:

cat config.scripts/blitz.datadrive.sh|grep umbrel
            # check for umbrel
            isUmbrelHDD=$(sudo ls /mnt/storage/umbrel/info.json 2>/dev/null | grep -c '.json')
              hddGotMigrationData="umbrel"

So obviously it was assuming the directory umbrel as root for the files. Nothing easier than that: I was anyway logged into the blitz node and simply got me root + mounted the external ssd to the normal blitz mountpoint /mnt/hdd.

admin@raspberrypi:/mnt/hdd $ sudo bash
root@raspberrypi:/mnt/hdd# mount /dev/sda1 /mnt/hdd/
ls
app-data     bitcoin             events          LICENSE.md  nginx      SECURITY.md  tor
apps         db                  info.json       litecoin    old_blitz  statuses     umbrel
app-storage  docker-compose.yml  info.json.orig  lnd         README.md  temp
bin          electrs             karen           logs        scripts    templates
root@raspberrypi:/mnt/hdd# mv old_blitz/ .lala
root@raspberrypi:/mnt/hdd# mkdir umbrel
root@raspberrypi:/mnt/hdd# mv * umbrel
mv: cannot move 'umbrel' to a subdirectory of itself, 'umbrel/umbrel'
root@raspberrypi:/mnt/hdd# mv .lala/ old_blitz
root@raspberrypi:/mnt/hdd# ls
old_blitz  umbrel
root@raspberrypi:/mnt/hdd# cd umbrel/
root@raspberrypi:/mnt/hdd/umbrel# ls
app-data     bitcoin             events          LICENSE.md  nginx        statuses   umbrella
apps         db                  info.json       litecoin    README.md    temp
app-storage  docker-compose.yml  info.json.orig  lnd         scripts      templates
bin          electrs             karen           logs        SECURITY.md  tor
root@raspberrypi:/mnt/hdd/umbrel# cd ../..
root@raspberrypi:/mnt
root@raspberrypi:/mnt# umount hdd/
root@raspberrypi:/mnt# reboot

Of course i could have tried to simply restart the installer script, but i did not knew exactly which one and also wanted to know if this worked also with a reboot or fresh system. And indeed :) After a reboot, i reconnected with ssh and got greeted with this:


| RaspiBlitz found data from UMBREL                      │                          
│                                                        │                          
│ You can migrate your blockchain & LND data (funds &    │                          
│ channels) over to RaspiBlitz.                          │                          
│                                                        │                          
│ Please make sure to have your UMBREL seed words &      │                          
│ static channel backup file (just in case). Also any    │                          
│ data of additional apps you had installed on UMBREL    │                          
│ might get lost.                                        │                          
│                                                        │                          
│                                                        │   

I pressed started migration and the RaspiBlitz magic started.

Starting the main menu ...
**************************************************
MIGRATION FROM UMBREL TO RASPIBLITZ
**************************************************
- started ...
- old data of UMBREL can be found in '/mnt/hdd/backup_migration'
******************************************************
OK MIGRATION --> will now reboot and update/recover
******************************************************

Note, this will take some time.

LCD turns white when shutdown complete.
It will then reboot again automatically.
-----------------------------------------------
stop electrs - please wait ..
stop lnd - please wait ..
stop bitcoind (1) - please wait ..
stop bitcoind (2) - please wait ..
starting shutdown ...

Afterwards RaspiBlitz was doing the usual configurational steps. To be honest it worked like a charm. :)

The End

I hope this was useful for someone :)

>> Home