Re: unable to find data folder postgres9.4

From: Kris Deugau <kdeugau(at)vianet(dot)ca>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: unable to find data folder postgres9.4
Date: 2017-03-23 18:30:02
Message-ID: 6b96a059-d2c1-7391-1fe2-b0b5e1b7b1bf@vianet.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

John Scalia wrote:
> At a
> minimum, every mounted filesystem contains a directory in it called
> "lost+found", so if you don't see that, it may not be a proper
> filesystem, or the mount is broken. Without knowing what you're using
> for the disks, or the O/S, it's hard for me to guess what you really
> should have or if it's broken.

Bind mounts are closer to "hard link across filesystems". The mounted
directory may or may not actually be at the root of the physical
filesystem it lives on.

So, for instance, if I have /dev/bigdisk mounted to /mnt/bigdisk, I can
then bind mount /mnt/bigdisk/kdeugau-media to /home/kdeugau/media, and I
will not see a lost+found in /home/kdeugau/media.

Personally, the main use case I've found for bind mounts is to fool
programs that refuse to follow symlinks into effectively doing so anyway.

srilinux wrote:
> All Thank you very much for providing your inputs
>
> Now after reboot I can see the pgsql data
>
> I am trying to bind mount to new storage allocated
>
> when I do so it is empty again
>
> any suggestions ?
>
> echo "/ProdD/NusAp1/pgsql /var/lib/pgsql bind bind 0 0" >> /etc/fstab
>
> mount --bind /ProdD/NusAp1/pgsql /var/lib/pgsql
>
> cd /ProdD/NusAp1/pgsql is empty and /var/lib/pgsql is also empty

This reads to me like you've been using whatever filesystem
/var/lib/pgsql is on, and now you need to expand, but you've just gone
and mounted the new filesystem space over top of /var/lib/pgsql without
copying the files into the new space.

In this respect, a bind mount acts just like any other filesystem mount,
and not a symlink or hard link. You need to copy or move the files from
the target (eg, /var/lib/pgsql) into the new location before mounting
the new filesystem to the old location. Otherwise you end up with both
locations (apparently) empty. Your files are still safe on the old
filesystem, but you won't be able to access them.

Make sure to stop Postgres before copying the files, and I'd suggest
copying instead of moving to make sure things work before arranging to
actually delete the originals.

-kgd

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message srilinux 2017-03-23 19:26:04 Re: unable to find data folder postgres9.4
Previous Message John Scalia 2017-03-23 18:05:54 Re: [ADMIN] Replication mode Master-Slave - maintenance question.