Preparing a Debian VPS for GlusterFS
This document describes the manual steps needed to prepare a Debian VPS for GlusterFS.
Create a new VPS with Debian and select the manual installation option. During manual installation, at the disk partitioning step be sure to select "Guided - use entire disk and set up LVM". Then boot the VM in a live Linux rescue mode so that the root volume is not mounted.
Display information about logical volumes:
lvs
You should have a volume group containing your hostname (e.g. helium--vg) and
a logical volume called "root". This volume contains the operating system. We
will create a new logical volume for GlusterFS data.
Force fsck to check the filesystem on the "root" logical volume:
export VG=helium
fsck -f /dev/mapper/${VG}--vg-root
Reduce the filesystem:
resize2fs /dev/mapper/${VG}--vg-root 60G
Reduce the size of the logical volume:
lvreduce -L 60G /dev/mapper/${VG}--vg-root
Create a logical volume for GlusterFS:
lvcreate -n gluster -L 180G ${VG}-vg
Format the logical volume to the XFS filesystem:
mkfs.xfs -i size=512 /dev/mapper/${VG}--vg-gluster
You can test to see if it's working:
mount /dev/mapper/${VG}--vg-gluster /mnt
df -h
Reboot the system into Debian.
Some useful GlusterFS commands:
# List all the nodes in the pool
sudo gluster pool list
# List information of all volumes
sudo gluster volume info
# Display status of volumes
sudo gluster volume status
# Enable self-heal-daemon for volume
sudo gluster volume heal vol1 enable
# Displays the count of files to be healed
sudo gluster volume heal vol1 statistics heal-count
# Mount a volume
sudo mount -t glusterfs localhost:/vol1 /mnt