Add Persistent Storage Using GlusterFS

GlusterFS Logo

I was interested in setting up persistent storage for some containers like WordPress, NextcloudPi, Pihole, and UnFi. My research lead me to GlusterFS using replicas. I borrowed from these sources:

Gluster’s docs describes their product as “a scalable, distributed file system that aggregates disk storage resources from multiple servers into a single global namespace.” What this means for me is a shared space to save data and config files while containers are spun up and brought down. Any changes to the mounted glusterfs drive is replicated to all the peer bricks.

I added three Samsung Plus 32GB USB 3.1 Flash Drives to FrankenPi for some additional high speed storage to host the gluster data.

  1. Update apt with the command:
    sudo apt-get update
  2. Install and configure GlusterFS on each server within the swarm.
    sudo apt install software-properties-common -y
    sudo apt install glusterfs-server -y

    Start and enable GlusterFS with the commands:
    sudo systemctl start glusterd
    sudo systemctl enable glusterd
  3. If you haven’t already done so, you should generate an SSH key for all nodes and copy them to the other nodes.

    Use these sections:
    Generating SSH Keys on Linux based systems
    Copying the Public Key using SSH Tools
  4. Probe the nodes from the master node only (picluster1):
    1. sudo -s
      gluster peer probe picluster2;gluster peer probe picluster3;
    2. Verify with:
      gluster pool list
      UUID Hostname State
      02c0656a-0637-4889-a185-264b56d6b24f picluster3 Connected
      2a5c475a-23de-455b-a6a9-45f08e855b3c picluster2 Connected
      bcb63335-b76f-459e-8195-352f1c0e719d localhost Connected
    3. Exit root:
  5. Create the Gluster Volume. a. This same command will be run on all machines: sudo mkdir -p /gluster/volume1

4 thoughts on “Add Persistent Storage Using GlusterFS

  1. Wow! Give us more! How is it working? What would you do different? What is the context you added this to — I understand docker and raspberry – but other details would be great! Thanks for sharing this!

  2. Could you set up GlusterFS inside a docker stack (i.e., no apt-get) to achieve the same result?

    I have 3 manager nodes and 3 worker nodes, and all 3 workers have an SSD mounted at

    I’d like to just run
    $ docker stack deploy -c swarm.yaml glusterfs

    and have a GlusterFS already running ready for my other stacks.

    Is that possible? Do you know if there’s any guide on that?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s