How to move DB’s to SSD on Docker
Before you beginning, please make sure that your SSD has good endurance (MLC is preferred), I personally recommend using SSD mirror.
- look into the official documentation and make sure that you are using –mount type=bind parameter in your
docker run
string
- Prepare a folder with mounted SSD outside of
<storage-dir>
from the official documentation. (it your folder with pieces)
- Add a new mont string to your
docker run
string:
Now we have:
docker run -d --restart unless-stopped --stop-timeout 300
-p 28967:28967
-p 127.0.0.1:14002:14002
-e WALLET=“0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”
-e EMAIL="user@example.com"
-e ADDRESS=“domain.ddns.net:28967”
-e STORAGE=“2TB”
–mount type=bind,source=“”,destination=/app/identity
–mount type=bind,source=“”,destination=/app/config
–name storagenode storjlabs/storagenode:beta
should be:
docker run -d --restart unless-stopped --stop-timeout 300 \
-p 28967:28967 \
-p 127.0.0.1:14002:14002 \
-e WALLET="0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
-e EMAIL="user@example.com" \
-e ADDRESS="domain.ddns.net:28967" \
-e STORAGE="2TB" \
--mount type=bind,source="<identity-dir>",destination=/app/identity \
--mount type=bind,source="<storage-dir>",destination=/app/config \
--mount type=bind,source="<database-dir>",destination=/app/dbs \
--name storagenode storjlabs/storagenode:beta
- Add/change a new parameter to your config.yaml
# directory to store databases. if empty, uses data path
# storage2.database-dir: ""
storage2.database-dir: "dbs"
- Stop and remove your storagenode container
docker stop storagenode -t 300 && docker rm storagenode
- Copy all databases from “ storage-dir\storage ” to the new location “ database-dir ”. Do not move it! (if something goes wrong we just started with the database on old location instead of storagenode will recreate it)
- Start your new
docker run ....
string
- Make sure that on database-dir you see files with .db-shm and .db-wal like on the screenshot
Summary
- If you can see files .db-shm and .db-wal on the new location “ database-dir ”, now you can delete database files from the old location “ storage-dir\storage ”.