Nfs – Mounted gluster volume only accessible by root

clusternfs

I have a 2-node cluster with each node having two HDDs. The home directory of mpiuser is shared between the nodes via NFS(Used guide here). The 2nd HDD of each node was used to create a gluster volume.
Now I want to mount the gluster volume(gv0) to a directory (lets say scratch) inside mpiuser and run mpi code in scratch. But when I mount gv0 /home/mpiuser/scratch only root can create files in it. Therefore mpiuser cannot run a code and generate files.

The way I mounted it was using

sudo mount.glusterfs 192.168.0.100:/gv0 /home/mpiuser/scratch

I would appreciate any suggestions to get this to work.

Best Answer

I needed to set uid and gid of gluster volume to mpiuser. To find uid executed

id -u <username>

and for gid

id -g <username>

To change uid of gluster volume

sudo gluster volume set <volume name> storage.owner-uid <uid>

To change gid

    sudo gluster volume set <volume name>  storage.owner-gid <gid>

Then mounted gluster volume on head node and shared mount point through NFS to slave node.

Related Topic