When an ext2, ext3, or ext4 filesystem is mounted directly on the PGDATA directory, initdb will refuse to run because it sees the lost+found directory that mke2fs created and assumes the PGDATA directory is already in use for something other than PostgreSQL. Attached is a patch against master which will cause a directory that contains only lost+found to still be treated as empty.
This was previously proposed in 2001; see http://archives.postgresql.org/pgsql-hackers/2001-03/msg01194.php -- Brian Pitts Systems Administrator | EuPathDB Bioinformatics Resource Center 706-542-1447 | b...@uga.edu | http://eupathdb.org
>From be6eaa9474b267e669fe67a70140d46f69379968 Mon Sep 17 00:00:00 2001 From: Brian Pitts <br...@polibyte.com> Date: Tue, 9 Aug 2011 14:12:50 -0400 Subject: [PATCH] Ignore lost+found when checking if a directory is empty --- src/port/pgcheckdir.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/port/pgcheckdir.c b/src/port/pgcheckdir.c new file mode 100644 index 9453bcb..01f0a2c *** a/src/port/pgcheckdir.c --- b/src/port/pgcheckdir.c *************** pg_check_dir(const char *dir) *** 42,50 **** while ((file = readdir(chkdir)) != NULL) { if (strcmp(".", file->d_name) == 0 || ! strcmp("..", file->d_name) == 0) { ! /* skip this and parent directory */ continue; } else --- 42,51 ---- while ((file = readdir(chkdir)) != NULL) { if (strcmp(".", file->d_name) == 0 || ! strcmp("..", file->d_name) == 0 || ! strcmp("lost+found", file->d_name) == 0) { ! /* skip this, parent, and e2fsck directories */ continue; } else -- 1.7.4.1
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers