Created
May 13, 2019 09:42
-
-
Save opan/b2536fcbd3ee0e46ef48867040eb3d9b to your computer and use it in GitHub Desktop.
Setup postgreSQL slave volumn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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