Formatting a BMS Disk

Scenarios

The data volumes of SAP HANA nodes can be used only after they are formatted and then attached to required directories.

Procedure

  1. Log in to the jump host. Ensure that user root and the key file are used for authentication. Then, use SSH to switch to SAP HANA nodes.
  2. Use SSD disks to form RAID 1.

    1. View the disk information.

      fdisk -l

    2. Locate the drive letters of the SSD disks, such as /dev/nvme0n1 and /dev/nvme1n1.
    3. Form RAID 1 and specify the drive letter.

      For example, if the drive letter is /dev/md0, run the following command:

      mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/nvme0n1 /dev/nvme1n1

    4. Enter y when the system displays Continue creating array?.
    5. Save the RAID configuration.

      mdadm -Ds >> /etc/mdadm.conf

      If one SSD card is damaged and the damaged drive letter is /dev/nvme1n1, perform the following operations to restore data:

      1. Run the mdadm --manage /dev/md0 --remove /dev/nvme1n1 command to remove the drive letter.
      2. Stop the node, replace the SSD card, and then start the node.
      3. Run the mdadm --manage /dev/md0 --add /dev/nvme*n1 command to add a new drive letter to restore data. Replace * with the drive letter based on the actual situation.
    6. Create the /hana/log/ directory.

      mkdir -p /hana/log/

    7. Create a file system.

      mkfs -t xfs -f /dev/md0

    8. Attach a disk.

      mount /dev/md0 /hana/log/

  3. Use LVM to logically divide the disk into a data volume and a shared volume.

    Run the following commands to partition the disk:

    parted /dev/sda mklabel gpt y

    parted /dev/sda mkpart primarty 0% 100%

  4. Run the following command to create a physical volume:

    pvcreate /dev/sda1

  5. Run the following command to create a volume group:

    vgcreate vghana /dev/sda1

  6. Run the following command to query the available capacity of the volume group:

    vgdisplay vghana

  7. Run the following commands to create logical volumes:

    lvcreate -n lvhanashared -L 3T vghana

    lvcreate -n lvhanadata -L 9T vghana

  8. Run the following commands to format the logical volumes and attach them to the corresponding directories:

    mkfs -t xfs /dev/mapper/vghana-lvhanadata

    mkfs -t xfs /dev/mapper/vghana-lvhanashared

    mkdir -p /hana/data

    mkdir -p /hana/shared

    mount /dev/mapper/vghana-lvhanadata /hana/data

    mount /dev/mapper/vghana-lvhanashared /hana/shared

  9. Run the following commands to write disk attaching relationships into the /etc/fstab file:

    /dev/mapper/vghana-lvhanadata /hana/data xfs defaults 0 0

    /dev/mapper/vghana-lvhanashared /hana/shared xfs defaults 0 0

    /dev/md0 /hana/log xfs defaults 0 0