Rate This Document
Findability
Accuracy
Completeness
Readability

Creating Data Drives

Create a data drive to store PostgreSQL data files.

  • When testing the ultimate performance, you are advised to attach an NVMe SSD with better I/O performance to create the PostgreSQL test instance. This eliminates impact of drive I/O on the performance test result. This section uses an NVMe SSD as an example. For details, see 1 to 6.
  • If no performance test is required, skip this section and go to Creating the Data Directory and Assigning Rights.
  1. Create a file system. XFS is used as an example. In the following command, replace /dev/nvme0n1 with the actual drive name.
    1
    mkfs.xfs /dev/nvme0n1
    

    If a file system has been created for the drive, an error will be reported when you run this command. You can use the -f parameter to forcibly create a file system.

    1
    mkfs.xfs -f /dev/nvme0n1
    
  2. Create a data directory.
    1
    mkdir /data
    
  3. Mount the drive.
    1
    mount -o noatime,nobarrier /dev/nvme0n1 /data
    
  4. Go to the edit screen.
    vim /etc/fstab
  5. Press i to enter the insert mode and add the line to the end of the file.

  6. Press Esc, type :wq!, and press Enter to save the file and exit.