Re: LVM snapshots

From: "Matt Clark" <matt(at)ymogen(dot)net>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: LVM snapshots
Date: 2003-03-14 16:28:26
Message-ID: OAEAKHEHCMLBLIDGAFELAEAODBAA.matt@ymogen.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

RE: [ADMIN] LVM snapshotsThat'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(at)postgresql(dot)org
[mailto:pgsql-admin-owner(at)postgresql(dot)org]On Behalf Of Trewern, Ben
Sent: 14 March 2003 16:03
To: 'David F. Skoll'; pgsql-admin(at)postgresql(dot)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(at)roaringpenguin(dot)com]
Sent: 14 March 2003 15:52
To: pgsql-admin(at)postgresql(dot)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(at)postgresql(dot)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.

****************************************************************************
*

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2003-03-14 17:17:15 Re: LVM snapshots
Previous Message Matt Clark 2003-03-14 16:05:38 Re: LVM snapshots