Thanks again Jon. To be honest, I'm going to leave the attempting 'till tomorrow, its late this side of the earth. I do see the solutions, will try them and see what works best for me. The main thing is I now know the approach isn't some thing I've been tripping over all the time, like so many other battles...no re-inventing the wheel either...whew!
Chow, Trevor. ========================= Stussy said:"Knowledge is King! ========================= ----- Original Message ----- From: "Jon LaBadie" <[EMAIL PROTECTED]> To: "Trevor Fraser" <[EMAIL PROTECTED]> Cc: "Jon LaBadie" <[EMAIL PROTECTED]> Sent: Tuesday, August 27, 2002 6:25 PM Subject: Re: Checking for missing files. > On Tue, Aug 27, 2002 at 05:30:58PM +0200, Trevor Fraser wrote: > > Hi Jon. > > > > Thanks for the reply. > > > > My objective is when someone accidentally deletes files and doesn't know > > what file they were, to compare what Amanda has on tape and what is on the > > file system to see what is different, so I don't have to manually search the > > tape and the file system to see what is missing and what to restore. > > > > Thanks, Trevor. > > Ahh, then probably the regular indexes will be sufficient. > > I presume you are "recording", then you have an "indexdir" defined. > In that indexdir will be subdirs for each host. > Under the host dir will be subdirs with names based on the disklist entries. > In these names the "/" are replaced with "_". > > My approach would be to make a list of everything the user currently has > and compare it to what the index shows is on tape. Assume the user is "shmo" > As root: > > cd ~shmo/.. # one level above shmo > find shmo > /tmp/shmo-current > # or two levels and do a find home/shmo > sort -o /tmp/shmo-current /tmp/shmo-current > > cd <amanda-index-dir-for-shmo's-filesystem> > # note all the backups since the last level 0. > # in my case that would be 20020823_0.gz > # 20020824_1.gz 20020826_1.gz 20020827_2.gz > > for f in 20020823_0.gz 20020824_1.gz 20020826_1.gz 20020827_2.gz > do > gzip -dc < $f | grep /shmo/ | sed 's,/$,,' > done | sort | uniq > /tmp/shmo-tape > > # or the command might look for /home/shmo if appropriate > # the sed is to remove any trailing "/"s on dir names that my indexes > # have, but the find does not. > > # now you may have to edit one or the other file to make the leading > # part of each line the same For example, the find may not have a "/" > # at the start or might need "/home/" added to one file or deleted > # from the other. > > Now you have two sorted lists, what is in shmo's directory tree currently > and what is on tape in at least one of the most recent backup set. > Of course the "for f in ..." loop could have been done on all index files > to go further back. > > To compare them use the comm command: > > # files on tape but not in current dir tree > comm -13 /tmp/shmo-current /tmp/shmo-tape > > # files in current dir tree, not on tape > comm -23 /tmp/shmo-current /tmp/shmo-tape > > # files in both > comm -12 /tmp/shmo-current /tmp/shmo-tape > > Another approach is to amrecover the entire /home/shmo tree in some tmp dir. > Then do a "dircmp" of shmos' current tree with the tmp tree. Then you already > have the files on disk and can simply copy them. > > Hope these make sense and help. Maybe someone else has alternative approaches. > > -- > Jon H. LaBadie [EMAIL PROTECTED] > JG Computing > 4455 Province Line Road (609) 252-0159 > Princeton, NJ 08540-4322 (609) 683-7220 (fax)