Change default blockchain download directory. How to?

How can I tell Umbrel to download the blockchain into an external HDD instead of the default location?
I tried editing “umbrel/app-data/bitcoin/docker-compose.yml” file, but I don’t how which line to modify and what to modify exactly. Can someone shed some light on this?

Hi there,

I am here to try to help you as I did this process in the past, the first thing is i don’t recommend you to use an HDD as it has lower writing/reading speeds ad as it has mobile parts its lifespan would be reduced, instead try with an SSD of an NVME if possible.

Check this guide as it helped me solve this when i needed it:

Let me know if you did it successfully.

I already followed that guide yesterday, but to no avail. It looks a bit outdated to me, as the bitcoin section is not present anymore in the docker-compose.yml file (umbrel 0.5.4). Now it only has a bitcoind section, which seems to control other parts of the software, but not the blocks directory. Thanks anyway.

I see, then in this case what you can do is the following (i don’t have the exact commands)

  1. Assuming you already have your drive mounted, find the way to mount it to the same location automatically on boot.
  2. inside the destination drive if you have nothing, create the blocks and chainstate folders.
  3. Create a symlink of both folders that are already in the path ~/umbrel/app-data/bitcoin/data/bitcoin to the destination.

To check they are correctly liked you can do for example the command stat ./blocks

Clarification: in the following screenshot you are going to see it with the bitcoin directory as I basically created a symlink to a drive that already had my umbrel installation before
So in your case what it shows for me as " File: bitcoin → /mnt/ssd/umbrel/app-data/bitcoin/data/bitcoin/", for you it should be "FIle: blocks → /mnt/{the folder you mounted the drive in}/blocks

Reboot and you should be good to go.

PD: Make sure to take the docker-compose file to it’s default state if you modified it, as this should work as if nothing had changed in the system.

1 Like

Did that and:

filesystem error: cannot create directories: File exists [/data/.bitcoin/blocks]

It looks like umbrel is not prepared to work with symlinking or maybe I’m doing something wrong.

Hmmm it seems that i made a mistake if you followed my steps, apparently you don’t need to create the directories innitially, better check at this guide.

And sure Umbrel is prepared to work with symlinks, as it is on a linux system, also with symlinks is the way my node works as I have two different drives in the same server.

Bear with me Dionisius, we are almost there. Maybe I created the symlink in the wrong way as it is my first time. The commands I am executing are:

cd ~/umbrel/app-data/bitcoin/data/bitcoin/
ln -sv /media/blockchain/bitcoin/blocks/

But then I see this error:

ln: failed to create symbolic link './blocks': File exists

Maybe I cannot link two folders with same name? Should I use a hard link instead of a soft link? What is going on?

If I detete the directories manually and create the symlink, I am probably going to see this error again:

filesystem error: cannot create directories: File exists [/data/.bitcoin/blocks]

Thank you and regards.

PD: I even tried to symlink the files instead of the directories, but to no avail:

