Moving a file after add —nocopy

I was wondering how the filestore is implemented. What happens is you move a file after doing an IPFS add —nocopy ?

Then the file cannot be accessed by IPFS any longer.

When you run filestore verify you’ll get the no-file error message.

But you can readd the file on the new location, IPFS will detect that it’s the same content and reuse it for the same CID.

Thanks, that makes sense and I can see why you’d want to do that but it would be cool if there was an option to reference it by inode like a hard link.

Accessing files directly by inode number is not possible in any stable way and the alternatives are both non-portable and require special privileges. That said the hard-link idea would be very easy to perform manually: Just create the hard-link yourself to a known protected directory (like ${IPFS_PATH:-~/.ipfs}/filestore-links?) and tell IPFS filestore it in from there.


  1. Unpinning the file from IPFS does not delete the hard-link, some extra tracking would be needed for that.
  2. As usual for hard-links, modifying the content of the file at the original location, still invalidate its content in filestore as it currently does.