Quote:
Originally Posted by mikanoid
Recently installed slackware 11.0, using 2.6 kernel, which includes the /proc pseudo-filesystem. I use cp for simple backup to a removable drive, but cp hangs on /proc/kmsg. (It also takes a long time on /proc/kcore, hopefully it sees it as a sparse file.) Is there some way to make cp skip /proc (there's no documented option I can find)? I guess I could turn off /proc altogether but supposedly some programs in the distribution use it.
|
Why would you need a backup of anything outside /home? Much of the system will be best rebuilt with a re-install from the CDs/DVD.
But to answer your question, if you want to do things that way, you'd probably be best off specifying particular directories in your script as opposed to a simple "cp -r / $TARGET".
There are other pseudo filesystems for which backups are not necessary. Eg: /sys & /dev. Also, you may not need/want to backup anything under /mnt, /media or /tmp.
I'd suggest something like this:
Code:
#!/bin/bash
TARGET="/mnt/backup"
cp -r /bin $TARGET
cp -r /boot $TARGET
cp -r /etc $TARGET
cp -r /home $TARGET
cp -r /lib $TARGET
cp -r /opt $TARGET
cp -r /root $TARGET
cp -r /sbin $TARGET
cp -r /usr $TARGET
cp -r /var $TARGET
There are probably quicker & neater ways of doing this using xargs and some regexp...
but this would do for me.