How to mount Glusterfs volumes inside LXC/LXD (Linux containers)

How to mount Glusterfs volumes inside LXC/LXD (Linux containers)

To mount Glusterfs volumes inside LXC/LXD (Linux containers), you can use the mount command along with the Glusterfs client utilities.

Here is a general outline of the steps you can follow:

  1. Install the Glusterfs client utilities on the host system. On Ubuntu or Debian systems, you can install the Glusterfs client utilities by running the following command:
refer to:‮‬lautturi.com
apt-get install glusterfs-client

On CentOS or Fedora systems, you can install the Glusterfs client utilities by running the following command:

yum install glusterfs-client
  1. Create a mount point for the Glusterfs volume in the container. You can do this by running the mkdir command inside the container. For example, to create a mount point at /mnt/gluster, run the following command:
mkdir /mnt/gluster
  1. Mount the Glusterfs volume inside the container. You can do this by running the mount command inside the container, using the Glusterfs client utilities. Here is an example of how to mount a Glusterfs volume at /mnt/gluster:
mount -t glusterfs <server>:<volume> /mnt/gluster

Replace <server> with the hostname or IP address of the Glusterfs server, and <volume> with the name of the Glusterfs volume you want to mount.

  1. (Optional) Add the mount point to the container's fstab file to make it persistent across reboots. To do this, add the following line to the /etc/fstab file inside the container:
<server>:<volume> /mnt/gluster glusterfs defaults 0 0

Replace <server> with the hostname or IP address of the Glusterfs server, and <volume> with the name of the Glusterfs volume you want to mount.

That's it! You now know how to mount Glusterfs volumes inside LXC/LXD containers.

Note: You may need to modify the steps depending on your specific setup and requirements. Additionally, make sure that the Glusterfs server is configured correctly and that the container has network access to the server.

Created Time:2017-10-16 14:38:50  Author:lautturi