Modify partitioning

General support questions
Post Reply
support07
Posts: 4
Joined: 2020/12/29 15:26:37

Modify partitioning

Post by support07 » 2020/12/29 15:48:02

Hello,

I will want to change the system partitioning of my Centos OS.
I have two physical disks (see copy image), a 50Gb disk and a 120 Gb disk. The 120 Gb disk is used for / pgsql and uses 44Gb there is space however the / dev / mapper / centos-root partition is full. How can I avoid saturating the first 50G disk?

Thank you.
Attachments
Partition.png
Partition.png (9.33 KiB) Viewed 272 times
Disque.png
Disque.png (7.73 KiB) Viewed 272 times

User avatar
jlehtone
Posts: 3344
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Modify partitioning

Post by jlehtone » 2020/12/30 08:29:03

What does fill your root?

Code: Select all

sudo du -d 1 -h -x /
That shows sizes of top-level directories under / that are in the same filesystem. Once you spot the big directories, you can go deeper.


PS. There is no point to take a screenshot (bitmap), if you can copy-paste text from terminal.

support07
Posts: 4
Joined: 2020/12/29 15:26:37

Re: Modify partitioning

Post by support07 » 2021/01/27 14:35:52

Hi,

Thank you for your reply.

Here is the return of the command:

[root@BDD02 ~]# sudo du -d 1 -h -x /
42M /etc
159M /root
41G /var
8,0K /tmp
3,5G /usr
3,8M /home
0 /media
0 /mnt
0 /opt
0 /srv
44G /

************************************************************

[root@BDD02 ~]# sudo du -d 1 -h -x /var/lib/pgsql
4,0K /var/lib/pgsql/.cache
0 /var/lib/pgsql/.config
40G /var/lib/pgsql/12
40G /var/lib/pgsql


This is the pgsql folder, this server is a postgres database server.

The problem is, the postgres instance is mapped if I'm correct on both the 44GB drive and the 120GB drive.

We only want Progress to be on the 120GB drive. This disk is made to store the database and not the 44GB one.

Thank you so much.

User avatar
jlehtone
Posts: 3344
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Modify partitioning

Post by jlehtone » 2021/01/27 15:39:05

support07 wrote:
2021/01/27 14:35:52
The problem is, the postgres instance is mapped if I'm correct on both the 44GB drive and the 120GB drive.
Yes. The problem is in the configuration of postgres.

I thought that there is only one PGDATA location?
Furthermore, the package postgresql-server has default config, where PGDATA=/var/lib/pgsql/data

You don't seem to have /var/lib/pgsql/data, but do have /var/lib/pgsql/12 and /pgsql
You clearly have something custom. Only you know which location is currently used and what data those locations have.


I prefer to let the default config that comes from packages to remain unchanged. That way no package update
can erase my custom settings (or even if they would not, it remains clear what I have set).

One "trick" is to create directory in desired location/volume and bind-mount* it to /var/lib/pgsql/data
before /var/lib/pgsql/data contains anything. When the database cluster is initialized and used, the programs
will write to /var/lib/pgsql/data as usual, but the physical storage volume is not the /

*bind-mount is not compulsory, but I don't like to mount root of filesystem directly to /var/lib/pgsql/data

support07
Posts: 4
Joined: 2020/12/29 15:26:37

Re: Modify partitioning

Post by support07 » 2021/01/27 20:21:37

We have followed two links for the installation and the setting up of the replication (from another server).

URL Installation :
https://computingforgeeks.com/how-to-in ... -centos-7/

"Step 3: Initialize and start database service

After installation, database initialization is required before service can be started.

sudo /usr/pgsql-12/bin/postgresql-12-setup initdb

The database main configuration ifile is written to: /var/lib/pgsql/12/data/postgresql.conf"

URL Replication :
https://www.server-world.info/en/note?o ... esql12&f=4

