12.3. GFS2 Configuration
Configuring Samba with the Red Hat Enterprise Linux clustering requires two GFS2 file systems: One small file system for CTDB, and a second file system for the Samba share. This example shows how to create the two GFS2 file systems.
Before creating the GFS2 file systems, first create an LVM logical volume for each of the file systems. For information on creating LVM logical volumes, see Logical Volume Manager Administration. This example uses the following logical volumes:
/dev/csmb_vg/csmb_lv, which will hold the user data that will be exported by means of a Samba share and should be sized accordingly. This example creates a logical volume that is 100GB in size.
/dev/csmb_vg/ctdb_lv, which will store the shared CTDB state information and needs to be 1GB in size.
You create clustered volume groups and logical volumes on one node of the cluster only.
To create a GFS2 file system on a logical volume, run the
mkfs.gfs2command. You run this command on one cluster node only.
To create the file system to host the Samba share on the logical volume
/dev/csmb_vg/csmb_lv, execute the following command:
mkfs.gfs2 -j3 -p lock_dlm -t csmb:gfs2 /dev/csmb_vg/csmb_lv
The meaning of the parameters is as follows:
- Specifies the number of journals to create in the filesystem. This example uses a cluster with three nodes, so we create one journal per node.
- Specifies the locking protocol.
lock_dlmis the locking protocol GFS2 uses for inter-node communication.
- Specifies the lock table name and is of the format cluster_name:fs_name. In this example, the cluster name as specified in the
csmb, and we use
gfs2as the name for the file system.
The output of this command appears as follows:
This will destroy any data on /dev/csmb_vg/csmb_lv. It appears to contain a gfs2 filesystem. Are you sure you want to proceed? [y/n]
yDevice: /dev/csmb_vg/csmb_lv Blocksize: 4096 Device Size 100.00 GB (26214400 blocks) Filesystem Size: 100.00 GB (26214398 blocks) Journals: 3 Resource Groups: 400 Locking Protocol: "lock_dlm" Lock Table: "csmb:gfs2" UUID: 94297529-ABG3-7285-4B19-182F4F2DF2D7
In this example, the
/dev/csmb_vg/csmb_lvfile system will be mounted at
/mnt/gfs2on all nodes. This mount point must match the value that you specify as the location of the
sharedirectory with the
path =option in the
/etc/samba/smb.conffile, as described in Section 12.5, “Samba Configuration”.
To create the file system to host the CTDB state information on the logical volume
/dev/csmb_vg/ctdb_lv, execute the following command:
mkfs.gfs2 -j3 -p lock_dlm -t csmb:ctdb_state /dev/csmb_vg/ctdb_lv
Note that this command specifies a different lock table name than the lock table in the example that created the filesystem on
/dev/csmb_vg/csmb_lv. This distinguishes the lock table names for the different devices used for the file systems.
The output of the
mkfs.gfs2appears as follows:
This will destroy any data on /dev/csmb_vg/ctdb_lv. It appears to contain a gfs2 filesystem. Are you sure you want to proceed? [y/n]
yDevice: /dev/csmb_vg/ctdb_lv Blocksize: 4096 Device Size 1.00 GB (262144 blocks) Filesystem Size: 1.00 GB (262142 blocks) Journals: 3 Resource Groups: 4 Locking Protocol: "lock_dlm" Lock Table: "csmb:ctdb_state" UUID: BCDA8025-CAF3-85BB-B062-CC0AB8849A03
In this example, the
/dev/csmb_vg/ctdb_lvfile system will be mounted at
/mnt/ctdbon all nodes. This mount point must match the value that you specify as the location of the
.ctdb.lockfile with the
CTDB_RECOVERY_LOCKoption in the
/etc/sysconfig/ctdbfile, as described in Section 12.4, “CTDB Configuration”.