backup and restore: what about device files?

der Mouse mouse at thunder.mcrcim.mcgill.edu
Sun Jun 2 07:39:27 AEST 1991


In article <1991May16.233149.15268 at athena.mit.edu>, mlevin at jade.tufts.edu writes:

> I would appreciate some advice about the following.  When you use a
> backup and restore utility on a Unix system, does it backup and
> restore device files?

That depends on the utility.  BSD dump, for example, does; tar does not
(in any incarnation I am aware of, at least).  Depending on what you
are trying to do, sometimes one behavior is appropriate, sometimes the
other.

> If so, any ideas on how?  Is the info given by stat() enough to
> recreate the device file (using makenod() or something) for a
> restore?

Yes.

> Any information on getting the attributes of and then re-creating
> device files would be reatly appreciated.

stat(2) (and lstat(2), if you have it) on a device file will return the
device major/minor numbers in the st_rdev element; to recreate it you
hand the device number to mknod(2).

					der Mouse

			old: mcgill-vision!mouse
			new: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.unix.programmer mailing list