Running out of Disk Space
Running out of Disk Space
От:
John Taylor <postgres@jtresponse.co.uk>
Дата:
I'm running PostgreSQL 7.1. A few times now I have run out of disk space on the drive containing the postgresql data. In all cases, this has corrupted the database, the postmaster has died, and refuses to start again unless I rebuild from scratch. As my app is under development at the moment, this isn't a big disaster, but I'm worrying about what will happen when I go live. The situation isn't helped by the postgres home directory being on /var, which could easily run out of space for a number of reasons. (or is putting it in /var a Mandrake thing ? ) Obviously the solution is to put postgre on a disk with enough space, but I can see the App sitting on the web server for a number of years until everyone forgets to check disk space - then BANG! My question is: Is it normal for postgres to get corrupted due to lack of disk space ? Surely it should be able to handle this. The problems have all occurred while processing a large transaction - could that be the cause ? Thanks JohnT
Re: Running out of Disk Space
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
John Taylor writes: > I'm running PostgreSQL 7.1. > A few times now I have run out of disk space on the drive containing the postgresql data. > In all cases, this has corrupted the database, the postmaster has died, and refuses to start again > unless I rebuild from scratch. This seems unlikely. You might need to *free up* some space before the postmaster will start. (Typically you'd need to free 16MB to allow creation of one new WAL segment, if the postmaster is refusing to start because it can't make a WAL entry.) I am not aware of any scenarios where running out of disk space would cause actual data corruption. If you're really on original 7.1, it might help to update to 7.1.3 (or better, 7.2.1). 7.1.3 and later tend to recycle WAL space more effectively than 7.1 did, making out-of-disk-space less likely; and in particular making it much less likely that you'll get the panic-stop scenario. Running out of ordinary table space doesn't induce a panic shutdown, the way running out of WAL space does. Another thing that can help is to put the WAL logs on a different partition than the tables. If you've got multiple physical disk drives, keeping WAL on a physically distinct drive is the ideal setup from both performance and reliability standpoints. But even keeping it on a separate partition on the same drive will make out-of-disk-space problems less painful. regards, tom lane