Mount smb/cifs as datasource does not work in v4.2.2

Installed pydio cells v4.2.2 on rocky linux 9, and wanted to use a smb/cifs share as datasource.
This does not work and the datasource is shown as “Objects down”.

Folder structure: /mnt/pydio/share
/mnt/pydio can be read/write from cells,
fstab mount entry is set to mount the share under the /share folder.

Workaround/tricks with symlinks do not work either.

Readed posts:

Thanks in advance for any hint.

Hello,

Could you please clarify:

  • what is mount point?
  • the folder path which is used for datasource in cells?

If the moint point is /mnt/pydio, it’s recommended to create new datasource at /mnt/pydio/share/datasource

Q: “what is mount point?”
A: The folder which is used to mount the smb share, e.g. //server/share//mnt/pydio/share.
/mnt/pydio/ is the parent folder where cells can/should create the .minio/.pydio files/folder.

Q: “the folder path which is used for datasource in cells?”
A: /mnt/pydio/share

Is the error message below displayed in the error log?
“Cross-device mounts detected on path … at following locations …”

1 Like

Is the error message below displayed in the error log?
“Cross-device mounts detected on path … at following locations …”

Yes, exactly.

To get around this limitation, you need to compile Pydio Cells from source.
You must edit a file named “mountinfo_linux.go”.

mkdir -p /home/pydio
cd /home/pydio
git clone -b stable https://github.com/pydio/cells
cd cells 
git clone https://github.com/pydio/minio

Edit the file /home/pydio/cells/go.mod
Go to last line, locate
replace github.com/minio/minio => github.com/pydio/minio v0.0.0-20230301104210-859d91c9822e
Replace it with
replace github.com/minio/minio => /home/pydio/cells/minio

Edit the file /home/pydio/cells/minio/pkg/mountinfo/mountinfo_linux.go
Go to line ~107, locate:

	msg := `Cross-device mounts detected on path (%s) at following locations %s. Export path should not have any sub-mounts, refusing to start.`
	if len(crossMounts) > 0 {
		// if paths didn't match then we do have cross-device mount.
		return fmt.Errorf(msg, path, crossMounts)
	}

Replace it with

	//msg := `Cross-device mounts detected on path (%s) at following locations %s. Export path should not have any sub-mounts, refusing to start.`
	if len(crossMounts) > 0 {
		// if paths didn't match then we do have cross-device mount.
		fmt.Printf("Cross-device mounts detected on path (%s) at following locations %s.\n", path, crossMounts)
		fmt.Println("Export path should not have any sub-mounts, refusing to start.")
		//return fmt.Errorf(msg, path, crossMounts)
	}

Finally, run
make && cp -p cells /opt/pydio/bin

1 Like

Tried to build, after making the changes (and after installing go ), but it fails:

