I'm running a NAS server with an SD card mounted as /
and RAID-1 storage mounted under /media/hdd
. /etc
folder is on SD card. PostgreSQL data folder is on the RAID-1 disk.
/-+
+- etc
| +- postgres
| +- 10
| +- mycluster
|
+- media
|
+- hdd
+- pgsql
+- data
+- mycluster
If I want to move RAID-1 disks to a different box, what is the correct way to re-create a PostgreSQL cluster using exiting data folder? Let's assume I stopped the cluster, shutdown the system, took out hard disks and attached them to another box. Can I create a new cluster on that box using the existing data folder on the attached hard disks?
Thank you in advance.
Best Answer
Yes, that is no problem, as long as
you are using the same major version of PostgreSQL on the new machine
PostgreSQL was built in the same way
both machines have the same architecture and operating system version (the version is relevant because it might affect the collations, changing versions requires a
REINDEX
)Running PostgreSQL on a NAS file system is dangerous, because many NAS implementations are not reliable.