Skip site navigation (1) Skip section navigation (2)

Re: OID and filesystem issues

From: lfedden(at)contextworld(dot)com
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: OID and filesystem issues
Date: 2008-04-15 15:25:22
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
Hi Tom,
Thanks for your reply.

I did mean the data/OIDs from the relfilenode column in pg_class.

Even when logged in as root, a 'ls -l' command returns:

mm2:/var/lib/pgsql82/data/base/16673 # ls -lash | more
/bin/ls: 19357877: Permission denied
/bin/ls: 19569529: Permission denied
/bin/ls: 19569531: Permission denied
/bin/ls: 19569533: Permission denied
/bin/ls: 19614956: Permission denied
/bin/ls: 19716858: Permission denied
total 124G
  68K drwx------ 2 postgres postgres   68K 2008-04-15 15:52 .
    0 drwx------ 6 postgres postgres   144 2007-06-22 17:20 ..
 7.0M -rw------- 1 postgres postgres  7.0M 2008-04-12 19:51 10163089
    0 -rw------- 1 postgres postgres     0 2007-10-24 10:45 10163091
  24K -rw------- 1 postgres postgres   24K 2008-02-28 10:19 10264430

And when I tried to change the owner or file permissions (still as root):

mm2:/var/lib/pgsql82/data/base/16673 # chown postgres.postgres 19716858
chown: cannot access `19716858': Permission denied

mm2:/var/lib/pgsql82/data/base/16673 # chmod u+rw 19716858
chmod: cannot access `19716858': Permission denied

So can we assume it is safe to remove these none accessible files and also the couple of orphaned OID files from pg_class we can still access?

Are there any known situations that could cause such issues or anyway we could track back and see how this happened? I'm keen to prevent anything like this happening again in the future.


 -----Original Message-----
From: tgl(at)sss(dot)pgh(dot)pa(dot)us
Sent: 15 April 2008 15:44
To: Lee Fedden
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] OID and filesystem issues


 --------------------------------------------------------------------------  --
lfedden(at)contextworld(dot)com writes:
> 1) Does every relation exist in pg_class? Can we assume that if there
is a file with OID which is not present in pg_class, this file can be
deleted? (we have a few such files, some of them take more than 2G of
space in total)

You do know it's relfilenode that counts, not OID?

As long as you are paying attention to the right column, yes, you could
remove any file that doesn't correspond to a live pg_class row.  It's
not a common situation though so I'd definitely triple-check first.

> 3) We have a relation which is unaccessible (permission denied), ls -l
also prints this message so it's something with filesystem. What would be 

the best procedure to solve this issue ?

Fix the ownership/permissions with chown/chmod, as needed.  Pretty much
all files in a database should be alike in this regard (postgres-owned,
mode 0600).

   regards, tom lane

 -- Sent via pgsql-admin mailing list (pgsql-admin(at)postgresql(dot)org)
To make changes to your subscription:
Lee Fedden
Software Developer
Tel:+44 (0)20 8394 7724
Fax:+44 (0)20 8394 7701
Email Address: lfedden(at)contextworld(dot)com
Web Site:
This message and the information contained therein is intended for the use
of the person(s) ("the intended  recipient(s)" to whom it is addressed. It
may contain information that is privileged and confidential within the
meaning of applicable law. If you are not the intended recipient, please
contact the sender as soon possible. The views expressed in this
communication may not necessarily  be the views held by Context Business
Limited or its subsidiaries. The contents of an attachment to this e-mail
may contain viruses that could damage your own computer system. While every
reasonable precaution has been taken to minimise this risk, Context Business
Limited and its subsidiaries cannot  accept liability for any damage which
you sustain  as a result of software viruses. You should carry out your own
virus checks
before opening the attachment. Please notice that Context Business Limited
monitors e-mails sent or received. Further communication will signify your
consent to this.

Context Business Limited, a Company registered in England under number
06298773. Registered Directors Jeremy Davies and Howard Davies.
Registered office address: 10-18 Putney Hill, London, SW15 6AA
VAT 919 7799 50


pgsql-admin by date

Next:From: Tom LaneDate: 2008-04-15 15:51:20
Subject: Re: OID and filesystem issues
Previous:From: Tom LaneDate: 2008-04-15 14:43:56
Subject: Re: OID and filesystem issues

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group