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

**URL:** <https://discuss.ipfs.tech/t/what-is-the-best-way-to-move-pinned-ipfs-files-from-one-server-to-another/9854>\
**Category:** Help\
**Tags:** js-ipfs, ipfs-cluster, files, libp2p\
**Created:** [January 15, 2021, 9:52pm UTC](https://discuss.ipfs.tech/t/what-is-the-best-way-to-move-pinned-ipfs-files-from-one-server-to-another/9854 "2021-01-15T21:52:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![int](https://avatars.discourse-cdn.com/v4/letter/i/54ee81/32.png) [@int](https://discuss.ipfs.tech/u/int)\
**Post date:** [January 15, 2021, 9:52pm UTC](https://discuss.ipfs.tech/t/what-is-the-best-way-to-move-pinned-ipfs-files-from-one-server-to-another/9854/1 "2021-01-15T21:52:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Jorropo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/jorropo/32/3230_2.png) [@Jorropo](https://discuss.ipfs.tech/u/Jorropo)\
**Post date:** [January 15, 2021, 9:57pm UTC](https://discuss.ipfs.tech/t/what-is-the-best-way-to-move-pinned-ipfs-files-from-one-server-to-another/9854/2 "2021-01-15T21:57:50Z")

</div>

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.)

---

<div class="post-metadata">

**Author:** ![ipfsme](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/ipfsme/32/3907_2.png) [@ipfsme](https://discuss.ipfs.tech/u/ipfsme)\
**Post date:** [January 15, 2021, 9:58pm UTC](https://discuss.ipfs.tech/t/what-is-the-best-way-to-move-pinned-ipfs-files-from-one-server-to-another/9854/3 "2021-01-15T21:58:06Z")

</div>

You could rsync the whole ipfs directory…

---

<div class="post-metadata">

**Author:** ![int](https://avatars.discourse-cdn.com/v4/letter/i/54ee81/32.png) [@int](https://discuss.ipfs.tech/u/int)\
**Post date:** [January 16, 2021, 12:03am UTC](https://discuss.ipfs.tech/t/what-is-the-best-way-to-move-pinned-ipfs-files-from-one-server-to-another/9854/4 "2021-01-16T00:03:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jorropo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/jorropo/32/3230_2.png) [@Jorropo](https://discuss.ipfs.tech/u/Jorropo)\
**Post date:** [January 16, 2021, 12:15am UTC](https://discuss.ipfs.tech/t/what-is-the-best-way-to-move-pinned-ipfs-files-from-one-server-to-another/9854/5 "2021-01-16T00:15:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![int](https://avatars.discourse-cdn.com/v4/letter/i/54ee81/32.png) [@int](https://discuss.ipfs.tech/u/int)\
**Post date:** [January 16, 2021, 12:17am UTC](https://discuss.ipfs.tech/t/what-is-the-best-way-to-move-pinned-ipfs-files-from-one-server-to-another/9854/6 "2021-01-16T00:17:53Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Jorropo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/jorropo/32/3230_2.png) [@Jorropo](https://discuss.ipfs.tech/u/Jorropo)\
**Post date:** [January 16, 2021, 12:23am UTC](https://discuss.ipfs.tech/t/what-is-the-best-way-to-move-pinned-ipfs-files-from-one-server-to-another/9854/7 "2021-01-16T00:23:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![int](https://avatars.discourse-cdn.com/v4/letter/i/54ee81/32.png) [@int](https://discuss.ipfs.tech/u/int)\
**Post date:** [January 16, 2021, 12:27am UTC](https://discuss.ipfs.tech/t/what-is-the-best-way-to-move-pinned-ipfs-files-from-one-server-to-another/9854/8 "2021-01-16T00:27:19Z")

</div>

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. 🙂