ln -sv /media/blockchain/bitcoin/blocks/*

That command gives me this error:

ln: target '/media/blockchain/bitcoin/blocks/rev03967.dat': Not a directory

Don’t know what else to do.

1 Like

For some reason i didn’t see your notification, did you solve this in the end?

I would say a soft link.

In this case you can try deleting the blocks folder in the new drive, and point the symlink to the folder blocks were the data is going to be, if you try to create a symlink in the ~/umbrel/app-data/bitcoin/data/bitcoin/ but in this there is already a blocks folder, it would give an error, as the system will think there would be two folders with the exact same name which is not possible.

Hope you can solve it :slight_smile:

Would be good to create an updated guide about this.

1 Like

Hi Dionisius, I was following your tutorial and also got stuck when I saw that the Bitcoin section in the docker-compase.yml file was different. I’m a noob so don’t know how to follow your new steps without knowing what the commands are? Would it be possible to update your tutorial perhaps?
Thanks!

Hey Green_goblin, did you come right doing this? I have the same issues / errors with trying to move my blocks over to SSD. I’m running Ubuntu 22.04.3 on my old MAcAir and trying to move to a 1TB SSD.

No sorry, same problem, I cannot solve it. I purchased a 2 TB SSD to store the blockchain internally, and now that I copied the entire blockchain into the defaults directories, I see this error:

Error: Unable to open settings file /data/.bitcoin/settings.json.tmp for writing

We will see if I can fix it…

Fuck it, I’m tired, so I’m going to download the blockchain from scratch.

1 Like

Popping in to say that I’m getting the same error trying to symbolically link the blocks directory:

bitcoind_1 | filesystem error: cannot create directories: File exists [/data/.bitcoin/blocks]

Is this a bitcoind issue?

Hi there,
after trying a few different things, I finally managed to get Umbrel’s Bitcoin blockchain to download to an external USB drive.
I’m using a VirtualBox setup with UmbrelOS 1.2.2.

First, I tried modifying the “docker-compose.yml” file (it didn’t work). Then, I attempted creating a symlink while keeping the original “docker-compose.yml” file (that didn’t work either).
Finally, what worked was mounting the USB directly to the Bitcoin data directory. Here’s what I did: I modified the “/etc/fstab” file to automatically mount the USB drive in the system directory.

For my setup, I added these two lines to “/etc/fstab”:

/dev/sdb1 /mnt/usb auto nosuid,nodev,nofail 0 0
/mnt/usb/umbrel-data/bitcoin/data /home/umbrel/umbrel/app-data/bitcoin/data/bitcoin none bind 0 0

Hope this helps!

great question I had the same issue. pi imager has a flash or? that changes the boot order. I THINK I didn’t even have to do it on a pi 4. pull the sd and boot from the ssd… then its like a 1TB R pi and just GO! it does have the option to flash the 4s also…


Hello!
I have followed your advice with irreleant (I hope) modification:

within /mnt folder I run

sudo mkdir usb_blockchain

and then added

/dev/sdb1 /mnt/usb_blockchain auto nosuid,nodev,nofail 0 0
/mnt/usb_blockchain/umbrel-data/bitcoin/data /home/umbrel/umbrel/app-data/bitcoin/data/bitcoin none bind 0 0

to /etc/fstab

I still see only cca 100GB of free space of my internal drive in Umbrel web interface.
Do you have any idea what I could be doing wrong?
Running umbrelOS 1.2.2 on x86 HW.
sdb1 should be correct for my external 1TB drive.

I have tried to check that link in fstab and I see none. But I am not good in Linux at all, so trying to Google some command for this check. :frowning:

Would be great to note which Umbrel version was used when creating guide Migrating Umbrel bitcoin blocks to external storage | by Devendran Munuswamy | Coinmonks | Medium

Hi Jan007,
Please could you check if your external usb drive is downloading the blockchain? If so, forget about what Umbrel tells you, because I have a virtual disk with 50GB where I have Umbrel installed and the blockchain occupies 779GB. Therefore, it is downloading on the external usb. I hope this is helpful.

1 Like

Hi pjjp!

I think my problem can be related to user rights.
When (I mean before initial setup of Umbrel - providing user credentials or after that) shall I be creating those links in /etc/fstab? Maybe it is irrelevant, in that case sorry for stupid question.

Editing /etc/fstab is only possible with admin rights, if I am correct.
What about that folder created under /mnt. What privileges shall this folder get? For which users?

Note: my free space indicated by Umber us being consumed from 100GB disk when syncing blockchain, so I am assuming that I am doing still not good.

Hi Jan007,

Sorry, but I’m not a Linux Ubuntu expert either.

  1. sudo nano /etc/fstab to modify it. The file has root privileges.
  2. the usb folder under “/mnt” has user privileges (“umbrel” user in my case).

My Umbrel says that the bitcoin node is occupying 781GB, but my Ubuntu computer is old and only has a capacity of 240GB.

I’m assuming your USB is ext4 formatted? (not FAT nor NFTS)
If not, this could be the problem… in fact, I had to format my usb to ext4.

Hope this helps!