# Garbage collection in IPFS

**URL:** <https://discuss.ipfs.tech/t/garbage-collection-in-ipfs/3807>\
**Category:** Help\
**Created:** [September 10, 2018, 7:04am UTC](https://discuss.ipfs.tech/t/garbage-collection-in-ipfs/3807 "2018-09-10T07:04:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kanithin](https://avatars.discourse-cdn.com/v4/letter/k/87869e/32.png) [@kanithin](https://discuss.ipfs.tech/u/kanithin)\
**Post date:** [September 10, 2018, 7:04am UTC](https://discuss.ipfs.tech/t/garbage-collection-in-ipfs/3807/1 "2018-09-10T07:04:03Z")

</div>

Hello,

In the ipfs cluster documenation, it is advised to disable auto-gc if pin\_method is set to “refs”.  
So does this mean that the Garbage collection never happens at all? Even if the StorageGCWatermark value is exceeded?

---

<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:** [September 10, 2018, 7:49am UTC](https://discuss.ipfs.tech/t/garbage-collection-in-ipfs/3807/2 "2018-09-10T07:49:50Z")

</div>

That’s the default in ipfs but you can always run it manually.

You can enable auto-gc, it just may wipe things which are half-downloaded which will need to be re-fetched. Depending on your usage, this may be just fine.

---

<div class="post-metadata">

**Author:** ![kanithin](https://avatars.discourse-cdn.com/v4/letter/k/87869e/32.png) [@kanithin](https://discuss.ipfs.tech/u/kanithin)\
**Post date:** [September 10, 2018, 8:06am UTC](https://discuss.ipfs.tech/t/garbage-collection-in-ipfs/3807/3 "2018-09-10T08:06:38Z")

</div>

Thanks Hector.

Can you also explain what exactly does “refs” pinning do?

---

<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:** [September 10, 2018, 8:15am UTC](https://discuss.ipfs.tech/t/garbage-collection-in-ipfs/3807/4 "2018-09-10T08:15:54Z")

</div>

Calling `ipfs pin add` makes a global lock that allows to only be downloading and pinning 1 thing at a time.

Instead what we call `refs pinning`, makes `ipfs refs -r $hash` first. This downloads the content to the local ipfs node first. So the blocking `pin add` call does not need to download anything and thus, happens much faster. Downloading refs for multiple hashes can happen in parallel, so if you’re adding a big pin, you can still pin other things while the big one is downloading. If you use `pin`, things would be queued until the big pin is downloaded and pinned.
