[TriLUG] cp of /dev hangs, but not tar
robdale at gmail.com
Sat Jun 16 12:54:14 EDT 2007
On 6/16/07, Joseph Mack NA3T <jmack at wm7d.net> wrote:
> On Sat, 16 Jun 2007, Jon Carnes wrote:
> > Tar handles this well, as it recognizes that you are
> > simply recording the node info and there isn't really any
> > file "data".
> so tar has code for recognising special files?
> > Maybe we should re-write cp so that it understands that as
> > well?
> if that's all there is to it, then yes. Is there a reason
> you'd want your machine hang on a special file with cp?
cp is not simply hanging, it's waiting for bytes. by default cp
dereferences (looks at the data that the special file is pointed at
by) special files. this allows you to copy your harddrive to a file,
like cp /dev/sda foo. Now, if you want just the special files (and
act like tar), you can tell cp to not dereference these - the commonly
used switch is -a (archive). So now if you do cp -a /dev/sda foo, foo
will be a block node.
More information about the TriLUG