Rate This Document
Findability
Accuracy
Completeness
Readability

Creating a Drive Partition

In cluster deployment, each Ceph node is configured with twelve 4 TB data drives and two 3.2 TB NVMe drives. Each 4 TB data drive functions as the data drive of the bcache device. Each NVMe drive functions as the DB partition of six OSDs and the cache drive of the bcache device.

According to the official Ceph documents, it is recommended that the size of each DB partition be at least 4% of the capacity of each data drive and that the cache drive capacity account for 5% to 10% of the total data drive capacity. You can configure the size of each DB partition based on the NVMe drive capacity.

In this example, the DB partition capacity is 30 GB, and the cache drive capacity is 400 GB (10% of the data drive capacity).

Perform the following operations on the three Ceph nodes. Two NVMe drives (/dev/nvme0n1 and /dev/nvme1n1) are used as an example. If your system has multiple NVMe SSDs, you only need to add the corresponding drive letters to the j parameter. If your required capacity is different from this example, change the number in the end=`expr $start + 30` command to the required capacity.

Procedure

  1. Create a shell script for partitioning.
    1. Create partition.sh.
      vi partition.sh
    2. Press i to enter the insert mode and add the following content:
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      23
      24
      #/bin/bash
      for j in {0..1}
      do
          parted -s /dev/nvme${j}n1  mklabel gpt
          start=0
      # Create six 30 GB partitions.
          end=`expr $start + 30`
          parted /dev/nvme${j}n1 mkpart primary 2048s ${end}GiB
          start=$end
          for i in {1..5}
          do
              end=`expr $start + 30`
              parted /dev/nvme${j}n1 mkpart primary ${start}GiB ${end}GiB
              start=$end
          done
      
      # Create six 400 GB partitions.
          for i in {1..6}
          do
              end=`expr $start + 400`
              parted /dev/nvme${j}n1 mkpart primary ${start}GiB ${end}GiB
              start=$end
          done
      done
      

      This script applies only to the current hardware configuration. For other hardware configurations, you need to modify the script.

    3. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
  2. Run the script.
    1
    2
    chmod 777 partition.sh
    bash partition.sh
    
  3. Check whether the partitions are successfully created.
    1
    lsblk
    

    If the command output similar to the following figure is displayed, the partitions are successfully created.