Ce contenu n'est pas disponible dans la langue sélectionnée.
5.4. Formatting and Mounting Bricks
To create a Red Hat Gluster Storage volume, specify the bricks that comprise the volume. After creating the volume, the volume must be started before it can be mounted.
5.4.1. Creating Bricks Manually Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
Important
- Red Hat supports formatting a Logical Volume using the XFS file system on the bricks.
5.4.1.1. Creating a Thinly Provisioned Logical Volume Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
- Create a physical volume(PV) by using the
pvcreatecommand.pvcreate --dataalignment alignment_value device
# pvcreate --dataalignment alignment_value deviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow For example:pvcreate --dataalignment 1280K /dev/sdb
# pvcreate --dataalignment 1280K /dev/sdbCopy to Clipboard Copied! Toggle word wrap Toggle overflow Here,/dev/sdbis a storage device.Use the correctdataalignmentoption based on your device. For more information, see Section 20.2, “Brick Configuration”Note
The 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
vgcreatecommand:vgcreate --physicalextentsize alignment_value volgroup device
# vgcreate --physicalextentsize alignment_value volgroup deviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow For example:vgcreate --physicalextentsize 1280K rhs_vg /dev/sdb
# vgcreate --physicalextentsize 1280K rhs_vg /dev/sdbCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a thin-pool using the following commands:
lvcreate --thin volgroup/poolname --size pool_sz --chunksize chunk_sz --poolmetadatasize metadev_sz --zero n
# lvcreate --thin volgroup/poolname --size pool_sz --chunksize chunk_sz --poolmetadatasize metadev_sz --zero nCopy to Clipboard Copied! Toggle word wrap Toggle overflow For example:lvcreate --thin rhs_vg/rhs_pool --size 2T --chunksize 1280K --poolmetadatasize 16G --zero n
# lvcreate --thin rhs_vg/rhs_pool --size 2T --chunksize 1280K --poolmetadatasize 16G --zero nCopy to Clipboard Copied! Toggle word wrap Toggle overflow Ensure you read Chapter 20, Tuning for Performance to select appropriate values forchunksizeandpoolmetadatasize. - Create a thinly provisioned volume that uses the previously created pool by running the
lvcreatecommand with the--virtualsizeand--thinoptions:lvcreate --virtualsize size --thin volgroup/poolname --name volname
# lvcreate --virtualsize size --thin volgroup/poolname --name volnameCopy to Clipboard Copied! Toggle word wrap Toggle overflow For example:lvcreate --virtualsize 1G --thin rhs_vg/rhs_pool --name rhs_lv
# lvcreate --virtualsize 1G --thin rhs_vg/rhs_pool --name rhs_lvCopy to Clipboard Copied! Toggle word wrap Toggle overflow It is recommended that only one LV should be created in a thin pool. - Format bricks using the supported XFS configuration, mount the bricks, and verify the bricks are mounted correctly. To enhance the performance of Red Hat Gluster Storage, ensure you read Chapter 20, Tuning for Performance before formatting the bricks.
Important
Snapshots are not supported on bricks formatted with external log devices. Do not use-l logdev=deviceoption withmkfs.xfscommand for formatting the Red Hat Gluster Storage bricks.mkfs.xfs -f -i size=512 -n size=8192 -d su=128k,sw=10 device
# mkfs.xfs -f -i size=512 -n size=8192 -d su=128k,sw=10 deviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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. - Run
# mkdir /mountpointto create a directory to link the brick to.mkdir /rhgs
# mkdir /rhgsCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Add an entry in
/etc/fstab:/dev/volgroup/volname /mountpoint xfs rw,inode64,noatime,nouuid,x-systemd.device-timeout=10min 1 2
/dev/volgroup/volname /mountpoint xfs rw,inode64,noatime,nouuid,x-systemd.device-timeout=10min 1 2Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:/dev/rhs_vg/rhs_lv /rhgs xfs rw,inode64,noatime,nouuid,x-systemd.device-timeout=10min 1 2
/dev/rhs_vg/rhs_lv /rhgs xfs rw,inode64,noatime,nouuid,x-systemd.device-timeout=10min 1 2Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Run
mount /mountpointto mount the brick. - Run the
df -hcommand to verify the brick is successfully mounted:df -h
# df -h /dev/rhs_vg/rhs_lv 16G 1.2G 15G 7% /rhgsCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 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
# semanage fcontext -a -t glusterd_brick_t /rhgs/brick1 # restorecon -Rv /rhgs/brick1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.4.2. Using Subdirectory as the Brick for Volume Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
You can create an XFS file system, mount them and point them as bricks while creating a Red Hat Gluster Storage volume. If the mount point is unavailable, the data is directly written to the root file system in the unmounted directory.
For example, the
/rhgs directory 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 /rhgs directory, but now this is under root file system.
To overcome this issue, you can perform the below procedure.
During Red Hat Gluster Storage setup, create an XFS file system and mount it. After mounting, create a subdirectory and use this subdirectory as the brick for volume creation. Here, the XFS file system is mounted as
/bricks. After the file system is available, create a directory called /rhgs/brick1 and 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
/rhgsfile system is unavailable, there is no longer/rhgs/brick1directory 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.
Perform the following to use subdirectories as bricks for creating a volume:
- Create the
brick1subdirectory in the mounted file system.mkdir /rhgs/brick1
# mkdir /rhgs/brick1Copy to Clipboard Copied! Toggle word wrap Toggle overflow Repeat 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:/rhgs/brick1
# gluster volume create distdata01 ad-rhs-srv1:/rhgs/brick1 ad-rhs-srv2:/rhgs/brick2Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Start the Red Hat Gluster Storage volume.
gluster volume start distdata01
# gluster volume start distdata01Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Verify the status of the volume.
gluster volume status distdata01
# gluster volume status distdata01Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Note
If multiple bricks are used from the same server, then ensure the bricks are mounted in the following format. For example:
df -h
# df -h
/dev/rhs_vg/rhs_lv1 16G 1.2G 15G 7% /rhgs1
/dev/rhs_vg/rhs_lv2 16G 1.2G 15G 7% /rhgs2
Create a distribute volume with 2 bricks from each server. For example:
gluster volume create test-volume server1:/rhgs1/brick1 server2:/rhgs1/brick1 server1:/rhgs2/brick2 server2:/rhgs2/brick2
# gluster volume create test-volume server1:/rhgs1/brick1 server2:/rhgs1/brick1 server1:/rhgs2/brick2 server2:/rhgs2/brick2
5.4.3. Reusing a Brick from a Deleted Volume Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
Bricks can be reused from deleted volumes, however some steps are required to make the brick reusable.
Brick with a File System Suitable for Reformatting (Optimal Method)
Run
# mkfs.xfs -f -i size=512 device to reformat the brick to supported requirements, and make it available for immediate reuse in a new volume.
Note
All 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.
5.4.4. Cleaning An Unusable Brick Copier lienLien copié sur presse-papiers!
Copier lienLien copié sur presse-papiers!
If the file system associated with the brick cannot be reformatted, and the brick directory cannot be removed, perform the following steps:
- Delete all previously existing data in the brick, including the
.glusterfssubdirectory. - Run
# setfattr -x trusted.glusterfs.volume-id brickand# setfattr -x trusted.gfid brickto remove the attributes from the root of the brick. - Run
# getfattr -d -m . brickto examine the attributes set on the volume. Take note of the attributes. - Run
# setfattr -x attribute brickto remove the attributes relating to the glusterFS file system.Thetrusted.glusterfs.dhtattribute for a distributed volume is one such example of attributes that need to be removed.