Subject: restore and schg flag
To: None <>
From: Manuel Bouyer <>
List: tech-userlevel
Date: 10/11/2004 22:33:52
Hi (again),
so there is a problem with restore and the schg, uchg, sappnd and uappnd flags.
When one of these are set on a file, creating new hard link to this file
is not possible any more. Restore will delay setting the flags on directories,
but not on files, so it won't be able to create any hard links to files
which had one of these flags on the original filesystem.

Investigating this, I found that this is also a problem with multilevel
dumps. restore will set the flags on directories after extracting each
volume, and on directories which have been protected with *chg, it won't
be able to create the files from the next volumes.

So to handle this case properly, we'd need to keep the list of flags up to
the last volume, and set the flags only after the last volume has been
extracted. There's no easy way to do this because restore don't know
when the last volume has been extracted or not.

My idea for this is to defer this work to mtree. I'll add a -M<file> flag to
restore, which, when set, will cause restore to not set the file flags
(either for files or directory), but instead write (append, so that we can
have in a single file the output of a multilevel restore) a mtree file in the
format of /etc/mtree/*. Then the user can run mtree against this file
to restore the flags. I can't think of a better way to handle all the
corner cases *chg or *appnd can create for restore.

Comments ?

Manuel Bouyer <>
     NetBSD: 26 ans d'experience feront toujours la difference