# systemctl stop glusterd
Reserved space for Glusterd - Gluster FS
Many Gluster FS users in the past reported that Glusterd (the Gluster FS management service) misbehaves and corrupts the cluster state when the root partition fills up due to some other malfunctioned application or when log floods.
In this blog post, I will explain how we can reserve space for Gluster operations and not worry about the undefined behaviour of Glusterd when some other app in the system misbehaves.
-
Stop the Glusterd service if running.
-
Backup the
/var/lib/glusterd
directory.# cp -r /var/lib/glusterd /var/lib/glusterd.orig # rm -rf /var/lib/glusterd
-
Create a pre-allocated file with required size.
1GiB
should be good enough for most of the Cluster sizes.# fallocate -l 1G /data/glusterd.img
-
Create the file system (xfs or ext4) and prepare the mount directory. Make the mount directory immutable to prevent Glusterd writing to this directory when
glusterd.img
is unmounted.# mkfs.xfs /data/glusterd.img # mkdir -p /var/lib/glusterd # chattr +i /var/lib/glusterd
-
Now add the entry to
/etc/fstab
to mount theglusterd.img
file on every node restart./data/gfs/glusterd.img /var/lib/glusterd xfs loop 0 0
-
Verify the
/etc/fstab
entry by running themount -a
command. Or manually mount the directory by running the following command.# mount -t xfs /data/glusterd.img /var/lib/glusterd
-
Copy the Glusterd data from the backup
# cp -r /var/lib/glusterd.orig/* /var/lib/glusterd/
-
Start the Glusterd service again
# systemctl start glusterd
Thats it! Now verify the mounted directory and Glusterd by running the following commands.
# df -h /var/lib/glusterd
Filesystem Size Used Avail Use% Mounted on
/dev/loop33 990M 30M 960M 3% /var/lib/glusterd
#
# gluster pool list
UUID Hostname State
1b58cfc0-15ed-40b8-be28-f7c341250777 localhost Connected
About Aravinda Vishwanathapura
Co-Founder & CTO at Kadalu Technologies, Creator of Sanka, Creator of Chitra, GlusterFS core team member, Maintainer of Kadalu Storage