Introduction to Distributed Storage
Linux
What is GlusterFS?
GlusterFS is a powerful, free, and open-source file system that lets you connect the storage from many different computers into one large, shared pool of storage. Imagine you have three separate computers, each with its own hard drive. GlusterFS acts like a layer of glue that binds these separate hard drives together, so they appear and work to the user as a single, giant hard drive. This makes it very easy to store huge amounts of data without needing to buy expensive, specialized storage machines.
One of the best things about GlusterFS is how it keeps your data safe and always available. When you save a file to this shared pool, GlusterFS can automatically copy it across multiple computers in the background. This means if one computer crashes or its hard drive completely breaks, your data is still perfectly safe and accessible from the other computers. You can also easily add more storage at any time just by plugging in a new computer and adding it to the group, which is known as a "cluster."
Because it is so flexible and reliable, many companies use GlusterFS for things like cloud computing, storing large backup files, and keeping media files like videos and images safe. It does not require any special hardware to run; it works beautifully on standard, everyday servers using regular network cables. This makes it a popular choice for anyone who needs a highly scalable and safe way to manage a rapidly growing amount of digital information.
Prerequisites
- Three separate servers: Virtual machines or physical computers running a modern Linux operating system (like CentOS Stream, RHEL, or Fedora) named
server1,server2, andserver3. - A dedicated storage disk: At least one secondary, empty hard drive on each server dedicated entirely to GlusterFS storage. For this guide, we will use the raw, unpartitioned device
/dev/sdb. - Network connectivity: A working network connection with static IP addresses that allows all three servers to communicate with each other over the local network.
- Root privileges: Root or
sudoaccess on all servers to install software packages and modify system files. - Time synchronization: NTP (Network Time Protocol) must be installed and running on each server to ensure they all share the exact same system time.
Step-by-Step Installation
Configure Hostname Resolution
# Open the hosts file using a text editor like nano or vi nano /etc/hosts # Add the IP addresses and hostnames for all three nodes at the bottom of the file 192.168.1.101 server1 192.168.1.102 server2 192.168.1.103 server3
Format and Mount the Storage Bricks
# Format the raw disk directly with the XFS file system mkfs.xfs -i size=512 /dev/sdb # Create the folder where the drive will be mounted mkdir -p /data/brick1 # Add this rule so the drive mounts automatically if the server restarts echo '/dev/sdb /data/brick1 xfs defaults 0 0' >> /etc/fstab # Mount the drive and check if it was successful mount -a && mount
Install the GlusterFS Software
# Install the GlusterFS repository release package yum install centos-release-gluster -y # Install the GlusterFS server package yum install glusterfs-server -y # Enable and start the GlusterFS service automatically systemctl enable --now glusterd # Check to make sure it is running (Look for "Active: active") systemctl status glusterd
Configure the Firewalls
# Run this for the first peer's IP address firewall-cmd --zone=trusted --add-source=<ip-address-1> --permanent # Run this for the second peer's IP address firewall-cmd --zone=trusted --add-source=<ip-address-2> --permanent # Reload the firewall to apply the changes immediately firewall-cmd --reload
Connect the Servers Together
gluster peer probe server2 gluster peer probe server3
gluster peer status
Create the Shared Storage Volume
mkdir -p /data/brick1/gv0
# Create the highly available shared volume gluster volume create gv0 replica 3 server1:/data/brick1/gv0 server2:/data/brick1/gv0 server3:/data/brick1/gv0 # Start the volume gluster volume start gv0 # Check that the volume status says "Started" gluster volume info
Test Your New Storage Pool
# Create a test folder on the server mkdir /mnt/gluster-test # Mount the GlusterFS shared pool to that folder mount -t glusterfs server1:/gv0 /mnt/gluster-test # Copy 100 system log files into the shared pool to test replication for i in `seq -w 1 100`; do cp -rp /var/log/messages /mnt/gluster-test/copy-test-$i; done
# Check the client view (It should output 100) ls -lA /mnt/gluster-test/copy* | wc -l # Check the actual physical hard drive on ANY of the three servers (It should also output 100 on each one) ls -lA /data/brick1/gv0/copy*
CTCservers Recommended Tutorials
Web, Network
Step-by-Step Guide: Install AMD ROCm on Ubuntu with RX 6600 GPU
Learn how to quickly and easily set up AMD ROCm on Ubuntu for your RX 6600 GPU, enabling powerful machine learning, AI workloads, and GPU-accelerated computing right on your system.
Web, Network, Linux, Mysql, Ubuntu
LAMP Setup Guide 2026: Ubuntu & Debian | CTCservers
Install a secure LAMP stack on Debian or Ubuntu. Follow our step-by-step guide to configure Linux, Apache, MySQL, and PHP for your web server.
Web, Network, Ubuntu
Deploy Phi-3 with Ollama on Ubuntu GPU | CTCservers
Learn how to easily deploy the Phi-3 LLM on an Ubuntu 24.04 GPU server using Ollama and WebUI. Follow our step-by-step tutorial for seamless AI hosting.
Discover CTCservers Dedicated Server Locations
CTCservers servers are available around the world, providing diverse options for hosting websites. Each region offers unique advantages, making it easier to choose a location that best suits your specific hosting needs.