6.4. Formatting and Mounting Bricks
6.4.1. Creating Bricks Manually
- Red Hat supports formatting a Logical Volume using the XFS file system on the bricks.
- Create a physical volume(PV) by using the
pvcreate --dataalignment 1280K /dev/sdbHere,
/dev/sdbis a storage device.Use the correct
dataalignmentoption based on your device. For more information, see Section 13.2, “Brick Configuration”
NoteThe device name and the alignment value will vary based on the device you are using.
- Create a Volume Group (VG) from the PV using the
vgcreate --physicalextentsize 1280K rhs_vg /dev/sdb
- Create a thin-pool using the following commands:
lvcreate --thinpool VOLGROUP/thin_pool -L pool_sz --chuncksize chunk_sz --poolmetadatasize metadev_sz --zero nFor example:
lvcreate --thinpool rhs_vg/rhs_pool -L 2T --chunksize 1280K --poolmetadatasize 16G --zero nTo enhance the performance of Red Hat Gluster Storage, ensure you read Chapter 13, Configuring Red Hat Gluster Storage for Enhancing Performance chapter.
- Create a thinly provisioned volume from the previously created pool using the
lvcreate -V 1G -T rhs_vg/rhs_pool -n rhs_lvIt is recommended that only one LV should be created in a thin pool.
-l logdev=deviceoption with
mkfs.xfscommand for formatting the Red Hat Gluster Storage bricks.
# mkfs.xfs -f -i size=512 -n size=8192 -d su=128K,sw=10 DEVICEto format the bricks to the supported XFS file system format. Here, DEVICE is the created thin LV. The inode size is set to 512 bytes to accommodate for the extended attributes used by Red Hat Gluster Storage.
# mkdir /mountpointto create a directory to link the brick to.
- Add an entry in
/dev/rhs_vg/rhs_lv/mountpoint xfs rw,inode64,noatime,nouuid 1 2
# mount /mountpointto mount the brick.
- Run the
df -hcommand to verify the brick is successfully mounted:
# df -h /dev/rhs_vg/rhs_lv 16G 1.2G 15G 7% /exp1
- If SElinux is enabled, then the SELinux labels that has to be set manually for the bricks created using the following commands:
# semanage fcontext -a -t glusterd_brick_t /rhgs/brick1 # restorecon -Rv /rhgs/brick1
/expdirectory is the mounted file system and is used as the brick for volume creation. However, for some reason, if the mount point is unavailable, any write continues to happen in the
/expdirectory, but now this is under root file system.
/bricks. After the file system is available, create a directory called
/bricks/bricksrv1and use it for volume creation. Ensure that no more than one brick is created from a single mount. This approach has the following advantages:
- When the
/bricksfile system is unavailable, there is no longer
/bricks/bricksrv1directory available in the system. Hence, there will be no data loss by writing to a different location.
- This does not require any additional file system for nesting.
- Create the
bricksrv1subdirectory in the mounted file system.
# mkdir /bricks/bricksrv1Repeat the above steps on all nodes.
- Create the Red Hat Gluster Storage volume using the subdirectories as bricks.
# gluster volume create distdata01 ad-rhs-srv1:/bricks/bricksrv1 ad-rhs-srv2:/bricks/bricksrv2
- Start the Red Hat Gluster Storage volume.
# gluster volume start distdata01
- Verify the status of the volume.
# gluster volume status distdata01
Reusing a Brick from a Deleted Volume
- Brick with a File System Suitable for Reformatting (Optimal Method)
# mkfs.xfs -f -i size=512 deviceto reformat the brick to supported requirements, and make it available for immediate reuse in a new volume.
NoteAll data will be erased when the brick is reformatted.
- File System on a Parent of a Brick Directory
- If the file system cannot be reformatted, remove the whole brick directory and create it again.
- Delete all previously existing data in the brick, including the
# setfattr -x trusted.glusterfs.volume-id brickand
# setfattr -x trusted.gfid brickto remove the attributes from the root of the brick.
# getfattr -d -m . brickto examine the attributes set on the volume. Take note of the attributes.
# setfattr -x attribute brickto remove the attributes relating to the glusterFS file system.The
trusted.glusterfs.dhtattribute for a distributed volume is one such example of attributes that need to be removed.