Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f5989b9
Add MFS command line options, extend existing mount functions for MFS…
gsergey418 Apr 7, 2025
47aa0f0
Directory listing and file stat.
gsergey418 Apr 8, 2025
6fee6d5
Add a read-only MFS view.
gsergey418 Apr 10, 2025
5e04696
Add mkdir and interface checks.
gsergey418 Apr 10, 2025
cda7cf7
Add remove and rename functionality.
gsergey418 Apr 10, 2025
5b9deba
Implement all required write interfaces.
gsergey418 Apr 11, 2025
6e1a455
Adjust mount functions for other architechtures.
gsergey418 Apr 11, 2025
d1b4cc1
Merge branch 'master' into feat/10710-mfs-fuse-mount
gsergey418 Apr 11, 2025
759021b
Merge branch 'master' into feat/10710-mfs-fuse-mount
gsergey418 Apr 11, 2025
d4cdb93
Write a basic read/write test.
gsergey418 Apr 11, 2025
8bba26e
Write more basic tests, add a mutex to the file object, fix modtime.
gsergey418 Apr 14, 2025
d7342aa
Add a concurrency test, remove mutexes from file and directory struct…
gsergey418 Apr 14, 2025
c64cfff
Refactor naming(mfdir -> mfsdir) and add documentation.
gsergey418 Apr 22, 2025
7e57b85
Add CID retrieval through ipfs_cid xattr.
gsergey418 Apr 22, 2025
3a1bf22
Merge branch 'master' into feat/10710-mfs-fuse-mount
guillaumemichel Apr 25, 2025
6424872
Add docs, add xattr listing, fix bugs for mv and stat, refactor.
gsergey418 Apr 28, 2025
c579d85
Add MFS command line options, extend existing mount functions for MFS…
gsergey418 May 5, 2025
63852d9
docs phrasing
guillaumemichel May 6, 2025
5a0cf17
Merge master into feat/10710-mfs-fuse-mount
lidel May 6, 2025
a24fa2f
docs: Mounts.MFS
lidel May 6, 2025
a830433
docs: warn about lazy-loaded DAGs
lidel May 6, 2025
7f17080
test: TEST_FUSE=1 ./t0030-mount.sh -v
lidel May 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cmd/ipfs/kubo/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
initProfileOptionKwd = "init-profile"
ipfsMountKwd = "mount-ipfs"
ipnsMountKwd = "mount-ipns"
mfsMountKwd = "mount-mfs"
migrateKwd = "migrate"
mountKwd = "mount"
offlineKwd = "offline" // global option
Expand Down Expand Up @@ -173,6 +174,7 @@
cmds.BoolOption(mountKwd, "Mounts IPFS to the filesystem using FUSE (experimental)"),
cmds.StringOption(ipfsMountKwd, "Path to the mountpoint for IPFS (if using --mount). Defaults to config setting."),
cmds.StringOption(ipnsMountKwd, "Path to the mountpoint for IPNS (if using --mount). Defaults to config setting."),
cmds.StringOption(mfsMountKwd, "Path to the mountpoint for MFS (if using --mount). Defaults to config setting."),
cmds.BoolOption(unrestrictedAPIAccessKwd, "Allow RPC API access to unlisted hashes"),
cmds.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)"),
cmds.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection"),
Expand Down Expand Up @@ -1062,17 +1064,23 @@
nsdir = cfg.Mounts.IPNS
}

mfsdir, found := req.Options[mfsMountKwd].(string)
if !found {
mfsdir = cfg.Mounts.MFS
}

Check warning on line 1070 in cmd/ipfs/kubo/daemon.go

View check run for this annotation

Codecov / codecov/patch

cmd/ipfs/kubo/daemon.go#L1067-L1070

Added lines #L1067 - L1070 were not covered by tests

node, err := cctx.ConstructNode()
if err != nil {
return fmt.Errorf("mountFuse: ConstructNode() failed: %s", err)
}

err = nodeMount.Mount(node, fsdir, nsdir)
err = nodeMount.Mount(node, fsdir, nsdir, mfsdir)

