*BSD News Article 24808


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!mel.dit.csiro.au!its.csiro.au!dmssyd.syd.dms.CSIRO.AU!metro!basser.cs.su.oz.au!news.adelaide.edu.au!gateway.dircsa.org.au!apanix!apanix!not-for-mail
From: hart@apanix.apana.org.au (Leigh Hart)
Newsgroups: comp.os.386bsd.questions
Subject: Re: copying device files
Date: 9 Dec 1993 01:20:10 +1030
Organization: APANIX Public Access Unix, Australia, +61-8-373-5485 (3 lines)
Lines: 29
Message-ID: <2e4pj2$bta@olivaw.apanix.apana.org.au>
References: <2dlodo$dac@dumbo.cc.utexas.edu>
NNTP-Posting-Host: olivaw.apanix.apana.org.au

vax@dumbo.cc.utexas.edu (Vax) writes:

>I was wondering, what is the proper way to duplicate a directory (& the whole
>subtree) as a super user?

>I ask this question becuase I wish to create a "fixit" diskette from scratch,
>on a NetBSD-0.9 system.  I tried recently, but couldn't come up with a way
>to duplicate the /dev directory (besides using MAKEDEV :-)

cp -R will copy sym links as they are and also dev files I believe.  Another
way is to use tar:

# (cd /dev; tar cf -) | (cd /mnt/dev; tar xf -)

assuming your floppy is mounted on /mnt the first bracketed cd/tar command
will create a tar archive to the standard output (-), and the output
is then piped to the second bracketed cd/tar command which extracts the
tar file coming in from standard input.

This also works for sym links.

Cheers

Leigh
-- 
                                 Leigh Hart
                               C/- PO Box 758
                          North Adelaide  SA  5006
 hart@eppie.apana.org.au  hart@apanix.apana.org.au  hart@cleese.apana.org.au