[TriLUG] cp of /dev hangs, but not tar

Joseph Mack NA3T jmack at wm7d.net
Sat Jun 16 13:40:42 EDT 2007


On Sat, 16 Jun 2007, Robert Dale wrote:

> cp is not simply hanging, it's waiting for bytes.

shoulda known :-(

This bit me somewhere else recently - I was dd'ing from a 
disk with a bad sector (which I didn't know about), and I 
thought the dd had hung. It wasn't till I looked at the 
console and saw all the errors that I dropped to what was 
going on.

> by default cp dereferences (looks at the data that the 
> special file is pointed at by) special files.

thanks for explaining the -d option to cp.

> this allows you to copy your harddrive to a file,
> like cp /dev/sda foo.

this will do the same as dd?

> 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).

OK -a == -dpR

the -d means cp /dev/console (and links) as a file, 
rather than the content pointed to.

What's the difference between -R and -r for cp? - the 
"non-directories as files" bit. I've been using -r which 
gets what I want, at least till I get a special file.

> So now if you do cp -a /dev/sda foo, foo will be a block 
> node.

I see.

Thanks Joe

-- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!



More information about the TriLUG mailing list