LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-30-2011, 04:34 AM   #1
DebianUser
Member
 
Registered: Apr 2010
Posts: 88

Rep: Reputation: 15
system backup script


I currently backup my user home directories on an ad-hoc basis but i'd like to also have a system backup in case everything breaks.

Is there software that can do this via CLI or a bash script that would do the same thing? i'd like to exclude the /home folder and basically backup anything else ie programme conf files etc.
 
Old 01-30-2011, 10:53 AM   #2
barriehie
Member
 
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Blog Entries: 1

Rep: Reputation: 23
Quote:
Originally Posted by DebianUser View Post
I currently backup my user home directories on an ad-hoc basis but i'd like to also have a system backup in case everything breaks.

Is there software that can do this via CLI or a bash script that would do the same thing? i'd like to exclude the /home folder and basically backup anything else ie programme conf files etc.
I use rsync to backup my machine every day via /etc/crontab. I'm using a homemade bash script and backing up /home to one dir. and everything else to another dir. There are packages that can backup; search your package manager.
 
Old 01-31-2011, 10:55 AM   #3
DebianUser
Member
 
Registered: Apr 2010
Posts: 88

Original Poster
Rep: Reputation: 15
which directories do you exclude? I assume proc dev tmp any more? Also how does this work with packages installed via apt will they still work after a restore?
 
Old 01-31-2011, 11:48 AM   #4
barriehie
Member
 
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Blog Entries: 1

Rep: Reputation: 23
Quote:
Originally Posted by DebianUser View Post
which directories do you exclude? I assume proc dev tmp any more? Also how does this work with packages installed via apt will they still work after a restore?
My command to backup everything is like this:
Code:
rsync -av --exclude-from=/usr/local/bin/eList  / /media/backup/$dow && touch -m -t $(date +%m%d)06$dom /media/backup/$dow
As you can see it makes a dir. that has the name of the day of the week. I'm using an external 80 Gig drive so I just let those keep writing over the last weeks backups. I'm then touching the file so that the mod time is 06 hours and day of the month minutes. Prior to backing up my home dir I do a bit of cleanup that is the majority of the script, removing old session files, thumbnails, etc.

The file list of excluded dir.'s is this:
Code:
tmp/
proc/
lost+found/
mnt/
sys/
media/
dev/
In regards to everything working after a restore it did the last time I 'oopsed' and had to use my backup. Excluding the down time, about 30 min., you would've never known anything had broken.

HTH
 
Old 01-31-2011, 02:24 PM   #5
DebianUser
Member
 
Registered: Apr 2010
Posts: 88

Original Poster
Rep: Reputation: 15
thanks for the info, i've just a test run using tar and all seemed ok, I take it a restore would be as simple as untaring at /? how do you restore if using the rsync method?
 
Old 01-31-2011, 03:38 PM   #6
barriehie
Member
 
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Blog Entries: 1

Rep: Reputation: 23
Quote:
Originally Posted by DebianUser View Post
thanks for the info, i've just a test run using tar and all seemed ok, I take it a restore would be as simple as untaring at /? how do you restore if using the rsync method?
Been awhile since I've used tar so can't help there but using rsync would be a matter of reversing your original source and destinations. I used to use tar with gzip but it took entirely TOO LONG to retrieve a specific file.
 
Old 01-31-2011, 03:51 PM   #7
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,237

Rep: Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656Reputation: 1656
If you have time in your schedule to shut the machine down, unmount the partitions,.. you can do a 1:1 image copy using partimage...
 
Old 02-01-2011, 01:06 AM   #8
barriehie
Member
 
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Blog Entries: 1

Rep: Reputation: 23
In my prior post I've neglected how I defined $dow and $dom...
Code:
dow=$(date +%w) # Day No. Of Week; e.g. 0=Sunday, 1=Monday, 2=Tuesday, etc.
dom=$(date +%d) # Day No. Of the Month; e.g. [0-31]
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
System Backup/Restore script or application stascrash Linux - Newbie 2 02-02-2010 01:47 PM
Newbie trying to write a simple backup script to backup a single folder Nd for school stryker759a Linux - Newbie 2 09-16-2009 09:52 AM
how to create backup MYSQL Script to backup my database for every 1hour RMLinux Linux - Newbie 3 11-20-2008 11:13 AM
Backup system ala rdiff-backup, but without mirror and with dst encryption dr_dex Linux - Software 0 08-04-2008 04:39 AM
Script to backup system files Kristijan *BSD 3 10-01-2006 05:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration