LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-17-2007, 04:30 PM   #1
rcmonroig
Member
 
Registered: Mar 2007
Location: Chandler, AZ
Distribution: Fedora 10,12,and 14
Posts: 51
Blog Entries: 1

Rep: Reputation: 15
Question Backup script


I am trying to create and automate a simple backup script to backup my home directory to a CD-RW in Fedora Core 6. Is there a special trick for accesing the CD-RW and copying the backup files to it. Anyone know of a simple backup script.
 
Old 04-17-2007, 05:44 PM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
I would recommend using kdar. It can perform incremental backups and can also pause after each slice is created, in case the backup would be greater than 650MB. This allows you to burn the slice and and delete it if you don't have room for the entire backup. This is likely the case when backing up a full home directory. You can also save a script to use the dar command instead.

DAR stands for Disk ARchiver as TAR stands for Tape ARchiver.
 
Old 04-18-2007, 04:02 AM   #3
rcmonroig
Member
 
Registered: Mar 2007
Location: Chandler, AZ
Distribution: Fedora 10,12,and 14
Posts: 51
Blog Entries: 1

Original Poster
Rep: Reputation: 15
Smile thanks for for suggesting Dar

Can you recommend a short script to test it out?
 
Old 04-18-2007, 04:12 AM   #4
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 61
If you want to do it manually (ie write your own script) try something like this:
Code:
#! /bin/bash
# Create a tarball of your home directory
tar -czvf /tmp/backup.tar.gz /home/username/

# Make a CD image of the tarball
mkisofs -r -o cdImage.iso /tmp/backup.tar.gz

# Blank the CDRW
cdrecord dev=/dev/hdd blank=[all,fast,session]

# Write the CD Image to the CDRW
cdrecord -v speed=32 dev=/dev/hdc -data cdImage.iso
You will probably need to add some error checking and prompting to that
Also, don't forget to delete the tarball from /tmp after you have verified the integrity of the backup. You could use MD5SUM for this.

I hope this helps
--Ian
 
Old 04-21-2007, 12:58 AM   #5
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
If you set up kdar, you can export a bash script which uses dar to do the same thing.
Example:
Code:
#!/bin/bash

# Run this script to create an archive using the following dar command.

dar -v -c "/media/disk/backups/matrix/dar_backups/diff_apr19-2007" -R "/" -A "/media/disk/backups/matrix/dar_backups/matrix_diff_Apr19-2007" -s 4613734400 -D -y -m 150 -Z "*.avi" -Z "*.bz2" -Z "*.gif" -Z "*.gz" -Z "*.jpg" -Z "*.mov" -Z "*.mpg" -Z "*.pbm" -Z "*.pdf" -Z "*.png" -Z "*.pnm" -Z "*.Z" -Z "*.zip" -X ".*" -X ".*~" -X "*~" -X "*.dar" -P "tmp/dar_backups" -P "dev/pts" -P "home/jschiwal/.beagle" -P "home/jschiwal/.imgseek" -P "home/jschiwal/.kde"  -P "media" -P "proc" -P "sys" -P "tmp" -P "var/tmp"
It will contain you options in a number of arguments, such as -R for the root of the backup; -P to exclude directories; -Z to avoid compression for certain filetypes; -s for the slice size, etc.
You could read through "man dar" and do it manually, but it would be easier to use kdar to set up a script.
You could perhaps use kdar for the first full backup and the first differential backup, and use a script when you feel that it is working correctly.
 
  


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
Need backup script. gtrawoger Linux - Software 2 07-17-2006 07:31 AM
backup script wiltzius Linux - Software 8 03-23-2005 05:12 PM
Need a backup script enygma Linux - General 5 11-04-2004 03:49 PM
backup script lhoff Programming 2 05-28-2003 11:37 PM
backup script ixion Linux - Software 2 01-09-2003 06:39 AM


All times are GMT -5. The time now is 08:57 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration