Skip to content

Instantly share code, notes, and snippets.

@opan
Created May 13, 2019 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save opan/b2536fcbd3ee0e46ef48867040eb3d9b to your computer and use it in GitHub Desktop.
Save opan/b2536fcbd3ee0e46ef48867040eb3d9b to your computer and use it in GitHub Desktop.
Setup postgreSQL slave volumn
# Check whether EBS volume already attached
lsblk
# Check EBS volume filesystem
sudo file -s /dev/xvdf
# If type of filesystem still 'data' it means no filesystem yet, we have to create it
sudo mkfs -t ext4 /dev/xvdf
# Mount it for data directory
sudo mkdir -p /var/lib/postgresql
sudo mount /dev/xvdf /var/lib/postgresql
# Check configuration is correct
mount
# Setup fstab to persist mounting even after reboot
## Backup fstab
sudo cp /etc/fstab /etc/fstab.org
## Find and note uuid of the EBS volume
sudo file -s /dev/xvdf
## Add new entry on /etc/fstab
sudo vim /etc/fstab
UUID=<volume-uuid> /var/lib/postgresql ext4 defaults,nofail 0 2
## verify all is working and no error !IMPORTANT!
sudo mount -a
## Reboot the system to check
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment