GC: What files will be delete?

Hi all!

I have IPFS installed on my server as a file server. I need to delete those files that have not been used in X time to optimize the disk space. I have seen that in the configuration it has the option GCPeriod, which is enabled using --enable-gc when starting the daemon. I would like to know what criteria GC will use to delete files. Somebody could help me?

It deletes everything not explicitly pinned (all files added with ipfs add are automatically “pinned”).

1 Like

So if I enable this option and download a file that has not been added to my node (the file was added to another node) after one hour it will delete that file?

It also depends on the following settings in the config:

  • Datastore.GCPeriod
  • Datastore.StorageGCWatermark
  • Datastore.StorageMax

See this documentation for more details.

The short answer is that it will only delete the file after 1 hour if your GCPeriod is set to 1 hour and your datastore size exceeds the thresholds determined by the StorageGCWatermark and StorageMax settings.

2 Likes