How can I merge the drives of two computers and see them all as one directory?

I want to share the drives of two computers using Manjaro Linux and see them all as one directory in both computers.

I’ve been using mergerfs and sshfs and it was working when I shared one drive of B with A, merged them there and shared the merged folder back with B. Now I’ve tried merging the drives of B too but I haven’t managed to do it.

If possible I would like the computers to still work while the other is disconnected. NFS made one computer hang when the other was disconnected which is why I ended up using sshfs.

The only error I had before was some applications giving input/output error or permission denied. Which I guess it’s because I didn’t have the proper permissions. I would like to avoid that error too, without having to execute something like chmod -R 777 /mnt/merged often. I don’t know if this solution works with mergerfs.

This is what I’ve tried to do without success

user@A ❯ cat /etc/fstab

# <file system>                        <mount point>  <type>  <options>  <dump>  <pass>
UUID=1615d12a-a9fb-41a9-a84b-34c618f16832 /mnt/hdd1    ext4          nosuid,nodev,nofail,x-gvfs-show 0 0
UUID=d605a480-f133-443c-8fe7-5b0a2d1c60c1 /mnt/hdd2    ext4          nosuid,nodev,nofail,x-gvfs-show 0 0
user@192.168.1.45:/mnt/hdd0  /mnt/hdd0  fuse.sshfs  IdentityFile=/home/user/.ssh/id_rsa,uid=1000,gid=1000,allow_other,default_permissions,_netdev,follow_symlinks,ServerAliveInterval=45,ServerAliveCountMax=2,reconnect,noatime,auto  0  0
/mnt/hdd*  /mnt/storage  fuse.mergerfs  allow_other,use_ino,cache.files=partial,dropcacheonclose=true,ignorepponrename=true,func.mkdir=epall,x-gvfs-show  0  0

user@B ❯ cat /etc/fstab

# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=301e3d8d-6c0a-4f7c-864b-4185a70efbb0 /mnt/hdd1      auto    nosuid,nodev,nofail,x-gvfs-show 0 0
UUID=be8b9fd3-7ed2-45ae-881a-25fa06f4de47 /mnt/hdd2      auto    nosuid,nodev,nofail,x-gvfs-show 0 0
user@192.168.1.122:/mnt/storage  /mnt/hdd0  fuse.sshfs  IdentityFile=/home/user/.ssh/id_rsa,uid=1000,gid=1000,allow_other,default_permissions,_netdev,follow_symlinks,ServerAliveInterval=45,ServerAliveCountMax=2,reconnect,noatime 0 0
/mnt/hdd*  /mnt/storage  fuse.mergerfs  allow_other,use_ino,cache.files=partial,dropcacheonclose=true,ignorepponrename=true,func.mkdir=epall,x-gvfs-show 0 0

This is what I was using, which is working fine.

user@A ❯ cat /etc/fstab

# <file system>                        <mount point>  <type>  <options>  <dump>  <pass>
UUID=1615d12a-a9fb-41a9-a84b-34c618f16832 /mnt/hdd1    ext4          nosuid,nodev,nofail,x-gvfs-show 0 0
UUID=d605a480-f133-443c-8fe7-5b0a2d1c60c1 /mnt/hdd2    ext4          nosuid,nodev,nofail,x-gvfs-show 0 0
user@192.168.1.45:/mnt/hdd1 /mnt/hdd0 fuse.sshfs _netdev,follow_symlinks,IdentityFile=/home/user/.ssh/id_rsa,allow_other,default_permissions,uid=1000,gid=1000,ServerAliveInterval=45,ServerAliveCountMax=2,reconnect,noatime,auto,x-gvfs-show 0 0
/mnt/hdd*  /mnt/storage  fuse.mergerfs  allow_other,use_ino,cache.files=partial,dropcacheonclose=true,ignorepponrename=true,func.mkdir=epall,x-gvfs-show  0  0

user@B ❯ cat /etc/fstab

# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=301e3d8d-6c0a-4f7c-864b-4185a70efbb0 /mnt/hdd1      auto    nosuid,nodev,nofail,x-gvfs-show 0 0
UUID=be8b9fd3-7ed2-45ae-881a-25fa06f4de47 /mnt/hdd2      auto    nosuid,nodev,nofail,x-gvfs-show 0 0
user@192.168.1.122:/mnt/storage /mnt/storage fuse.sshfs _netdev,follow_symlinks,IdentityFile=/home/user/.ssh/id_rsa,allow_other,default_permissions,uid=1000,gid=1000,ServerAliveInterval=45,ServerAliveCountMax=2,reconnect,noatime,auto,x-gvfs-show 0 0

