MacOS Server – Database.xpg Consuming Huge Disk Space

macospostgresqlserver.app

Over the last few days I've noticed the amount of free space on my HD has been plummeting. After a bit of investigation, I found it was due to the folder /Library/Server/Wiki/Database.xpg. It was created December 11 (4 days ago), and since then its disk usage has increased to 313GB.I think it may have been caused by me starting OS X Server for the first time, but I haven't used any of the functionality from it, and didn't even realize it had a wiki. In the Server services section the Wiki is turned off anyway.

This is a huge problem, as it is still growing very fast. Based on the time machine backup (which unfortunately backed up the directory, wiping all of my backups older than August to fit it in), one day ago it was only 147GB in size. Next, my partition is "only" 1TB in size, and I'm down to 267GB spare.

What actually created the folder, what is the correct way of deleting it, and how can I stop it from happening in the future?

I'm running Mac OSX Mavericks 10.9. The Server version is 3.0.1 (13S2015). The out of sudo stat /Library/Server/Wiki/Database.xpg is:

16777223 154796535 drwx------ 4 _teamsserver _teamsserver 0 136 "Dec 15 02:14:23 2013" "Dec 11 14:34:56 2013" "Dec 11 14:34:56 2013" "Dec 11 14:34:30 2013" 4096 0 0 /Library/Server/Wiki/Database.xpg

Some more info:

> sudo ls -al /Library/Server/Wiki/Database.xpg
drwx------      4 _teamsserver  _teamsserver     136 Dec 11 14:34 .
drwxr-xr-x      8 _teamsserver  _teamsserver     272 Dec 15 02:23 ..
drwx------@    21 _teamsserver  _teamsserver     714 Dec 15 02:23 Cluster.pg
drwx------  10091 _teamsserver  _teamsserver  343094 Dec 15 02:23 backup

Running it again a few minutes later:

sudo ls -al /Library/Server/Wiki/Database.xpg
drwx------      4 _teamsserver  _teamsserver     136 Dec 11 14:34 .
drwxr-xr-x      8 _teamsserver  _teamsserver     272 Dec 15 02:25 ..
drwx------@    21 _teamsserver  _teamsserver     714 Dec 15 02:25 Cluster.pg
drwx------  10095 _teamsserver  _teamsserver  343230 Dec 15 02:25 backup

For whatever reason there are thousands of backup files being created, which are growing by a few every minute.


Edit: I have some more info. I know now the cause of the problem is almost certainly this process:

_teamsserver      578   0.0  0.1  2507572  16240   ??  S    12:51PM   0:00.26 /usr/bin/python /Applications/Server.app/Contents/ServerRoot/usr/bin/xpg_ctl stop -w -t 3600 -D /Library/Server/Wiki/Database.xpg/Cluster.pg -l /Library/Server/Wiki/Logs/postgres-xpg.log -o -c log_line_prefix=%t -c log_lock_waits=on -c log_statement=ddl -c logging_collector=on -c max_connections=500 -c unix_socket_directory=/Library/Server/Wiki/PostgresSocket -c unix_socket_group=_teamsserver -c unix_socket_permissions=0770 -c log_connections=on -c listen_addresses= -c log_directory=/Library/Server/Wiki/Logs -c log_filename=postgres-%a.log -c log_rotation_age=1440 -c log_truncate_on_rotation=on

This results in the following log lines appearing in /Library/Server/Wiki/Logs/postgre-Sun.log (today is Sunday):

2013-12-15 13:03:33 ESTLOG:  connection received: host=[local]
2013-12-15 13:03:33 ESTFATAL:  the database system is shutting down
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/000000010000001200000009' === '/Library/Server/Wiki/Database.xpg/backup/000000010000001200000009'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/00000001000000120000000A.00000020.backup' ... '/Library/Server/Wiki/Database.xpg/backup/00000001000000120000000A.00000020.backup'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/00000001000000120000000A.00000020.backup' --> '/Library/Server/Wiki/Database.xpg/backup/00000001000000120000000A.00000020.backup'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/00000001000000120000000A' === '/Library/Server/Wiki/Database.xpg/backup/00000001000000120000000A'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/00000001000000120000000B' === '/Library/Server/Wiki/Database.xpg/backup/00000001000000120000000B'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/00000001000000120000000C.00000020.backup' ... '/Library/Server/Wiki/Database.xpg/backup/00000001000000120000000C.00000020.backup'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/00000001000000120000000C.00000020.backup' --> '/Library/Server/Wiki/Database.xpg/backup/00000001000000120000000C.00000020.backup'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/00000001000000120000000C' === '/Library/Server/Wiki/Database.xpg/backup/00000001000000120000000C'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/00000001000000120000000D' === '/Library/Server/Wiki/Database.xpg/backup/00000001000000120000000D'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/00000001000000120000000E.00000020.backup' ... '/Library/Server/Wiki/Database.xpg/backup/00000001000000120000000E.00000020.backup'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/00000001000000120000000E.00000020.backup' --> '/Library/Server/Wiki/Database.xpg/backup/00000001000000120000000E.00000020.backup'
2013-12-15 13:03:35 ESTLOG:  connection received: host=[local]
2013-12-15 13:03:35 ESTFATAL:  the database system is shutting down
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/00000001000000120000000E' === '/Library/Server/Wiki/Database.xpg/backup/00000001000000120000000E'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/00000001000000120000000F' === '/Library/Server/Wiki/Database.xpg/backup/00000001000000120000000F'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/000000010000001200000010.00000020.backup' ... '/Library/Server/Wiki/Database.xpg/backup/000000010000001200000010.00000020.backup'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/000000010000001200000010.00000020.backup' --> '/Library/Server/Wiki/Database.xpg/backup/000000010000001200000010.00000020.backup'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/000000010000001200000010' === '/Library/Server/Wiki/Database.xpg/backup/000000010000001200000010'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/000000010000001200000011' === '/Library/Server/Wiki/Database.xpg/backup/000000010000001200000011'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/000000010000001200000012.00000020.backup' ... '/Library/Server/Wiki/Database.xpg/backup/000000010000001200000012.00000020.backup'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/000000010000001200000012.00000020.backup' --> '/Library/Server/Wiki/Database.xpg/backup/000000010000001200000012.00000020.backup'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/000000010000001200000012' === '/Library/Server/Wiki/Database.xpg/backup/000000010000001200000012'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/000000010000001200000013' === '/Library/Server/Wiki/Database.xpg/backup/000000010000001200000013'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/000000010000001200000014.00000020.backup' ... '/Library/Server/Wiki/Database.xpg/backup/000000010000001200000014.00000020.backup'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/000000010000001200000014.00000020.backup' --> '/Library/Server/Wiki/Database.xpg/backup/000000010000001200000014.00000020.backup'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/000000010000001200000014' === '/Library/Server/Wiki/Database.xpg/backup/000000010000001200000014'
'/Library/Server/Wiki/Database.xpg/Cluster.pg/pg_xlog/000000010000001200000015' === '/Library/Server/Wiki/Database.xpg/backup/000000010000001200000015'
2013-12-15 13:03:37 ESTLOG:  connection received: host=[local]
2013-12-15 13:03:37 ESTFATAL:  the database system is shutting down

These lines continue on and on, the log has 109962 lines so far.

I've tried connecting to the database, however it doesn't work:

$ sudo psql93 -h /Library/Server/Wiki/PostgresSocket
psql93: FATAL:  the database system is shutting down

Unfortunately I have little experience with postgresql, and don't know what to do from here.I could just kill the process, but it autostarts with the computer (I've tried restarting) so I don't think it will help.

Best Answer

I ended up completely uninstalling Apple Server to fix this problem. I used AppCleaner as it automatically gets rids of all the server files for you. A standard "drag to trash" uninstall would probably also work but I wanted to be thorough.

Not a very satisfactory solution to this, but it is better than nothing. If anyone else runs across this issue in the future, good luck with finding a better solution!