What is the best way to move pinned IPFS files from one server to another?

What is the best way to move pinned IPFS files from one server to another?

I have one server that is running an IPFS node, I want that node’s IPFS files transferred to another IPFS node running on another server. What is the best way to do this?

The easy way is:

  • Files are on the node A.
  • Pin them on node B.
  • Wait for node B to finish.
  • Do whatever with node A (unpin them, delete the node, up until this point it doesn’t matter).

You can also copy your datastore or .ipfs folder with your favorite file transfers method while both nodes are not running. (if you copy the whole .ipfs don’t forget to rotate the key on your new server, if you don’t they will share the same peerID wich will creates bugs and likely render your node useless for sharing files.)

1 Like

You could rsync the whole ipfs directory…

1 Like

Is there a way to do it with IPFS Cluster? I’m concerned about just pinning the files on the new server because there are a lot of files and I’d need to write a script to do it, which is fine, but I just wonder if there is a better or “recommended” way.

If you have a cluster just pin the files on the cluster.

If a cluster tries to pin already pin file it will just think this was very quick and be happy.

I’m not sure of what is your question. Do you want a script that list all pins and then add them to ipfs cluster?

I’m not currently using cluster, but would be open to getting it if it helped. I can write the script, but I just was researching around to see if that is truly the best way. Thanks for the answers!

I think the best way depends of datasizes.
Ipfs is not fast (yet) so

  • if it’s “small” ~100gb or less, maybe more, I would advise you to just pin it on your second node (this is what ipfs cluster will do, what is good about cluster is that if you don’t plan to trash your first node I find it to be an absolute must when I need to sync multiple nodes, and cluster is really good and pinning huges files (handeling reboots/pauses too)).
  • else rsync them or tar -cf - ~/.ipfs | ssh ipfs@example.com tar -C ~ -xf - (maybe add compression in the flow if bandwith is the bottleneck) and then rotate the key with ipfs key rotate. As even if this add a step, this will be way much faster.

Thanks! I’m fine if it is slow because this move is just a migration to another host that isn’t too time sensitive. But I’ll keep the other options in mind for future migrations. :slight_smile: