linux - Saving a copy of proc and sys for tests - Stack Overflow

admin2025-04-15  2

I'm writing a system diagnostic utility and I want data from different servers to be saved as testcases for it.

I want to "archive" a copy of /proc and /sys and unpack it as a testcase for my utility. (one testcase for one inspected server).

I understand that procfs and sysfs are very special, so, may be there are libraries/utilitites which are designed for that and can do it properly? Handling all symlinks, skipping inaccessible files, ignoring memory maps, loops, etc?

I'm writing a system diagnostic utility and I want data from different servers to be saved as testcases for it.

I want to "archive" a copy of /proc and /sys and unpack it as a testcase for my utility. (one testcase for one inspected server).

I understand that procfs and sysfs are very special, so, may be there are libraries/utilitites which are designed for that and can do it properly? Handling all symlinks, skipping inaccessible files, ignoring memory maps, loops, etc?

Share Improve this question asked Feb 4 at 10:09 George ShuklinGeorge Shuklin 7,96311 gold badges51 silver badges93 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

You can start experimenting with utility rsync :

rsync -aHAX --numeric-ids --exclude="*/maps" --exclude="*/mem"\
              --exclude="*/kmem" --exclude="*/port" --exclude="*/fdinfo"\
              --exclude="*/sysrq-trigger" --exclude="*/kcore"\
              --exclude="*/core_pattern" --exclude="*/perf_event_paranoid"\
              /proc /sys /tmp/proc-sys-$(date +%FT%T)
转载请注明原文地址:http://www.anycun.com/QandA/1744728357a86791.html