Keeping a rollback point for an IPFS mutable directory

An operator edits a release tree through Kubo’s Mutable File System (MFS). A stable local pathname can identify different immutable directory roots over time.

Capture the directory before editing

Use a disposable repository with a fresh /release-lab path. The first write creates a version file. Capture the directory CID and pin that root before replacing the contents. Truncation matters when the replacement is shorter than the old value.

ipfs files mkdir -p /release-lab
printf 'v1\n' | ipfs files write --create --truncate /release-lab/version
first=$(ipfs files stat --hash /release-lab)
ipfs pin add "$first"
printf 'v2\n' | ipfs files write --truncate /release-lab/version
ipfs files stat --hash /release-lab
ipfs cat "/ipfs/$first/version"

Read the previous revision by its CID

The last command should print v1 even though ipfs files read /release-lab/version now prints v2. The two reads address different revisions. Record the root CID with the release tag so rollback does not depend on knowing which workstation last updated MFS. Keeping that root pinned on one workstation still leaves availability dependent on that machine.

docs.ipfs.tech Mutable File System