system restore from a cron backup

Rick Stevens ricks at nerd.com
Tue Dec 23 19:16:55 UTC 2008


Kevin Kempter wrote:
> Hi All;
> 
> I've setup a cron backup script to backup my Fedora 10 laptop - mostly in case 
> a new yum update breaks my system.
> 
> 
> I'm currently excluding /proc but when the rsync script hits the /sys 
> directory I get lots of read errors like this:
> 
> sys/module/vmmon/initstate                                                           
> rsync: read errors mapping "/sys/module/vmmon/initstate": No data available 
> (61)     
> sys/module/vmmon/refcnt                                                              
> rsync: read errors mapping "/sys/module/vmmon/refcnt": No data available (61)        
> sys/module/vmmon/srcversion                                                          
> rsync: read errors mapping "/sys/module/vmmon/srcversion": No data available 
> (61)    
> 
> Questions:
> 
> - should I exclude /sys from my rsync backup ?

Yes, you should exclude /sys, /proc (they're created on the fly by
the kernel...they're not real directories) and /dev.

> - Is it safe to restore my system without restoring /proc and /sys ?

Yes, they're created by the kernel at boot time.

> - If I do need to restore can I simply do an rsync like this:
>   rsync -va /backup-location /system-location 
> (i.e. rsync -va /stage/backup/etc  /etc)
> 
> Will rsync overwrite the files say in /etc with the backed up files even if the 
> current /etc files are newer than the backed up files.

Those last two questions are related.  If you specify "-u" as well 
("rsync -vau /stage/backup/etc /etc"), newer files on the receiver (/etc
in your cited case) won't be overwritten.  If you're running SELinux,
have a looksee at the rsync_selinux man page, too.

> Here's my backup script if it helps:
> # cat run_rsync.sh
> #!/bin/bash
> 
> for I in `cat dirlist`
> do
>         echo "[$I]"
>         echo "=========="
>         rsync -av /${I} /stage/backup
> done
> 
> 
> and here's the dirlist file:
> # cat dirlist
> bin
> boot
> dev
> docs
> download
> etc
> home
> lib
> lib64
> lost+found
> media
> mnt
> opt
> root
> sbin
> selinux
> srv
> sys
> tmp
> usr
> var
> 
> 
> 
> as always,  thanks in advance...

If you have the space in your backup directory and you want to back up 
the whole system, I'd just:

    rsync -avu --exclude-from=/etc/backup-exclude / /stage/backup

and put the directories you DON'T want backed up in /etc/backup-exclude:

     /sys
     /proc
     /dev

That's just my opinion, I could be wrong.

----------------------------------------------------------------------
- Rick Stevens, Systems Engineer                      ricks at nerd.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-       "Yeah, but you're taking the universe out of context."       -
----------------------------------------------------------------------




More information about the fedora-list mailing list