How Do I Quickly Create Multiple WAL and DB Partitions?
The following uses /dev/nvme0n1 as an example. If there are multiple NVMe or SATA/SAS SSDs, change /dev/nvme0n1 to the actual drive letters.
Plan the WAL and DB partitions according to the NVMe drive space. In this example, the NVMe SSD is divided into twelve 60 GB partitions as WAL partitions and twelve 180 GB partitions as DB partitions.
- Create a partition.sh script.
1vi partition.sh - Add the following content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/bin/bash device=/dev/nvme0n1 parted $device mklabel gpt -s for j in `seq 1 12` do ((b = $(( $j * 8 )))) ((a = $(( $b - 8 )))) ((c = $(( $b - 6 )))) str="%" echo $a echo $b echo $c parted $device mkpart primary ${a}${str} ${c}${str} parted $device mkpart primary ${c}${str} ${b}${str} done
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Run the script to create partitions.
1bash partition.sh
Parent topic: FAQs