This is a duplicate of numereous topics you have created earlier.

1 Like

This is an issue I’ve gotten today and hadn’t gotten before so I don’t know how it would be a duplicate.

2 Likes

I think those are related topics. If you actually think there is a duplicate then you may merge this topic with the duplicate.

You can’t.

I’ve seen it done before by moderators.

No, I’ve answered your main question. :smiley:


To get serious: I don’t know. I don’t see a point in this mergerFS. You should probably read their documentation or ask a dev on their github page.

user@A ❯ cat /etc/fstab

/mnt/hdd*  /mnt/merged  fuse.mergerfs  allow_other,use_ino,cache.files=partial,dropcacheonclose=true,ignorepponrename=true,func.mkdir=epall,posix_acl=true  0  0

user@192.168.1.45:/mnt/merged  /mnt/shared  fuse.sshfs  _netdev,user,idmap=user,follow_symlinks,IdentityFile=/home/user/.ssh/id_rsa,allow_other,default_permissions,uid=1000,gid=1001,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,noatime,x-gvfs-show 0 0

/mnt/hdd*:/mnt/shared  /mnt/storage  fuse.mergerfs  allow_other,use_ino,cache.files=partial,dropcacheonclose=true,ignorepponrename=true,func.mkdir=epall,posix_acl=true,x-gvfs-show  0  0

user@B ❯ cat /etc/fstab

/mnt/hdd*  /mnt/merged  fuse.mergerfs  allow_other,use_ino,cache.files=partial,dropcacheonclose=true,ignorepponrename=true,func.mkdir=epall,posix_acl=true  0  0

user@192.168.1.122:/mnt/merged  /mnt/shared  fuse.sshfs  _netdev,user,idmap=user,follow_symlinks,IdentityFile=/home/user/.ssh/id_rsa,allow_other,default_permissions,uid=1000,gid=1001,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,noatime,x-gvfs-show 0 0

/mnt/hdd*:/mnt/shared  /mnt/storage  fuse.mergerfs  allow_other,use_ino,cache.files=partial,dropcacheonclose=true,ignorepponrename=true,func.mkdir=epall,posix_acl=true,x-gvfs-show  0  0

I did this in both computers

  1. Change the permissions
❯ sudo chown $USER:$USER /mnt/storage &
❯ chmod -R ugo+rw /mnt/storage &
  1. Set the setgid bit, so that files/folder under will be created with the same group as
❯ chmod g+s /mnt/storage &
  1. Set the default ACLs for the group and other
# Gives read,write,exec permissions for currently existing files and folders, recursively.
❯ setfacl -R -m u::rwx,g::rwx,o::rwx /mnt/storage &

# Gives rwx permissions by default, recursively.
❯ setfacl -R -d -m u::rwx,g::rwx,o::rwx /mnt/storage &

Do you need the folder to be mounted?
Would a solution where the contents of the folders are synchronized suffice?
I have several folders that I share between up to three devices using syncthing. The sync happens immediately, which means as long as two devices are online at the same time, they are on the same level. In addition it seems a lot easier to set up than your current approach…

2 Likes

Some folders give me Operation not supported when I do

According to this

ACL has to be explicit activated on ext-filesystems.

Should I add the acl option in /etc/fstab to the merged folders, the hard drives or both?

Are you sure I can use syncthing to share and merge hard drives? All I’ve used it for is for sharing some folder across devices. But it duplicates files.

You are right, it is a different approach.
It will create copies of all the files on all the machines. Which also means that all files are available in case one of the computers is shut down as long as they have been synchronized before.

Since a harddrive/partition can be mounted anywhere in the file system, one can mount a partition at /mnt/shared and share that folder, which effectively means sharing the whole partition.

In terms of merging hard drives, I am not sure what that means. Syncthing cannot use different physical hard drives to show them as one and distribute the files among them.

However, I have to admit, I do not understand the use-case of the setup you try to achieve, so my suggestion might be not suitable to you…

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