Red Hat Training

A Red Hat training course is available for Red Hat Gluster Storage

4.9. Attaching and Configuring the Data Disk

  1. From the Google Developers Console, click Compute > Compute Engine > VM instances > rhgs-primary-n01 > Attach > rhgs-primary-n01-data.
  2. Choose the mode as Read/write.
  3. Connect to the rhgs-primary-n01 instance via SSH, and configure the data disk:
    # ssh username@instance_external_ip
  4. Confirm the data disk is visible as /dev/sdb:
    # fdisk -l /dev/sdb
    
    Disk /dev/sdb: 10984.4 GB, 10984378859520 bytes
    255 heads, 63 sectors/track, 1335441 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk identifier: 0x00000000
  5. Configure LVM, format the filesystem, and mount the data disk:
    The script below can be used to complete this process per documented recommendations.

    Warning

    This script assumes a large enough block device to accommodate the maximum supported metadata LV size of 16 GB for LVM thin provisioning needed for snapshots. You should understand what each step in the script is doing before using it.
    #!/bin/bash
    pvcreate /dev/sdb
    vgcreate rhgs_vg /dev/sdb
    # Create metadata LV with the maximum supported size of 16GB
    lvcreate -L 16777216K --name rhgs_pool_meta rhgs_vg
    # Create data LV with the remainder of the VG space
    lvcreate -l 100%FREE --name rhgs_pool rhgs_vg
    # The lvconvert command below required 4096 free extents, so reduce the LV
    lvreduce -f -l 4096 /dev/rhgs_vg/rhgs_pool
    # Convert our LVs to a thin pool
    lvconvert --yes --thinpool rhgs_vg/rhgs_pool --poolmetadata rhgs_vg/rhgs_pool_meta
    # Disable zeroing of thin pool chunks for performance boost
    lvchange --zero n rhgs_vg/rhgs_pool
    # The -V flag for lvcreate does not allow a ‘100%FREE’ option like -l does.
    # So we’ll get the size of rhgs_pool from lvs for maximum efficiency
    LVSIZE=$(lvs --units g | grep rhgs_pool | awk '{print $4}' | awk -F. '{print $1}')
    # Create the thin LV for the bricks
    lvcreate -V ${LVSIZE}G -T rhgs_vg/rhgs_pool -n rhgs_lv
    # Create the XFS filesystem with 512B inode size and 8KB directory block size
    # This step may take a while...
    mkfs.xfs -f -i size=512 -n size=8192 -L rhgs_lv /dev/rhgs_vg/rhgs_lv
    # Create mountpoint and fstab entry
    mkdir -p /rhgs/bricks
    echo "LABEL=rhgs_lv /rhgs/bricks xfs rw,inode64,noatime,nouuid 1 2" >> /etc/fstab
    mount /rhgs/bricks
    df -h /rhgs/bricks