GlusterFS is a system that provides network storage which has the ability to be made fault-tolerant, redundant and scalable. It’s a great option for applications that need access to large files, such as scientific grade storage solutions. What the file system does is aggregates and memory sources through a single global namespace into a pool of storage and it is accessible through multi-file level protocols.
The great thing about GlusterFS is that it is very easy to use and maintain. Here’s how you can set up your own NAS with GlusterFS.
What You Need:
- A network
- Linux Boxes
1. Set Up Your Network
Your best bet is connecting GlusterFS to Gigabit Ethernet and a huge array of servers, plus storage devices. If you don’t have these on hand, two computers or VMs are usually sufficient, particularly if you are just getting the hang of it.
2. Install Your Server
Glusterfs is included in the repository of many Linux distros. Before installation, you can first compare the version numbers between the website and your distro. Keep in mind you might have to manually update the clients. If you have a pretty recent version, you can install the server by typing (in Debian-based distro):
3. Switch to Static IP and Adding/Removing Volumes
Open up the file “etc/network/interfaces”:
and remove the line (if present)
ifacetho0 inet dynamic, then add the lines:
Restart your machine and make sure the network is working. If it does, type in the following:
Typing this will create a volume “testvol” which will be stored on the server. Your files will then be located in the “/data” directory which is in the root system and what GlusterFS considers a brick.
To verify that it works, type:
You can remove the volume later on by typing both:
4. Mounting the Volume Locally
You can do this easily by finding:
Then, use the command below to mount it.
Make sure it works before proceeding.
5. Sharing It Over NFS
More recent versions automatically give NFS access to volumes. You still need to add a portmap package to the server in order to make it work though. To do you this, all you need to do is to add a mount point:
To make a client mount the share on boot, add the details of the GlusterFS NFS share to /etc/fstab in the normal way. For our example, add the line:
Once you’re set up, you can add a new server by following the above steps. Make sure you give your new server a different IP address. To check the status of your new server, type:
If you’d like to work with names rather than IP addresses for your servers, you need to add them to the hosts file on your admin machine. All you have to do is edit
/etc/hosts with your text editor and add a line (e.g. 192.168.0.101) for each server.