How can I make a copy of device/socket file

Issue

I can know inode of device/socket with stat, so seems like I can somehow “copy” this file for backup. Of course the solution is “dd”, but I have no idea what can I do if the device is infinity (like the random one). And can I just copy the inode somehow?

Solution

These are referred to as “special files” or “special nodes”. Copying their contents doesn’t make sense, as the contents are generated in one way or another programatically by the kernel as needed.

Programs like “tar” know how to copy the contents of the inode, which will refer to the portion of the kernel that support each of these different nodes. See the documentation of the “mknod” command for some more details.

Answered By – Darron

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published