If you already have a Bitcoin node with a lot of Lightning Network channels, it can be expensive to close and reopen them, especially when you consider the cost of rebalancing to restore the channel’s balance from your old node.
When migrating a Lightning node to different hardware, there are risks to consider, primarily ensuring that the state remains uncorrupted and that the old and new node are not online simultaneously.
This guide will take you through the process of migrating a Umbrel Lightning node with minimal interruption while ensuring maximum safety.
Before proceeding, please note the conventions used in denoting where to run the different commands.
commands for the NEW NODE will use the DARK theme
commands for the OLD NODE will use the LIGHT theme
Alright, let’s begin!
Step 1. Prepare the new node
Proceed by installing Umbrel on your new server using the curl command, which allows you to specify a folder for Umbrel to keep its data.
curl -L https://umbrel.sh | bash -s -- --install-path /path/to/umbrel
Next, log in to your new Umbrel and install the Bitcoin app. Open the Bitcoin app, and wait for the blocks to start syncing. Once you see the synced percentage reach at least 0.01%, you can proceed by stopping Umbrel on the new node.
Now that the new node has been stopped, we can transfer the blocks and chainstate from the old node. This will save a significant amount of time for syncing because the new node only needs to re-index the blocks and does not have to download them as well.
On the new node, begin copying the
/chainstate folders using
rsync -rav --progress /path/to/oldnode/umbrel/app-data/bitcoin/data/bitcoin/chainstate /path/to/oldnode/umbrel/app-data/bitcoin/data/bitcoin/blocks user@newnodeip:/path/to/umbrel/app-data/bitcoin/data/bitcoin
This process will start transferring the blockchain data from your active old node to your new, stopped Umbrel server. You can keep your old node running while the transfer occurs.
Once the transfer is complete, start your new Umbrel:
Log in an open the Bitcoin app.
Use the “Advanced Settings” in the Bitcoin app to increase the Cache Size (MB).
After restarting to apply the new cache, Bitcoin should begin indexing the block data you copied over. This can still take a while depending on your server’s hardware.
While you wait, proceed to install the Lightning app (LND) from Umbrel’s app store.
Once Bitcoin is done indexing and you are able to create a new Lighting node, you are ready for the next step!
Step 2. Stop both Umbrels
Ensure both Umbrels are fully updated to the latest versions and that all apps are updated as well.
Step 3. Copy LND data to new node
rsync -rav --progress /path/to/oldnode/umbrel/app-data/lightning user@newnodeip:/path/to/umbrel/app-data
Step 4. Start new node. Keep old node offline!
Log in to the new node and open the Lightning app. You may find that LND has to scan blocks to identify your funds and channels. If you node is really old, this may take a while.
If everything worked as expected, all your nodes channels should remain online.
Once you’ve successfully sent or received payments or routes on your new node, you may delete the old node.
Umbrel has a nice debug script:
Leave a Reply