How to do it...

For the purposes of this recipe, we will assume that the /dev/sdb device has been dedicated to PostgreSQL use. Follow these steps as the root user on two servers to create the first LVM layer:

  1. Create and verify a single LVM partition on the device with these commands:
        parted /dev/sdb mklabel gpt
        parted /dev/sdb mkpart primary 1 100%
        parted /dev/sdb set 1 lvm on
        parted /dev/sdb print
  1. Register /dev/sdb as an LVM physical device with this command:
        pvcreate /dev/sdb1
  1. Create a single volume group to contain /dev/sdb1 with this command:
        vgcreate VG_DRBD /dev/sdb1
  1. Create a single logical volume as 100% of the outer volume group with this command:
        lvcreate -n LV_DATA -l 100%VG VG_DRBD
  1. Verify that the new volume exists ...

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.