Technical article 127131

I need to compare the contents of my tape with the actual listing of my folders. Is there an easy way to do this?

OpenServer 6.0.0OpenServer 5.0.0OpenServer 5.0.2OpenServer 5.0.4OpenServer 5.0.5OpenServer 5.0.6OpenServer 5.0.7UnixWare 7.0.0UnixWare 7.0.1UnixWare 7.1.0UnixWare 7.1.1UnixWare 7.1.3UnixWare 7.1.4Open UNIX 8

Written · Last revised

Problem

I need to compare the contents of my tape with the actual
listing of my folders.  Is there an easy way to do this?

I use a 'find' and 'cpio' command to backup my data, similar to:

TA#116623, "Where can I find a simple backup script to backup my server onto a tape on a nightly basis?"

Solution

By default the output of "cpio -itvc -I<backup media>" will result in an output similar to:

drwxr-xr-x   2 root     sys      0       Jun 10 13:58 2008, test
-rwx------   1 root     sys      73      Jun 10 12:11 2008, test/testit
-rw-r--r--   1 root     sys      0       Jun 10 11:41 2008, test/0
-rw-r--r--   1 root     sys      0       Jun 10 11:41 2008, test/1
-rw-r--r--   1 root     sys      0       Jun 10 11:41 2008, test/2
-rw-r--r--   1 root     sys      0       Jun 10 11:41 2008, test/3
-rw-r--r--   1 root     sys      0       Jun 10 11:41 2008, test/4
-rw-r--r--   1 root     sys      0       Jun 10 11:41 2008, test/5

and a 'find' will result in output similar to:

./test
./test/testit
./test/0
./test/1
./test/2
./test/3
./test/4
./test/5
So performing a 'diff' will be difficult, so in order to
make the outputs match use the following syntax:
# cpio -itVc -Itest.cpio > mycpio.txt

Will result in an output similar to:

test
test/testit
test/0
test/1
test/2
test/3
test/4
test/5

Next run a matching find command, for example:

cd /local ; find . -print > /tmp/find.txt

Will result in an output similar to:

./test
./test/testit
./test/0
./test/1
./test/2
./test/3
./test/4
./test/5

To remove the ./ at the front of the command, run:

# sed -e 's/^.\///' find.txt > myfind.txt

Will result in an output similar to:

test
test/testit
test/0
test/1
test/2
test/3
test/4
test/5
Now:
# ls -al my*.txt
-rw-r--r--    1 root     sys          954827 Oct 15 18:01 mycpio.txt
-rw-r--r--    1 root     sys          954827 Oct 15 18:00 myfind.txt
Next run, the 'diff' command:
# diff mycpio.txt myfind.txt

and, this will display the differences between your cpio archive and server files.

From the Xinuos technical article database, record 127131. Reproduced with permission. The original is at www.sco.com/ta/127131, which is reachable but blocked from search engines.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.