You are not logged in.

#1 2009-04-10 20:49:35

rwd
Member
Registered: 2009-02-08
Posts: 664

[solved] Will copying a running system result in inconsistent backup?

If you copy a whole file system of a running system while data is being written to it will that result in an inconsistent snapshot? By inconsistent I mean that two files, or the first last part of a file are from different points in time? Does this differ per filesystem-type or backup method?

Last edited by rwd (2009-04-12 08:45:55)

Offline

#2 2009-04-10 21:07:42

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,799
Website

Re: [solved] Will copying a running system result in inconsistent backup?

i think copying a running system is a bigger problem than that.  there's a lot of files in /dev and /proc that you really don't want to copy/paste from one running system to another.  if you want to move / do it form a live cd.  if you're scripting a backup, then just backup /etc /usr /var and /home then restore those to the new system, you won't know the difference.

Offline

#3 2009-04-10 21:22:17

rwd
Member
Registered: 2009-02-08
Posts: 664

Re: [solved] Will copying a running system result in inconsistent backup?

I remember with databases you can't generally just copy the database files of a running database and expect to restore it, /usr/ and /etc/ may contain static files, but some apps store things in sqlite databases in /home/ for example. My question was also a bit out of curiosity: do some filesystems have the ability to let you select an exact snapshot in time, just like a 'select' query in a rdms, (without having to access it from something like a livecd)?

Last edited by rwd (2009-04-10 21:23:54)

Offline

#4 2009-04-11 06:29:46

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: [solved] Will copying a running system result in inconsistent backup?

rwd wrote:

do some filesystems have the ability to let you select an exact snapshot in time, just like a 'select' query in a rdms, (without having to access it from something like a livecd)?

nilfs

by the way you can copy the filesystem while it is running no problem. of course when a program has stored an inconsistent state of a file to the disk then it's its problem, but IMHO no reasonable (for instance journaling) filesystem will serve you an inconsistent state of a file, even when written to.

of course when taking backups you shouldn't backup /proc and /sys (dynamically created by the kernel) and /dev (dynamically created by udev and some static parts by the initscripts when booting).

Offline

#5 2009-04-11 07:27:21

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: [solved] Will copying a running system result in inconsistent backup?

bender02 is right. I daily backup my running system to another partition.

I do boot from that partition mainly for testing purposes, like testing other kernels that could break my
running system.

mount /dev/sdb2 /backup
rsync -av --delete --delete-excluded --exclude="/proc/**" --exclude="/sys/**" 
                           --exclude="/dev/**" --exclude="/backup/"   /  /backup

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#6 2009-04-11 11:01:46

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [solved] Will copying a running system result in inconsistent backup?

Mektub wrote:

bender02 is right. I daily backup my running system to another partition.

I do boot from that partition mainly for testing purposes, like testing other kernels that could break my
running system.

mount /dev/sdb2 /backup
rsync -av --delete --delete-excluded --exclude="/proc/**" --exclude="/sys/**" 
                           --exclude="/dev/**" --exclude="/backup/"   /  /backup

Mektub

I am just experimenting with this sort of rsync backup. Just one thing I do not readily understand, why do you exclude contents: "/proc**", etc. Would it not be more appropriate to exclude the whole directory, using instead:

mount /dev/sdb2 /backup
rsync -av --delete --delete-excluded --exclude="/proc/" --exclude="/sys/" 
                           --exclude="/dev/" --exclude="/backup/"   /  /backup

That way it doesn't even attempt to backup any of those folders.

Last edited by bernarcher (2009-04-11 11:02:22)


To know or not to know ...
... the questions remain forever.

Offline

#7 2009-04-11 23:02:02

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: [solved] Will copying a running system result in inconsistent backup?

bernacher,

I am just experimenting with this sort of rsync backup. Just one thing I do not readily understand, why do you exclude contents: "/proc**", etc. Would it not be more appropriate to exclude the whole directory, using instead:

"/proc/**" creates the empty /proc/ in the backup, and it is needed when booting.

"/proc/' will not create the directory.

Mektub


Follow me on twitter: https://twitter.com/johnbina

Offline

#8 2009-04-12 00:21:25

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [solved] Will copying a running system result in inconsistent backup?

Mektub wrote:

"/proc/**" creates the empty /proc/ in the backup, and it is needed when booting.

"/proc/' will not create the directory.

Mektub

Ah, right! I did not think of that. Only noticed that rsync tried to copy the /proc, etc. contents as well which I definitely did not want.
Still studying man rsync. It appears somewhat overwhelming at first sight. roll

Thanks for the info. smile


To know or not to know ...
... the questions remain forever.

Offline

Board footer

Powered by FluxBB