Better Pinning Management

What is the best way to manage the content my node is hosting?

For example, a while ago for fun I pinned Stephen Hawkings thesis paper from 1966 to my node. Let’s say I no longer wish to pin this content, what is the easiest way for me to unpin it without actually knowing the original hash?

ipfs pin ls gives me a long list of hashes, but how do I know which one(s) are associated with what content, in order to unpin it with ipfs pin rm <hash of content to unpin>?

1 Like

There’s no way.

Pins are broken and there are at least 3 different proposals open on IPFS offering better solutions for pin management.

Sometimes people recomend you do use the mutable filesystem (ipfs files) instead of pinning, but that is somewhat broken too.

2 Likes

The mutable file system (ipfs files) is probably the best way to keep track of human-readable names and the corresponding hashes. This is also somewhat well-integrated into the web UI.

First, you’re almost certainly looking for only recursive top-level pinned hashes. You can limit the pin listing to those using ipfs pin ls --type=recursive.

To easily spit out the contents when looking for a particular file, you can do this using the following command. If you want you could also pipe this output into grep or dump it into a text file for searching.

ipfs pin ls --type=recursive -q | xargs -L 1 -I % sh -c 'echo; printf "Pinned hash: "; echo %; ipfs ls %'

Here’s an example of what the output looks like:

$ ipfs pin ls --type=recursive -q | xargs -L 1 -I % sh -c 'echo; printf "Pinned hash: "; echo %; ipfs ls %'

Pinned hash: QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv
QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V 1688 about
QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y 200  contact
QmY5heUM5qgRubMDD1og9fhCPA6QdkMp3QCwd4s7gJsyE7 322  help
QmejvEPop4D7YUadeGqYWmZxHhLc4JBUCzJJHWMzdcMe2y 12   ping
QmXgqKTbzdh83pQtKFb19SpMCpDDcKR2ujqk3pKph9aCNF 1692 quick-start
QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB 1102 readme
QmQ5vhrL7uv6tuoN9KeVBwd4PwfQkXdVVmDLUZuTNxqgvm 1173 security-notes

Pinned hash: QmUQjf2wfTez3aheSWPBjGuXF9P5m2h5XaFtMmYbrCECMx
QmXQYn64hyKZpD1uYiTZbeoGRbpE9dzNTh7b9vRzW86PoA 1024        README.txt
QmSrsdqmosqkNpXfRKvxGUzHiXh89iBDwFYYWYgaGFhPdZ 246         _Metadata.json
QmXs57RSX9oXpznywwUEC8jfzEupfsn69KiMn7XPqBcwUo 61650371730 albums/
QmdP63VfAP3iXwCgpWdS5Y91DMkxdLAbRu2V4rR4hbmE3L 3863        apolloarchivr.py
QmcbyrRxMNhxqYURkKqSfDr6HkKaDoHBNneR9yFRh6K45D 8586        build_frontend_index.py
QmYbZLVVSuc6FswiZwMkbNJuCEXeDip6HXaZ7spLcmSFh7 1338        build_index.py
QmXWMUnzFPKDdKkCSAbqh2FFKD2S5mSQHrAvVfdQa8FaB9 7827022     frontend/
QmbPpWJAr1iokoPuDiLJ26ekcMNWVwPx2R9JLmLiUsA5K3 38256259    thumbnails/

So if I’m looking for which pinned hash contains the security-notes file, I can see it’s QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv.

3 Likes

3 years fast forward: Are there notable improvements, respectively: How do I manage my pins best having a “file-driven”-mentality / approach? I’ll try to explain in the following, but I understand if it is too long of a read.

So I want to distribute my backup via ipfs. I chose IPFS for transport mainly for its distributed nature in a standardized manner. So I can choose some IPFS pinning service to keep my data, but I could also send some CIDs to friends from time to time if I would like them to store that data, too.

Assume I do daily backups to my /backup folder. My plan was to do the following:

  1. ipfs add -rHw /backup
  2. ipfs files cp <current CID of /backup>

This would allow me to have an MFS on the current state of /backup, but also keep the old CIDs of /backup pinned (I keep all versions). I would then from time to time want to cleanup old pins, say I want to keep the last 100 CIDs of /backup pinned (not much changing there, the backup itself is already deduplicated).

Is this something I can do with IPFS? I already struggle getting current CID of /backup?
How do I get older CIDs of /backup?

My solution right now without using MFS:

ipfs pin ls --type recursive -q | xargs -n1 ipfs ls