Location of $ PGDATA :
[root@BDD02 data]# pwd $PGDATA
/var/lib/pgsql/12/data
[root@BDD02 data]#



[root@BDD02 12]# sudo du -d 1 -h -x /
42M /etc
159M /root
41G /var
8,0K /tmp
3,5G /usr
3,8M /home
0 /media
0 /mnt
0 /opt
0 /srv
44G /

However, I can't see my second record...


[root@BDD02 12]# df -h
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
/dev/mapper/centos-root 44G 44G 20K 100% /
devtmpfs 5,8G 0 5,8G 0% /dev
tmpfs 5,8G 0 5,8G 0% /dev/shm
tmpfs 5,8G 634M 5,2G 11% /run
tmpfs 5,8G 0 5,8G 0% /sys/fs/cgroup
/dev/sda1 1014M 179M 836M 18% /boot
/dev/sdb1 120G 44G 77G 37% /pgsql
tmpfs 1,2G 12K 1,2G 1% /run/user/42
tmpfs 1,2G 0 1,2G 0% /run/user/0


I don't know how to use only the disk sdb1 and not the /dev/mapper/centos-root...

Ps: this is a replication server, I can delete the data but during the reinstallation I may have the same concerns ...

User avatar
jlehtone
Posts: 3344
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Modify partitioning

Post by jlehtone » 2021/01/27 21:07:33

support07 wrote:
2021/01/27 20:21:37
[root@BDD02 12]# sudo du -d 1 -h -x /

However, I can't see my second record...
Option -x for du says: Count only directories that are in same filesystem as the path (here /).
The /pgsql is in /dev/sdb1, not in /dev/mapper/centos-root

Option -d 1 for du says: summarize the path and one level of subdirectories under it.
You could go deeper. For example, du -d 3 -h /pgsql

support07 wrote:
2021/01/27 20:21:37
Location of $ PGDATA :
[root@BDD02 data]# pwd $PGDATA
/var/lib/pgsql/12/data
Ok, you use packages from postgresql's own repository and they default to PGDATA=/var/lib/pgsql/12/data

If everything is in there, then what is in /pgsql?

I would probably:
1. Stop pgsql service
2. Copy content of /var/lib/pgsql/12/data into somewhere under /pgsql (with rsync)
(If I would copy $PGDATA/ directly to /pgsql/, then there should be no other content. Is it XFS?)
3. Clear /var/lib/pgsql/12/data
If data is directly in /pgsql/, then:
4a. umount /pgsql
4b. Edit /etc/fstab to mount /dev/sdb1 into /var/lib/pgsql/12/data, not to /pgsql
Else, if data is in /pgsql/mypath/:
4. Add to /etc/fstab

Code: Select all

/pgsql/mypath /var/lib/pgsql/12/data none bind 0 0
Then, for both cases:
5. mount /var/lib/pgsql/12/data
6. restorecon -r /var/lib/pgsql/12/data
7. start pgsql service

support07
Posts: 4
Joined: 2020/12/29 15:26:37

Re: Modify partitioning

Post by support07 » 2021/01/27 21:38:17

If everything is in there, then what is in /pgsql?
[root@BDD02 ~]# ls /pgsql
pgsql-11
[root@BDD02 ~]#

An old postgres11 instance installed by a colleague ... We can delete it

Thank you for your precious advice, I will do what is necessary and I will get back to you if necessary.

User avatar
jlehtone
Posts: 3344
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Modify partitioning

Post by jlehtone » 2021/01/28 09:37:50

Then the previous install has had PGDATA=/pgsql/pgsql-11 or something under that path.

Since you seem to update pgsql, plan for future update too:
If the 12 has database cluster in /var/lib/pgsql/12/data then the 13 might have it in /var/lib/pgsql/13/data
If we mount actual volume to one path, then we can remount it to the other path too. That is easy.
Can database be converted from 12 to 13 at that point or do you have to create a new replica?

Post Reply

Return to “CentOS 7 - General Support”