initdb and data directories with lost+found

From: Steve Stock <steve(at)technolope(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: initdb and data directories with lost+found
Date: 2001-03-22 16:41:05
Message-ID: 20010322114105.A501@logjam.technolope.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Looks like initdb is just a tad too strict when checking to make sure
the data directory is empty. Yesterday I created a new data directory
as it's own filesystem (linux ext2), it includes a lost+found directory.
To initdb this means that the directory is no longer empty and it refuses
to run. While I hope to never need lost+found, e2fsck will recreate it
if it is missing (it is safer to create it when the filesystem is stable).

My quick fix to allow the lost+found directory:
--- src/bin/initdb/initdb.sh 2001/03/13 21:37:15 1.122
+++ src/bin/initdb/initdb.sh 2001/03/22 15:45:46
@@ -402,7 +402,7 @@

# find out if directory is empty
pgdata_contents=`ls -A "$PGDATA" 2>/dev/null`
-if [ x"$pgdata_contents" != x ]
+if [ x"$pgdata_contents" != x -a "$pgdata_contents" != "lost+found" ]
then
(
echo "$CMDNAME: The directory $PGDATA exists but is not empty."

This fix works for ext2, but will (obviously) not work if the filesystem
uses something other than "lost+found".

Steve Stock
steve(at)technolope(dot)org

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2001-03-22 16:43:00 Re: odbc/UnixWare 7.1.1: No Go.
Previous Message Peter Eisentraut 2001-03-22 16:40:00 Re: RELEASE STOPPER? nonportable int64 constants in pg_crc.c