I'm trying to archive files from /proc/net when a process crashes. This is to aid in debugging, to get understanding about the machine status when crash happened.
The contents are not regular files, but interface to internal data structures in the kernel.
# file /proc/net/arp
/proc/net/arp: empty
# cat /proc/net/arp | head -n 3
IP address HW type Flags HW address Mask Device
172.18.0.2 0x1 0x2 02:42:ac:12:00:02 * docker0
172.18.0.3 0x1 0x2 02:00:00:00:00:13 * docker0
Though cat command displays the content, I'm not able to archive it with tar. Example to demonstrate with a single file:
# tar -cvf net.tar /proc/net/arp
tar: Removing leading `/' from member names
/proc/net/arp
# tar -xvf net.tar
proc/net/arp
# cat proc/net/arp
#
What would be the best way to archive /proc? Is having a script to iterate all files and cat the contents the only possibility?