sethforprivacy / simple-monerod-docker

A simple and straightforward Dockerized monerod built from source and exposing standard ports.
https://sethforprivacy.com/guides/run-a-monero-node/
MIT License
98 stars 19 forks source link

How to move volume to external drive? #56

Closed PLK2 closed 2 years ago

PLK2 commented 2 years ago

I followed the instructions here: https://sethforprivacy.com/guides/run-a-monero-node/

But that put the volume (blockchain data etc) on my microSD card. How do I get docker to move that to my external hard drive instead?

Thanks!

PLK2 commented 2 years ago

I removed the previous monerod docker install and ran this command again: docker run -d --restart unless-stopped --name="monerod" -p 18080:18080 -p 18089:18089 -v bitmonero:/home/monero sethsimmons/simple-monerod:latest --rpc-restricted-bind-ip=0.0.0.0 --rpc-restricted-bind-port=18089 --no-igd --no-zmq --enable-dns-blocklist Except I replaced "/home/monero" with the path to my external drive. However, it still didn't work...

sethforprivacy commented 2 years ago

Hey there, sorry for the delays!

The part you need to change to move it is replacing bitmonero with the location you want to store the blockchain files, i.e. /data/monero or whatever you have set for the location you want to store it in.

There isn't really a simple way to move the files themselves, but if you want to explore that you'll need to setup the destination, remove the old container (docker rm --force monerod) and then use something like rsync -av /var/lib/docker/volumes/bitmonero /data/monero and then start the container with the new info.

PLK2 commented 2 years ago

No worries--thanks for the reply!

To be clear, would it be bitmonero:/externaldrive/wherever or /externaldrive/wherever:/home/monero?

sethforprivacy commented 2 years ago

Yup! Just make sure that new location has the proper permissions (normally the user you're running as, with uid/gid of 1000:1000).

PLK2 commented 2 years ago

So either of those would work? Or one or the other?

bitmonero:/externaldrive/wherever

vs.

/externaldrive/wherever:/home/monero

sethforprivacy commented 2 years ago

Oops, sorry, misread your question -- you need to specify the external drive, so /externaldrive/wherever:/home/monero is the right choice.

The bitmonero option will default to Docker's normal volume storage, which is usually /var/lib/docker/volumes. You could also change that default instead if you prefer, but that would mean all Docker containers would use your external drive for storage.

sethforprivacy commented 2 years ago

If you want to change the global Docker default see here: https://stackoverflow.com/questions/36014554/how-to-change-the-default-location-for-docker-create-volume-command

PLK2 commented 2 years ago

Thanks!