Skip to contentSkip to conversation

xfsrestore will create orphanage directory when use -t

PATCH New Tommy Wu 2 participants 7 messages Feb 14, 2012 – Feb 23, 2012

lore
Share & tools
lore

Tommy Wu

author
#0 lore raw

from the xfsdump man page:
xfsrestore also generates a directory named orphanage in the dest directory. xfsrestore removes this directory after completing a simple restore. However, if orphanage is not empty, it is not removed. This can happen if files present on the dump media are not referenced by any of the restored directories. The orphanage has an entry for each such file. The entry name is the file's original inode number, a ".", and the file's generation count modulo 4096 (only the lower 12 bits of the generation count are used).

and the -t option from xfsdump man page:
Displays the contents of the dump, but does not create or modify any files or directories. It may be desirable to set the verbosity level to silent when using this option.

But when we use -t option with xfsrestore, it still create orphanage directory in current directory (because no dest directory assign). and if it's not empty, it is not removed.

This is a bug or it's a feature?

Signature · 6 lines
Tommy Wu

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw
Quoted 15 lines · Tommy Wu

from the xfsdump man page:
xfsrestore also generates a directory named orphanage in the dest directory. xfsrestore removes this directory after completing a simple restore. However, if orphanage is not empty, it is not removed. This can happen if files present on the dump media are not referenced by any of the restored directories. The orphanage has an entry for each such file. The entry name is the file's original inode number, a ".", and the file's generation count modulo 4096 (only the lower 12 bits of the generation count are used).

and the -t option from xfsdump man page:
Displays the contents of the dump, but does not create or modify any files or directories. It may be desirable to set the verbosity level to silent when using this option.

Quoted 5 lines

But when we use -t option with xfsrestore, it still create orphanage directory in current directory (because no dest directory assign). and if it's not empty, it is not removed.

This is a bug or it's a feature?

I can see code where this would happen, except that it would appear to require both -r and -t to be used, and xfsrestore doesn't allow that.

If you send the command line you used I can take another look.

Bill

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#2 lore raw

2012/2/18 Bill Kendall <[email protected]>:

Quoted 24 lines · Tommy Wu
Quoted 16 lines

from the xfsdump man page:
xfsrestore also generates a directory named orphanage in the dest directory. xfsrestore removes this directory after completing a simple restore. However, if orphanage is not empty, it is not removed. This can happen if files present on the dump media are not referenced by any of the restored directories. The orphanage has an entry for each such file. The entry name is the file's original inode number, a ".", and the file's generation count modulo 4096 (only the lower 12 bits of the generation count are used).

and the -t option from xfsdump man page:
Displays the contents of the dump, but does not create or modify any files or directories. It may be desirable to set the verbosity level to silent when using this option.

Quoted 5 lines

But when we use -t option with xfsrestore, it still create orphanage directory in current directory (because no dest directory assign). and if it's not empty, it is not removed.

This is a bug or it's a feature?

Quoted 7 lines

I can see code where this would happen, except that it would appear to require both -r and -t to be used, and xfsrestore doesn't allow that.

If you send the command line you used I can take another look.

Bill

here is the command I used for -t:
cat var.xfsdump.gz | gzip -dqv | xfsrestore -v silent -p 300 -J -t - | grep "^xfsrestore:"

I also test it with only -t option, it also create orphanage folder for such dump file (not all dump file has this issue)
cat var.xfsdump.gz | gzip -dqv | xfsrestore -t - | grep "^xfsrestore:"

Signature · 6 lines
Tommy Wu

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#3 lore raw

2012/2/18 Tommy Wu <[email protected]>:

Quoted 37 lines

2012/2/18 Bill Kendall <[email protected]>:

Quoted 24 lines · Tommy Wu
Quoted 16 lines

from the xfsdump man page:
xfsrestore also generates a directory named orphanage in the dest directory. xfsrestore removes this directory after completing a simple restore. However, if orphanage is not empty, it is not removed. This can happen if files present on the dump media are not referenced by any of the restored directories. The orphanage has an entry for each such file. The entry name is the file's original inode number, a ".", and the file's generation count modulo 4096 (only the lower 12 bits of the generation count are used).

and the -t option from xfsdump man page:
Displays the contents of the dump, but does not create or modify any files or directories. It may be desirable to set the verbosity level to silent when using this option.

Quoted 5 lines

But when we use -t option with xfsrestore, it still create orphanage directory in current directory (because no dest directory assign). and if it's not empty, it is not removed.

This is a bug or it's a feature?

Quoted 7 lines

I can see code where this would happen, except that it would appear to require both -r and -t to be used, and xfsrestore doesn't allow that.

If you send the command line you used I can take another look.

Bill

here is the command I used for -t:
cat var.xfsdump.gz | gzip -dqv | xfsrestore -v silent -p 300 -J -t - | grep "^xfsrestore:"

Quoted 8 lines

I also test it with only -t option, it also create orphanage folder for such dump file (not all dump file has this issue)
cat var.xfsdump.gz | gzip -dqv | xfsrestore -t - | grep "^xfsrestore:"

--

Tommy Wu

I use xfsdump 3.0.6 plus following 2 patch:
[PATCH] xfsdump: allow system() to obtain exit status [PATCH] xfsdump: handle files with no extent headers

Signature · 6 lines
Tommy Wu

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#4 lore raw
In reply to Tommy Wu
Quoted 33 lines · Tommy Wu

2012/2/18 Bill Kendall<[email protected]>:

Quoted 24 lines · Tommy Wu
Quoted 16 lines

from the xfsdump man page:
xfsrestore also generates a directory named orphanage in the dest directory. xfsrestore removes this directory after completing a simple restore. However, if orphanage is not empty, it is not removed. This can happen if files present on the dump media are not referenced by any of the restored directories. The orphanage has an entry for each such file. The entry name is the file's original inode number, a ".", and the file's generation count modulo 4096 (only the lower 12 bits of the generation count are used).

and the -t option from xfsdump man page:
Displays the contents of the dump, but does not create or modify any files or directories. It may be desirable to set the verbosity level to silent when using this option.

Quoted 5 lines

But when we use -t option with xfsrestore, it still create orphanage directory in current directory (because no dest directory assign). and if it's not empty, it is not removed.

This is a bug or it's a feature?

Quoted 7 lines

I can see code where this would happen, except that it would appear to require both -r and -t to be used, and xfsrestore doesn't allow that.

If you send the command line you used I can take another look.

Bill

Quoted 7 lines

here is the command I used for -t:
cat var.xfsdump.gz | gzip -dqv | xfsrestore -v silent -p 300 -J -t - | grep "^xfsrestore:"

I also test it with only -t option, it also create orphanage folder for such dump file (not all dump file has this issue)
cat var.xfsdump.gz | gzip -dqv | xfsrestore -t - | grep "^xfsrestore:"

I found an issue which is likely the same as what you're seeing. I'll post a patch shortly, please let me know whether or not it fixes the problem.

Thanks,
Bill

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#5 lore raw

2012/2/23 Bill Kendall <[email protected]>:

Quoted 48 lines · Tommy Wu
Quoted 38 lines

2012/2/18 Bill Kendall<[email protected]>:

Quoted 27 lines · Tommy Wu
Quoted 17 lines

from the xfsdump man page:
xfsrestore also generates a directory named orphanage in the dest directory. xfsrestore removes this directory after completing a simple restore. However, if orphanage is not empty, it is not removed. This can happen if files present on the dump media are not referenced by any of the restored directories. The orphanage has an entry for each such file. The entry name is the file's original inode number, a ".", and the file's generation count modulo 4096 (only the lower 12 bits of the generation count are used).

and the -t option from xfsdump man page:
Displays the contents of the dump, but does not create or modify any files or directories. It may be desirable to set the verbosity level to silent when using this option.

Quoted 5 lines

But when we use -t option with xfsrestore, it still create orphanage directory in current directory (because no dest directory assign). and if it's not empty, it is not removed.

This is a bug or it's a feature?

Quoted 7 lines

I can see code where this would happen, except that it would appear to require both -r and -t to be used, and xfsrestore doesn't allow that.

If you send the command line you used I can take another look.

Bill

Quoted 7 lines

here is the command I used for -t:
cat var.xfsdump.gz | gzip -dqv | xfsrestore -v silent -p 300 -J -t - | grep "^xfsrestore:"

I also test it with only -t option, it also create orphanage folder for such dump file (not all dump file has this issue)
cat var.xfsdump.gz | gzip -dqv | xfsrestore -t - | grep "^xfsrestore:"

Quoted 6 lines

I found an issue which is likely the same as what you're seeing. I'll post a patch shortly, please let me know whether or not it fixes the problem.

Thanks,
Bill

yes, after apply the patch, no such directory generated during xfsdump -t. thanks.

Signature · 6 lines
Tommy Wu

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#6 lore raw

PATCH 1/1 xfsdump: dirs being created in list-only restore

In reply to Tommy Wu

When xfsrestore is run with the -t option, it lists the files contained in the dump but does not restore anything. This patch fixes code that creates an orphaned file's parent directories without checking to see if this is a list-only (table-of-contents) restore.

---
 restore/tree.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
restore/tree.c +9 -5
index 05e0628..a61fd16 100644
@@ -1867,12 +1867,16 @@ tree_cb_links( xfs_ino_t ino,
 					return RV_NOTOK;
 				}
 			} else {
-				char *dir;
-				char tmp[PATH_MAX];
 
-				strcpy(tmp, path);
-				dir = dirname(tmp);
-				mkdir_r(dir);
+				if ( ! tranp->t_toconlypr ) {
+					char *dir;
+					char tmp[PATH_MAX];
+
+					strcpy(tmp, path);
+					dir = dirname(tmp);
+					mkdir_r(dir);
+				}
+
 				mlog (MLOG_VERBOSE | MLOG_NOTE | MLOG_TREE, _(
 				      "ino %llu salvaging file,"
 				      " placing in %s\n"), ino, path1);
Signature · 6 lines
1.7.0.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs