Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!davy From: davy@pur-ee.UUCP Newsgroups: comp.unix.wizards Subject: Re: Backups on Live Systems Message-ID: <6279@pur-ee.UUCP> Date: Tue, 2-Jun-87 13:59:56 EDT Article-I.D.: pur-ee.6279 Posted: Tue Jun 2 13:59:56 1987 Date-Received: Thu, 4-Jun-87 06:31:22 EDT References: <132@dvm.UUCP> <725@aramis.rutgers.edu> <20070@sun.uucp> Reply-To: davy@pur-ee.UUCP (Dave Curry) Organization: Purdue University Engineering Computer Network Lines: 181 In article <20070@sun.uucp> shannon@sun.UUCP writes: >I'm curious, does anyone have any really good ideas about how to >do reliable backups on active filesystems? Would such backups, >by necessity, have to be done through the filesystem, rather than >through the raw device as dump does? Doing it through the file system wouldn't gain you anything (except a big drop in speed). The problem with dumps on live file systems is that dump makes more than one pass over the data. The first pass, it maps regular files; the second pass, it maps directories, the third pass it dumps directories, the fourth pass it dumps files. Information can change between the passes. Going through the file system would not alleviate this. >Also, what would you *expect* from a full dump taken on an active >filesystem? If you had to restore that dump, what state of the >filesystem would you expect to restore? For things like files getting deleted, created, what have you, you don't have too much difficulty. Files which get created are ignored by dump; files which get deleted cause restore to get slightly upset (you get "resyncing restore" messages). The *big* problem is when you get an inode which used to be a file and is now a directory, or vice-versa. Things then start to get really ugly, and restore can't always deal with it properly. Several months ago (last time this was discussed), I mentioned that I had mods for 4.3BSD dump to allow you to dump live file systems. I got a lot of requests, so I am posting them here. Basically, these mods tell dump to ignore any inode which has changed since the dump started. This has the minor disadvantage that some files (those being modified) will be missing from the dump (you occassionally see "resync restore" messages); but it has the major advantage of not having to shut the machine down to single user each time you want to do a dump. We have been running this code for nearly two years on our Vaxes (4.3BSD) and Goulds (UTX/32); and I have been running it for about 3 months on our Sun systems (SunOS 3.3). We have never had any problems with it. We do partials daily between midnight and 2am on the Vaxes, 4 to 6am on the Goulds, and 8 to 9am on the Suns. We do full dumps from 10am to about 3pm on the Vaxes, Goulds, and Suns. Sometimes there are upwards of 50 people logged in during the dump, with no ill effects (except they find the machine a little slow...). These diffs are for 4.3BSD dump. Applying them to 4.2BSD dump, Sun dump, etc. should be trivial (I know I didn't have any difficulty...). --Dave Curry Purdue University Engineering Computer Network --------------------- dumpmain.c --------------------- *** /tmp/,RCSt1016632 Tue Jun 2 12:41:48 1987 --- /tmp/,RCSt2016632 Tue Jun 2 12:41:49 1987 *************** *** 10,15 #include "dump.h" int notify = 0; /* notify operator flag */ int blockswritten = 0; /* number of blocks written on current tape */ int tapeno = 0; /* current tape number */ --- 10,18 ----- #include "dump.h" + #ifdef PURDUE_ECN + int filepass; + #endif int notify = 0; /* notify operator flag */ int blockswritten = 0; /* number of blocks written on current tape */ int tapeno = 0; /* current tape number */ *************** *** 287,292 pass(dirdump, dirmap); msg("dumping (Pass IV) [regular files]\n"); pass(dump, nodmap); spcl.c_type = TS_END; --- 290,298 ----- pass(dirdump, dirmap); msg("dumping (Pass IV) [regular files]\n"); + #ifdef PURDUE_ECN + filepass = 1; + #endif pass(dump, nodmap); #ifdef PURDUE_ECN filepass = 0; *************** *** 288,293 msg("dumping (Pass IV) [regular files]\n"); pass(dump, nodmap); spcl.c_type = TS_END; #ifndef RDUMP --- 294,302 ----- filepass = 1; #endif pass(dump, nodmap); + #ifdef PURDUE_ECN + filepass = 0; + #endif spcl.c_type = TS_END; #ifndef RDUMP --------------------- dumptraverse.c --------------------- *** /tmp/,RCSt1016661 Tue Jun 2 12:43:06 1987 --- /tmp/,RCSt2016661 Tue Jun 2 12:43:08 1987 *************** *** 7,12 #ifndef lint static char sccsid[] = "@(#)dumptraverse.c 5.3 (Berkeley) 1/9/86"; #endif not lint #include "dump.h" --- 7,15 ----- #ifndef lint static char sccsid[] = "@(#)dumptraverse.c 5.3 (Berkeley) 1/9/86"; #endif not lint + #ifdef PURDUE_ECN + extern int filepass; + #endif #include "dump.h" *************** *** 45,50 BIS(ino, dirmap); if ((ip->di_mtime >= spcl.c_ddate || ip->di_ctime >= spcl.c_ddate) && !BIT(ino, nodmap)) { BIS(ino, nodmap); if (f != IFREG && f != IFDIR && f != IFLNK) { esize += 1; --- 48,60 ----- BIS(ino, dirmap); if ((ip->di_mtime >= spcl.c_ddate || ip->di_ctime >= spcl.c_ddate) && !BIT(ino, nodmap)) { + #ifdef PURDUE_ECN + if (ip->di_mtime >= spcl.c_date || ip->di_ctime >= spcl.c_date){ + if (f != IFDIR) + return; + } + #endif BIS(ino, nodmap); if (f != IFREG && f != IFDIR && f != IFLNK) { esize += 1; *************** *** 138,143 i = ip->di_mode & IFMT; if (i == 0) /* free inode */ return; if ((i != IFDIR && i != IFREG && i != IFLNK) || ip->di_size == 0) { spclrec(); return; --- 148,160 ----- i = ip->di_mode & IFMT; if (i == 0) /* free inode */ return; + #ifdef PURDUE_ECN + if (ip->di_mtime >= spcl.c_date || ip->di_ctime >= spcl.c_date) { + if (filepass) + return; + } + #endif if ((i != IFDIR && i != IFREG && i != IFLNK) || ip->di_size == 0) { spclrec(); return;