Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I backed up my Ubuntu 14.04 system using rsync to a USB stick, but apparently it wasn't formatted for booting. The original disk has been erased and I put a fresh install of Ubuntu on it. In migrating my data I forgot to dump one of my postgres databases to SQL, and I need to migrate it to my new install of Ubuntu.

I'm considering formatting a bootable disk and then attempting to rsync my old system to that for disk so I can boot and dump my database to SQL. But that's a discussion for a different forum.

I'm wondering if it's possible to use the data files from my old system to restore my database (i.e. copy /var/lib/postgresql/9.3/main) from my old install to my new install? Has anyone ever done this? I did try just copying the data file but it caused Postgres to break beyond repair. I had to delete it entirely and reinstall.

I know it's possible with MySQL, but I'm less familiar with Postgres.

Thanks!

share|improve this question
1  
You can copy the whole data directory and it'll work fine. In Ubuntu you must also copy postgresql.conf and pg_hba.conf from /etc/postgresql, since they're stored outside the PostgreSQL data directory. Please be more specific about "break beyond repair". –  Craig Ringer Jan 7 at 0:36

1 Answer 1

Rsync is a supported backup method for postgresql. However it has some caveats that you need to be aware of. Namely the database should be offline when the sync is done.

So if your database was offline when you synced, you could restore it jsut fine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.