Re: LVM snapshots - Mailing list pgsql-admin

From Matt Clark
Subject Re: LVM snapshots
Date
Msg-id OAEAKHEHCMLBLIDGAFELAEAODBAA.matt@ymogen.net
Whole thread Raw
In response to Re: LVM snapshots  ("Trewern, Ben" <Ben.Trewern@mowlem.com>)
List pgsql-admin
That's what I thought.  The docs are a bit coy on this point.  Section 9.2 says "The database server must be shut down in order to get a usable backup. Half-way measures such as disallowing all connections will not work as there is always some buffering going on. For this reason it is also not advisable to trust file systems that claim to support "consistent snapshots".
 
But LVM calls fsync_dev_lockfs() before the snapshot is taken, and unlockfs() afterwards, so there are guaranteed to be no dirty buffers lying around - the tradeoff is that calls to write() will block until all the buffers are written to disk and the snapshot set up, but that shouldn't take long.
 
BTW I see I was wrong in my original question about tar &c being unsuitable, I don't know where I got that idea from, so taking a snapshot every 10 mins and doing an rsync should be pretty cheap in terms of write IO, though it will increase the CPU demands above those for a simple copy, and doesn't save anything on read IO.
 
Is there some other interpretation of Section 9.2 of the docs that means the reasoning on fsync_dev_lockfs above is wrong or inadequate?
 
 
-----Original Message-----
From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Trewern, Ben
Sent: 14 March 2003 16:03
To: 'David F. Skoll'; pgsql-admin@postgresql.org
Subject: Re: [ADMIN] LVM snapshots

I don't see why not.  What happens if your server crashes?  Hopefully what's on the disk is consistent (one of the good reasons to use Postgresql).

BTW I've heard of someone else doing something like this and using rsync.  He was running it just before the snapshot and then again against the snapshot.  This should then reduce the amount of time the actual snapshot needs to be kept.

Regards,

Ben

-----Original Message-----
From: David F. Skoll [mailto:dfs@roaringpenguin.com]
Sent: 14 March 2003 15:52
To: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] LVM snapshots

On Fri, 14 Mar 2003, Matt Clark wrote:

> Has anyone tried taking an LVM snapshot of a running DB?

I don't think there's a guarantee that a snapshot of the file system
corresponds to a consistent database, even if the snapshot corresponds
to a single point-in-time.

--
David.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

*****************************************************************************
This email and any attachments transmitted with it are confidential
and intended solely for the use of the individual or entity to whom
they are addressed. If you have received this email in error please
notify the sender and do not store, copy or disclose the content
to any other person.

It is the responsibility of the recipient to ensure that opening this
message and/or any of its attachments will not adversely affect
its systems. No responsibility is accepted by the Company.
*****************************************************************************

pgsql-admin by date:

Previous
From: "Trewern, Ben"
Date:
Subject: Re: LVM snapshots
Next
From: "Matt Clark"
Date:
Subject: Re: LVM snapshots