xfs
[Top] [All Lists]

Re: xfsdump/xfsrestore trash hardlinks

To: Linux XFS Mailing List <linux-xfs@xxxxxxxxxxx>
Subject: Re: xfsdump/xfsrestore trash hardlinks
From: "Bernhard R. Erdmann" <be@xxxxxxxxxxx>
Date: Sat, 10 Nov 2001 13:11:26 +0100
References: <3BEC19A2.A59C9659@xxxxxxxxxxx>
Sender: owner-linux-xfs@xxxxxxxxxxx
Hi,

I've some more tests to verify xfsrestore trashing hard links.

A filesystem mounted on /usr was xfsdumped up to level 2:

$ amadmin be info ente /usr

Current info for ente /usr:
  Stats: dump rates (kps), Full:  2724.0, 1300.0, 2625.0
                    Incremental:  1177.0,   3.0,   1.0
          compressed size, Full:  34.0%, 34.0%, 34.5%
                    Incremental:  18.6%, 18.7%, 18.7%
  Dumps: lev datestmp  tape             file   origK   compK secs
          0  20011104  BE04               26 2206768 2206784  810
          1  20011107  BE07               32  210488  210496 1387
          2  20011110  BE10               30  247297  247328  210

These dump images were restored to /scratch/usr in cumulative mode :

# mkdir /scratch/usr
# cd /scratch/usr
# amrestore -p $TAPE |xfsrestore -r -v 3 - . > ../debug.0
# amrestore -p $TAPE |xfsrestore -r -v 4 - . > ../debug.1
# amrestore -p $TAPE |xfsrestore -r -v 4 - . > ../debug.2

Again, one link of emacs is gone:

# ll /usr/bin/emacs /scratch/usr/bin/emacs 
-rwxr-xr-x   1 root     root      4001044 Jun 13  2000
/scratch/usr/bin/emacs
-rwxr-xr-x   2 root     root      4001044 Jun 13  2000 /usr/bin/emacs

I used find to get files with a link counter > 1 (hard links) on the
original filesystem and on the restored filesystem:

# cd /usr
# find . -type f -links +1 >  /scratch/_usr.hardlinks
# cd /scratch/usr
# find . -type f -links +1 >  /scratch/_usr_restored.hardlinks

# ll /scratch/_usr*
-rw-r--r--   1 root     root        77628 Nov 10 11:27
/scratch/_usr.hardlinks
-rw-r--r--   1 root     root        77628 Nov 10 11:30
/scratch/_usr.hardlinks.sorted
-rw-r--r--   1 root     root        59959 Nov 10 11:28
/scratch/_usr_restored.hardlinks
-rw-r--r--   1 root     root        59959 Nov 10 11:30
/scratch/_usr_restored.hardlinks.sorted

# diff -u _usr.hardlinks.sorted _usr_restored.hardlinks.sorted
--- _usr.hardlinks.sorted       Sat Nov 10 11:30:05 2001
+++ _usr_restored.hardlinks.sorted      Sat Nov 10 11:30:14 2001
@@ -1,35 +1,3 @@
-./X11R6/bin/nxterm
-./X11R6/bin/xterm
-./bin/c++
-./bin/c++decl
-./bin/c2ph
-./bin/cdecl
-./bin/egcs
-./bin/emacs
-./bin/emacs-20.7
-./bin/flist
-./bin/flists
-./bin/folder
-./bin/folders
-./bin/g++
-./bin/gcc
-./bin/gitregrep
-./bin/gitrfgrep
-./bin/gitrgrep
-./bin/i386-glibc20-linux-c++
-./bin/i386-glibc20-linux-g++
-./bin/i386-redhat-linux-gcc
-./bin/next
-./bin/perl
-./bin/perl5.00503
-./bin/prev
-./bin/pstruct
-./bin/python
-./bin/python1.5
-./bin/rb
-./bin/rx
-./bin/rz
-./bin/sb
 ./bin/sgml2html
 ./bin/sgml2info
 ./bin/sgml2latex
@@ -38,18 +6,6 @@
 ./bin/sgml2txt
[...lots of lines following...]

# diff -u _usr.hardlinks.sorted _usr_restored.hardlinks.sorted | wc -l
    687

Maybe XFS developers don't like people using emacs and perl? ;-)

But what's the difference between /usr/bin/emacs (one of two links is
deleted) and /usr/bin/sgml2html (which is restored correctly)?

# ll /usr/bin/sgml2html /scratch/usr/bin/sgml2html 
-rwxr-xr-x   8 root     root          790 Mar  9  2001
/scratch/usr/bin/sgml2html
-rwxr-xr-x   8 root     root          790 Mar  9  2001
/usr/bin/sgml2html

Let's have a quick check about the link counter distribution in the two
filesystems:

# for i in 1 2 3 4 5 6 7 8 9; do
> echo -n "files with link counter = $i : "
> find /usr -type f -links $i | wc -l
> done
files with link counter = 1 :   90355
files with link counter = 2 :    1208
files with link counter = 3 :     627
files with link counter = 4 :     268
files with link counter = 5 :     215
files with link counter = 6 :      48
files with link counter = 7 :      70
files with link counter = 8 :      56
files with link counter = 9 :      27

# for i in 1 2 3 4 5 6 7 8 9; do
> echo -n "files with link counter = $i : "
> find /scratch/usr -type f -links $i | wc -l
> done
files with link counter = 1 :   90535
files with link counter = 2 :    1076
files with link counter = 3 :     489
files with link counter = 4 :     212
files with link counter = 5 :     135
files with link counter = 6 :      36
files with link counter = 7 :      21
files with link counter = 8 :      32
files with link counter = 9 :       0

Some activity was done on /usr this morning, so let's xfsdump in level 3
on the fly (-J) not to interfere with Amanda:

# /sbin/xfsdump -J -l 3 - /usr > /dumps/_usr.3.xfsd
# cd /scratch/usr
# /sbin/xfsrestore -r -v 4 - . < /dumps/_usr.3.xfsd > ../debug.3

# for i in 1 2 3 4 5 6 7 8 9; do
> echo -n "files with link counter = $i : "
> find /scratch/usr -type f -links $i | wc -l
> done
files with link counter = 1 :   90504
files with link counter = 2 :    1106
files with link counter = 3 :     513
files with link counter = 4 :     216
files with link counter = 5 :     135
files with link counter = 6 :      36
files with link counter = 7 :      21
files with link counter = 8 :      24
files with link counter = 9 :       0


<Prev in Thread] Current Thread [Next in Thread>