Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've just exchanged tape drives between machines (both Unix Tru64). The device files aren't working now, and I have to do some work with them (will generate a different question). I created a directory to store the old device files to, but the cp command is treating them like device files and won't just let me copy them.

How do I copy the device files to another directory as text?

share|improve this question
    
Can you explain a bit better what you mean? I've no idea what you want to do and why. –  SvW Jul 18 '13 at 15:26
    
@SvW, I want to save the device files as a backup so if something goes wrong I can restore them. I need to know how to copy them over to another directory. The system is treating them when I try to copy like I'm trying to access a device instead of moving the file. –  Lance Roberts Jul 18 '13 at 15:27
add comment

1 Answer 1

up vote 9 down vote accepted

STOP.

Do nothing further until you fully understand what device special files are, what they mean to the operating system, and how they are created/managed. (hint: mknod -- this will probably help you fix your other problem too)

In brief, a device file is an interface for sending commands/data to a device's driver, and receiving information back from it.
It is not a regular file containing data to be copied, moved, or otherwise manipulated in the usual way.


With your newfound understanding of what device files are it should be clear that you CAN NOT simply "copy a device file to another directory as text" -- That's not how they work.
If you do copy a device file you're simply copying a pointer to the driver: Change tapes and the data is going to be different.

Thus to copy the contents of a "tape device file" makes no sense -- what you want is to copy the data off the tape. To do that you need to send commands to the tape device to give you all of its data, and then store that as a regular file somewhere else. The tar or cpio commands can be useful here, but there are other options.

share|improve this answer
    
I'm only trying to backup the device files in case something goes wrong either copying the ones from the machine I took the other tape from, or recreated them with makedev. I don't want to lose them in case I have to switch back for some reason. –  Lance Roberts Jul 18 '13 at 15:54
1  
@LanceRoberts That's really not how they work. Read Voretaq's answer and especially linked documents. –  Chris S Jul 18 '13 at 15:55
1  
@LanceRoberts You can't "lose" a device file -- all a device file is is an arrow saying "The tape drive is over here" ("Over Here" being a Major and Minor device ID). If you delete, move, or otherwise mangle them you simply recreate them (with makedev or mknod). If you're particularly concerned about being able to re-create the device (i.e. if makedev isn't trustworthy) ls -l will give you the Major and Minor ID numbers which you can then provide to mknod. (If mknod doesn't work you likely have much bigger problems...) –  voretaq7 Jul 18 '13 at 16:11
    
Thanks for the help. –  Lance Roberts Jul 18 '13 at 17:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.