S
S
squidw2019-04-01 10:50:21
PostgreSQL
squidw, 2019-04-01 10:50:21

How to move a directory to another drive in centos 7?

There are 2 disks sda and sdb.
Everything is on sda.
I want to leave the /var/lib/pgsql/10/data directory as is. The directory /var/lib/pgsql/10/backups I want to transfer to the sdb drive.
Current:
#: df -h /var/lib/pgsql/10/backups
File System Size Used Ext Used % Mounted on
/dev/sda1 458G 4.4G 430G 1% /

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2019-04-01
@squidw

Create a partition on / dev / sdb, file system, that's all.
after you mount it temporarily, let's say in /mnt/transfer , transfer your backups there (the contents of /var/lib/pgsql/10/backups). After the transfer, clear the source folder.
Unmount /mnt/transfer and mount to /var/lib/pgsql/10/backups. You write this mount point to /etc/fstsb , check the access rights, they must match what it was.

E
Elubuntus, 2019-04-01
@Elubuntus

I join Dmitry's answer, with a clarification about SELinux, because if it is enabled, then set the correct rights, otherwise the postgres user will not be able to write data to the specified directory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question