# Get to understand more on adding, pinning and retrieving files

**URL:** <https://discuss.ipfs.tech/t/get-to-understand-more-on-adding-pinning-and-retrieving-files/12525>\
**Category:** Help\
**Tags:** go-ipfs, ipfs-cluster\
**Created:** [October 27, 2021, 12:04pm UTC](https://discuss.ipfs.tech/t/get-to-understand-more-on-adding-pinning-and-retrieving-files/12525 "2021-10-27T12:04:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![khoanguyen](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@khoanguyen](https://discuss.ipfs.tech/u/khoanguyen)\
**Post date:** [October 27, 2021, 12:04pm UTC](https://discuss.ipfs.tech/t/get-to-understand-more-on-adding-pinning-and-retrieving-files/12525/1 "2021-10-27T12:04:55Z")

</div>

Hi guys, hope you guys are having a good day.

I have several questions. Hope you guys can help me to understand more how IPFS & IPFS cluster works 🙂

**1. `recursive` param of IPFS cluster `/add` API**  
I tried using both `recursive=false` and `recursive=true` when adding files through IPFS cluster `/add` endpoint and did not notice any difference in the pinning results (inspecting using `ipfs pin ls`).  
Both have the results of the root CID being pinned recursively and its children being pinned indirectly.  
So what is the different when using different value for `recursive`?

**2. What is the actual meaning of recursive pinning?**  
As far as I understand, IPFS can compute the content based on the root CID. So do we really need to persist the child CIDs by pinning them? If a child cid gets garbage collected, can IPFS still compute the whole content using only the root ID?

Really appreciate any comment. Many thanks!

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [October 27, 2021, 1:23pm UTC](https://discuss.ipfs.tech/t/get-to-understand-more-on-adding-pinning-and-retrieving-files/12525/2 "2021-10-27T13:23:50Z")

</div>

> [@khoanguyen](#):
>
> 1. `recursive` param of IPFS cluster `/add` API

Recursive is a client-side option that dictates if the client should recursively add folders. In fact it is more like a safeguard so that you don’t add a folder when you are expecting to add a file.

For consistency/simplicity reasons it is part of the API params, but I don’t think it is an option used server-side at all, iirc.

> [@khoanguyen](#):
>
> **2. What is the actual meaning of recursive pinning?**

To not mix with the above, as it is a different option, there are different modes of pinning: recursive or direct.

When GC happens, the blocks that are referenced by direct-pins are added to the keep-list. The blocks that are referenced by recursive-pins, along with their children, and the children of their children are added by the keep-list.

If you have something with many blocks (i.e. added a directory with files), and you pin the root CID in “direct” mode only, and you GC, IPFS will still have the root-block, but not anything below. So the root block will point to other blocks that are unavailable, locally at least.

---

<div class="post-metadata">

**Author:** ![khoanguyen](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@khoanguyen](https://discuss.ipfs.tech/u/khoanguyen)\
**Post date:** [October 27, 2021, 2:09pm UTC](https://discuss.ipfs.tech/t/get-to-understand-more-on-adding-pinning-and-retrieving-files/12525/3 "2021-10-27T14:09:41Z")

</div>

Thanks for the clarification @hector.

> [@hector](#):
>
> …and you pin the root CID in “direct” mode only, and you GC, IPFS will still have the root-block, but not anything below. So the root block will point to other blocks that are unavailable, locally at least.

So in this case, assume that no other nodes have a copy of such the content (in a way that can form a full tree), can the content still be fully retrieved even when the root block points to nothing?

---

<div class="post-metadata">

**Author:** ![hector](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/hector/32/178_2.png) [@hector](https://discuss.ipfs.tech/u/hector)\
**Post date:** [October 27, 2021, 2:17pm UTC](https://discuss.ipfs.tech/t/get-to-understand-more-on-adding-pinning-and-retrieving-files/12525/4 "2021-10-27T14:17:19Z")

</div>

> [@khoanguyen](#):
>
> can the content still be fully retrieved

No, it cannot, since the other blocks are deleted.

---

<div class="post-metadata">

**Author:** ![khoanguyen](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@khoanguyen](https://discuss.ipfs.tech/u/khoanguyen)\
**Post date:** [October 27, 2021, 2:22pm UTC](https://discuss.ipfs.tech/t/get-to-understand-more-on-adding-pinning-and-retrieving-files/12525/5 "2021-10-27T14:22:35Z")

</div>

Thanks a lot Hector. Got the idea 👍
