-
Notifications
You must be signed in to change notification settings - Fork 0
/
xfs.txt
30 lines (22 loc) · 950 Bytes
/
xfs.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# https://www.redhat.com/en/blog/postgresql-load-tuning-red-hat-enterprise-linux
#(echo n; echo p; echo ""; echo ""; echo ""; echo w) | fdisk /dev/vdb
#fdisk -l /dev/vdb
mkfs.xfs -b size=4096 -m reflink=1,crc=1 /dev/vdb
xfs_info /dev/vdb
#mount options
# man xfs
mount -t xfs -o noatime,nodiratime /dev/vdb /mnt/postgres
echo "/dev/vdb /mnt/postgres xfs noatime,nodiratime 0 0" >> /etc/fstab
mkdir -p /mnt/postgres/14/main
mkdir -p /mnt/postgres/14/main_clone
chown -R postgres:postgres /mnt/postgres/
chmod -R 700 /mnt/postgres/
pg_createcluster --start --start-conf=manual --datadir=/mnt/postgres/14/main 14 main
pg_lsclusters
pg_createcluster --start --start-conf=manual --datadir=/mnt/postgres/14/main_clone --port=5433 14 main_clone
# under env of clone-pg
pg_ctlcluster 14 main_clone stop
cd $PGDATA; find ./ -delete
# under env of source-pg
time cp -Hrv --reflink=always $PGDATA/* /mnt/postgres/14/main_clone/
# under env of clone-pg