../go/pkg/mod/github.com/lucas-clemente/quic-go@v0.29.0/internal/qtls/go120.go:5:13: cannot use "The version of quic-go you're using can't be built on Go 1.20 yet. For more details, please see https://github.com/lucas-clemente/quic-go/wiki/quic-go-and-Go-versions." (untyped string constant "The version of quic-go you're using can't be built on Go 1.20 yet. F...) as int value in variable declaration
make: *** [Makefile:19: main] Error 1

I installed: go version go1.20.5 linux/amd64
After downgrading to version go version go1.19.10 linux/amd64 the error message changed to:

error obtaining VCS status: exit status 128
	Use -buildvcs=false to disable VCS stamping.
make: *** [Makefile:19: main] Error 1

EDIT: Got it working after building as non root user.
After starting the new compile version, i can add the share as a datasource.

But now i cant synchronize it:

{"Id":"","Code":0,"Detail":"Cannot Stat Root: We encountered an internal error, please try again.: cause(Rename across devices not allowed, please fix your backend configuration (/mnt/pydio/.minio.sys/tmp/c4630d23-63c6-449d-9e38-528509949c82/39f2a675-13a7-4211-b32a-7f1a4ba72c7e)-\u003e(/mnt/pydio/share/.pydio))","Status":""}

Should i create/open a new topic?
(Because thats a different problem)

Enable cross-device rename and rebuild the Cells binary.
Edit the file /home/pydio/cells/minio/cmd/os-reliable.go
Go to line 21, locate

import (
	"fmt"
	"os"
	"path"
)

Replace it with


import (
	"fmt"
	"os"
	"io"
	"path"
)

Go to line 146, locate


		case isSysErrCrossDevice(err):
			return fmt.Errorf("%w (%s)->(%s)", errCrossDeviceLink, srcFilePath, dstFilePath)

Replace it with


		case isSysErrCrossDevice(err):
			if err = MoveFile(srcFilePath, dstFilePath); err != nil {
				fmt.Println(err.Error())
				return fmt.Errorf("%w (%s)->(%s)", errCrossDeviceLink, srcFilePath, dstFilePath)
			}

At the end of the file, create this new function

func MoveFile(sourcePath, destPath string) error {
    inputFile, err := os.Open(sourcePath)
    if err != nil {
        return fmt.Errorf("Couldn't open source file: %s", err)
    }
    outputFile, err := os.Create(destPath)
    if err != nil {
        inputFile.Close()
        return fmt.Errorf("Couldn't open dest file: %s", err)
    }
    defer outputFile.Close()
    _, err = io.Copy(outputFile, inputFile)
    inputFile.Close()
    if err != nil {
        return fmt.Errorf("Writing to output file failed: %s", err)
    }
    // The copy was successful, so now delete the original file
    err = os.Remove(sourcePath)
    if err != nil {
        return fmt.Errorf("Failed removing original file: %s", err)
    }
    return nil
}

Run make again

Thanks for the help, it works with the changes!

Is it planned to resolve these issues?
I wonder why you guys dont fork minio and made these changes?

I’m not a Pydio developer. But I think it is not an bug. This is expected behavior, since cross-device rename/mount are not supported by MinIO.

Can you please elaborate to me why this is a “cross device” issue?
I dont understand what that means. It makes no sense for me.

Its a normal folder/mount point, dont know why minio has issues with it.
Especially when cells is working on Linux, i expect hat it has no problem with standard things like mount a smb/cifs share. That is my eyes nothing special that requires special treatment.

But perhaps im not developer enough to understand that.

Thank you for your help again :slight_smile:
I really appreciate it.

Read about it here

@charles @bsinou

@c12simple @ghecquet @bsinou what do we think about that? Shall we modify our minio fork to support “cross-device” mounts ? I guess the original minio restriction is here for performance and safety…

That means: the mount point is /mnt/pydio/share

Please try to remove all .minio.sys folder in /mnt/pydio and /mnt/pydio/share/

Then

mkdir -p /mnt/pydio/share/datasource
or
mkdir -p /mnt/pydio/share/cells/datasource

Then create new datasource on /mnt/pydio/share/datasource or /mnt/pydio/share/cells/datasource

Without a modified version of minio, i have the same error.
“Object down” and “cross device” log entry.

[root@filebrowser ~]# cells version
Pydio Cells Home Edition
 Version: 	4.2.3-dev.20230626134437
 Built: 	26 Jun 23 13:44 +0000
 Git commit: 	cfc422416dc4697b87866fd0e2420cf1b3b8fef7
 OS/Arch: 	linux/amd64
 Go version: 	go1.19.10

This topic was automatically closed 11 days after the last reply. New replies are no longer allowed.

Hi guys @jaimedelano @nodejs i just commited the suggested modification, but it must be enabled with an environment variable CELLS_MINIO_ALLOW_CROSSMOUNT=true

Feel free to test the latest dev build and check if it’s working as expected!

REMINDER: the Minio team explicitly states that using such a setup may lead to data corruption. IMHO it could be used exceptionally to import existing data but certainly not in a production environment. At your own risk!

2 Likes