Check warning on line 1077 in cmd/ipfs/kubo/daemon.go

View check run for this annotation

Codecov / codecov/patch

cmd/ipfs/kubo/daemon.go#L1077

Added line #L1077 was not covered by tests
if err != nil {
return err
}
fmt.Printf("IPFS mounted at: %s\n", fsdir)
fmt.Printf("IPNS mounted at: %s\n", nsdir)
fmt.Printf("MFS mounted at: %s\n", mfsdir)

Check warning on line 1083 in cmd/ipfs/kubo/daemon.go

View check run for this annotation

Codecov / codecov/patch

cmd/ipfs/kubo/daemon.go#L1083

Added line #L1083 was not covered by tests
return nil
}

Expand Down
1 change: 1 addition & 0 deletions config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
Mounts: Mounts{
IPFS: "/ipfs",
IPNS: "/ipns",
MFS: "/mfs",

Check warning on line 55 in config/init.go

View check run for this annotation

Codecov / codecov/patch

config/init.go#L55

Added line #L55 was not covered by tests
},

Ipns: Ipns{
Expand Down
1 change: 1 addition & 0 deletions config/mounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ package config
type Mounts struct {
IPFS string
IPNS string
MFS string
FuseAllowOther bool
}
5 changes: 3 additions & 2 deletions core/commands/mount_nofuse.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ var MountCmd = &cmds.Command{
ShortDescription: `
This version of ipfs is compiled without fuse support, which is required
for mounting. If you'd like to be able to mount, please use a version of
ipfs compiled with fuse.
Kubo compiled with fuse.

For the latest instructions, please check the project's repository:
https://github.com/ipfs/go-ipfs
https://github.com/ipfs/kubo
https://github.com/ipfs/kubo/blob/master/docs/fuse.md
`,
},
}
22 changes: 16 additions & 6 deletions core/commands/mount_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@ import (
const (
mountIPFSPathOptionName = "ipfs-path"
mountIPNSPathOptionName = "ipns-path"
mountMFSPathOptionName = "mfs-path"
)

var MountCmd = &cmds.Command{
Status: cmds.Experimental,
Helptext: cmds.HelpText{
Tagline: "Mounts IPFS to the filesystem (read-only).",
ShortDescription: `
Mount IPFS at a read-only mountpoint on the OS (default: /ipfs and /ipns).
Mount IPFS at a read-only mountpoint on the OS (default: /ipfs, /ipns, /mfs).
All IPFS objects will be accessible under that directory. Note that the
root will not be listable, as it is virtual. Access known paths directly.

You may have to create /ipfs and /ipns before using 'ipfs mount':

> sudo mkdir /ipfs /ipns
> sudo chown $(whoami) /ipfs /ipns
> sudo mkdir /ipfs /ipns /mfs
> sudo chown $(whoami) /ipfs /ipns /mfs
> ipfs daemon &
> ipfs mount
`,
Expand All @@ -44,8 +45,8 @@ root will not be listable, as it is virtual. Access known paths directly.

You may have to create /ipfs and /ipns before using 'ipfs mount':

> sudo mkdir /ipfs /ipns
> sudo chown $(whoami) /ipfs /ipns
> sudo mkdir /ipfs /ipns /mfs
> sudo chown $(whoami) /ipfs /ipns /mfs
> ipfs daemon &
> ipfs mount

Expand All @@ -67,6 +68,7 @@ baz
> ipfs mount
IPFS mounted at: /ipfs
IPNS mounted at: /ipns
MFS mounted at: /mfs
> cd /ipfs/QmSh5e7S6fdcu75LAbXNZAFY2nGyZUJXyLCJDvn2zRkWyC
> ls
bar
Expand All @@ -81,6 +83,7 @@ baz
Options: []cmds.Option{
cmds.StringOption(mountIPFSPathOptionName, "f", "The path where IPFS should be mounted."),
cmds.StringOption(mountIPNSPathOptionName, "n", "The path where IPNS should be mounted."),
cmds.StringOption(mountMFSPathOptionName, "m", "The path where MFS should be mounted."),
},
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
cfg, err := env.(*oldcmds.Context).GetConfig()
Expand Down Expand Up @@ -109,21 +112,28 @@ baz
nsdir = cfg.Mounts.IPNS // NB: be sure to not redeclare!
}

err = nodeMount.Mount(nd, fsdir, nsdir)
mfsdir, found := req.Options[mountMFSPathOptionName].(string)
if !found {
mfsdir = cfg.Mounts.MFS
}

err = nodeMount.Mount(nd, fsdir, nsdir, mfsdir)
if err != nil {
return err
}

var output config.Mounts
output.IPFS = fsdir
output.IPNS = nsdir
output.MFS = mfsdir
return cmds.EmitOnce(res, &output)
},
Type: config.Mounts{},
Encoders: cmds.EncoderMap{
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, mounts *config.Mounts) error {
fmt.Fprintf(w, "IPFS mounted at: %s\n", cmdenv.EscNonPrint(mounts.IPFS))
fmt.Fprintf(w, "IPNS mounted at: %s\n", cmdenv.EscNonPrint(mounts.IPNS))
fmt.Fprintf(w, "MFS mounted at: %s\n", cmdenv.EscNonPrint(mounts.MFS))

return nil
}),
Expand Down
1 change: 1 addition & 0 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ type IpfsNode struct {
type Mounts struct {
Ipfs mount.Mount
Ipns mount.Mount
Mfs mount.Mount
}

// Close calls Close() on the App object
Expand Down
9 changes: 9 additions & 0 deletions docs/changelogs/v0.35.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This release was brought to you by the [Shipyard](http://ipshipyard.com/) team.
- [🔦 Highlights](#-highlights)
- [Opt-in HTTP Retrieval client](#opt-in-http-retrieval-client)
- [Dedicated `Reprovider.Strategy` for MFS](#dedicated-reproviderstrategy-for-mfs)
- [Experimental support for MFS as a FUSE mount point](#experimental-support-for-mfs-as-a-fuse-mount-point)
- [Grid view in WebUI](#grid-view-in-webui)
- [Enhanced DAG-Shaping Controls](#enhanced-dag-shaping-controls)
- [New DAG-Shaping `ipfs add` Options](#new-dag-shaping-ipfs-add-options)
Expand Down Expand Up @@ -64,6 +65,14 @@ Users relying on the `pinned` strategy can switch to `pinned+mfs` and use MFS al

See [`Reprovider.Strategy`](https://github.com/ipfs/kubo/blob/master/docs/config.md#reproviderstrategy) for more details.

#### Experimental support for MFS as a FUSE mount point

The MFS root (filesystem behind the `ipfs files` API) is now available as a read/write FUSE mount point at `Mounts.MFS`. This filesystem is mounted in the same way as `Mounts.IPFS` and `Mounts.IPNS` when running `ipfs mount` or `ipfs daemon --mount`.

Note that the operations supported by the MFS FUSE mountpoint are limited, since MFS doesn't store file attributes.

See [`Mounts`](https://github.com/ipfs/kubo/blob/master/docs/config.md#mounts) and [`docs/fuse.md`](https://github.com/ipfs/kubo/blob/master/docs/fuse.md) for more details.

#### Grid view in WebUI

The WebUI, accessible at http://127.0.0.1:5001/webui/, now includes support for the grid view on the _Files_ screen:
Expand Down
16 changes: 15 additions & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ config file at runtime.
- [`Mounts`](#mounts)
- [`Mounts.IPFS`](#mountsipfs)
- [`Mounts.IPNS`](#mountsipns)
- [`Mounts.MFS`](#mountsmfs)
- [`Mounts.FuseAllowOther`](#mountsfuseallowother)
- [`Pinning`](#pinning)
- [`Pinning.RemoteServices`](#pinningremoteservices)
Expand Down Expand Up @@ -1368,7 +1369,8 @@ Default: `cache`

## `Mounts`

**EXPERIMENTAL:** read about current limitations at [fuse.md](./fuse.md).
> [!CAUTION]
> **EXPERIMENTAL:** read about current limitations at [fuse.md](./fuse.md).

FUSE mount point configuration options.

Expand All @@ -1388,6 +1390,18 @@ Default: `/ipns`

Type: `string` (filesystem path)

### `Mounts.MFS`

Mountpoint for Mutable File System (MFS) behind the `ipfs files` API.

> [!CAUTION]
> - Write support is highly experimental and not recommended for mission-critical deployments.
> - Avoid storing lazy-loaded datasets in MFS. Exposing a partially local, lazy-loaded DAG risks operating system search indexers crawling it, which may trigger unintended network prefetching of non-local DAG components.

Default: `/mfs`

Type: `string` (filesystem path)

### `Mounts.FuseAllowOther`

Sets the 'FUSE allow other'-option on the mount point.
Expand Down
2 changes: 1 addition & 1 deletion docs/experimental-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ We also support the use of protocol names of the form /x/$NAME/http where $NAME

## FUSE

FUSE makes it possible to mount `/ipfs` and `/ipns` namespaces in your OS,
FUSE makes it possible to mount `/ipfs`, `/ipns` and `/mfs` namespaces in your OS,
allowing arbitrary apps access to IPFS using a subset of filesystem abstractions.

It is considered EXPERIMENTAL due to limited (and buggy) support on some platforms.
Expand Down
28 changes: 25 additions & 3 deletions docs/fuse.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**EXPERIMENTAL:** FUSE support is limited, YMMV.

Kubo makes it possible to mount `/ipfs` and `/ipns` namespaces in your OS,
Kubo makes it possible to mount `/ipfs`, `/ipns` and `/mfs` namespaces in your OS,
allowing arbitrary apps access to IPFS.

## Install FUSE
Expand Down Expand Up @@ -50,18 +50,20 @@ speak with us, or if you figure something new out, please add to this document!

## Prepare mountpoints

By default ipfs uses `/ipfs` and `/ipns` directories for mounting, this can be
changed in config. You will have to create the `/ipfs` and `/ipns` directories
By default ipfs uses `/ipfs`, `/ipns` and `/mfs` directories for mounting, this can be
changed in config. You will have to create the `/ipfs`, `/ipns` and `/mfs` directories
explicitly. Note that modifying root requires sudo permissions.

```sh
# make the directories
sudo mkdir /ipfs
sudo mkdir /ipns
sudo mkdir /mfs

# chown them so ipfs can use them without root permissions
sudo chown <username> /ipfs
sudo chown <username> /ipns
sudo chown <username> /mfs
```

Depending on whether you are using OSX or Linux, follow the proceeding instructions.
Expand Down Expand Up @@ -105,6 +107,25 @@ ipfs config --json Mounts.FuseAllowOther true
ipfs daemon --mount
```

## MFS mountpoint

Kubo v0.35.0 and later supports mounting the MFS (Mutable File System) root as
a FUSE filesystem, enabling manipulation of content-addressed data like regular
files. The CID for any file or directory is retrievable via the `ipfs_cid`
extended attribute.

```sh
getfattr -n ipfs_cid /mfs/welcome-to-IPFS.jpg
getfattr: Removing leading '/' from absolute path names
# file: mfs/welcome-to-IPFS.jpg
ipfs_cid="QmaeXDdwpUeKQcMy7d5SFBfVB4y7LtREbhm5KizawPsBSH"
```

Please note that the operations supported by the MFS FUSE mountpoint are
limited. Since the MFS wasn't designed to store file attributes like ownership
information, permissions and creation date, some applications like `vim` and
`sed` may misbehave due to missing functionality.

## Troubleshooting

#### `Permission denied` or `fusermount: user has no write access to mountpoint` error in Linux
Expand Down Expand Up @@ -145,6 +166,7 @@ set for user running `ipfs mount` command.
```
sudo umount /ipfs
sudo umount /ipns
sudo umount /mfs
```

#### Mounting fails with "error mounting: could not resolve name"
Expand Down
Loading
Loading