Skip to content

feat(mfs): chroot command to change the root - #8648

Merged
lidel merged 7 commits into
masterfrom
schomatis/feat/files-cmd/mfs-new-root
Jan 13, 2026
Merged

lidel merged 7 commits into
masterfrom
schomatis/feat/files-cmd/mfs-new-root

Conversation

@schomatis schomatis self-assigned this Jan 10, 2022
@nlko

This comment was marked as outdated.

@bqv

This comment was marked as outdated.

@schomatis

Copy link
Copy Markdown
Contributor Author

Correct, thanks.

Right now the idea is for this command to be used when the MFS filesystem is corrupted and the daemon fails to start (either hangs or refuses) and you need to run this standalone to fix it. If you run it alongside the daemon it will fail as it will try to get a lock on the repo which is already in use. Will add some more documentation around that.

Comment thread core/commands/files.go Resolved
@BigLep

This comment was marked as outdated.

@BigLep
BigLep removed the request for review from hsanjuan March 3, 2022 13:39
@BigLep BigLep added this to the Best Effort Track milestone Mar 3, 2022
@schomatis

This comment was marked as outdated.

@bqv

This comment was marked as outdated.

@schomatis

This comment was marked as outdated.

@bqv

This comment was marked as outdated.

@BigLep
BigLep marked this pull request as ready for review March 4, 2022 01:25
@BigLep

This comment was marked as outdated.

@schomatis

This comment was marked as outdated.

@lidel
lidel requested a review from a team as a code owner October 3, 2024 20:13

@lidel lidel left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to latest master and resolved conflicts.

Needs final polish:

  • agree on name (maybe set-root?)
  • remove / resolve TODOs inline
  • add new command to changelog
  • tests pass, CI green

Comment thread core/commands/files.go Resolved
Comment thread core/commands/files.go Resolved
Comment thread core/commands/files.go Resolved
Comment thread core/commands/files.go Resolved
Comment thread core/commands/files.go Resolved
@lidel
lidel marked this pull request as draft October 3, 2024 20:24
@lidel lidel mentioned this pull request Feb 14, 2025
42 of 56 tasks
@hsanjuan hsanjuan self-assigned this Feb 17, 2025
@lidel lidel mentioned this pull request Mar 20, 2025
33 of 45 tasks
@lidel lidel mentioned this pull request May 21, 2025
27 of 46 tasks
@lidel lidel mentioned this pull request Jul 14, 2025
34 of 51 tasks
@lidel lidel mentioned this pull request Oct 1, 2025
50 of 74 tasks
@lidel lidel mentioned this pull request Nov 27, 2025
49 of 67 tasks
@lidel lidel assigned lidel and unassigned hsanjuan and schomatis Jan 13, 2026
@lidel lidel changed the title feat(cmds): files: add new-root command to change the MFS root feat(mfs): chroot command to change the root Jan 13, 2026
โ€ฆs-cmd/mfs-new-root

# Conflicts:
#	core/node/core.go
Comment thread core/node/core.go
Comment on lines +248 to +249
return nil, fmt.Errorf("failed to initialize MFS root from %s stored at %s: %w. "+
"If corrupted, use 'ipfs files chroot' to reset (see --help)", nd.Cid(), FilesRootDatastoreKey, err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

โ„น๏ธ this will help users like #10762 to be able to get useful error message and self-fix the problem

adds recovery command for corrupted MFS root (issue #10762):
- `ipfs files chroot [--confirm] [<cid>]` replaces the MFS root CID
- defaults to empty directory if no CID specified
- validates new CID exists locally and is a directory
- exports FilesRootDatastoreKey constant for reuse
- improved error message shows CID and suggests recovery

replaces the previous `replace-root` approach with renamed command
following the `ch*` pattern (chcid, chmod, chroot).
@lidel
lidel force-pushed the schomatis/feat/files-cmd/mfs-new-root branch from ea08931 to 4cf0bbf Compare January 13, 2026 19:47
@lidel
lidel marked this pull request as ready for review January 13, 2026 19:47
@lidel
lidel requested review from gammazero and removed request for aschmahmann January 13, 2026 19:48
Comment thread core/commands/files.go Resolved
remove LongDescription and keep only ShortDescription with examples,
following the majority pattern in the codebase (81% of commands use
only ShortDescription).
@lidel
lidel merged commit 39c609b into master Jan 13, 2026
20 checks passed
@lidel
lidel deleted the schomatis/feat/files-cmd/mfs-new-root branch January 13, 2026 20:47
@lidel lidel added the iteration/2026-q1 On maintainer radar for Q1 2026 label Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment