Solved

Help :Backing up a file system

Posted on 1998-01-23
10
302 Views
Last Modified: 2010-04-21
Hello,
     I was wondering if someone could share some backup scripts with me. Actually I want to back up the /usr/local file system everyday at a particular time(midnight). I want it to backed up  if any changes have been made on the /usr/local file system. ( I believe this is an incremental backup ). Can someone please tell me the cron script in order to do this and where will I have to add this entry( the file ?? )

Waiting for a response.
Thanks
Jeetandra
0
Comment
Question by:jmahtani
  • 5
  • 4
10 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 2008628
put your script into a crontab file (prefered roots crontab).
How to do this depends on your OS. The crontab file should contain somthing like:

59 23 * * *  path_of_your_script

your script may look like this:
#!/bin/sh

cd /usr/local
tar cvf /dev/tape `find . anewer backup.timestamp -print`
touch backup.timestamp


NOTE that tar just copies to your tape. If this should be incremental, the tape must be possitioned at the end. This usually depends on your device.
0
 

Author Comment

by:jmahtani
ID: 2008629
Ahoffman,
         Thanks for replying. I was wondering if you could tell me how to do it by using ufsdump, rather then tar. I believe that by using ufsdump, one can back up only the changes that have been made since the previous day.
Waiting for your response.
By the way, I am using solaris 2.5.1
Thanks,
Jeetandra
0
 

Expert Comment

by:psundstr
ID: 2008630
To use ufsdump you just need to use the command:

ufsdump 1uf /dev/rmt/0 /usr/local

The number "1" specifies what level the dump is.  Level 0 is
a full level dump.  The "u" flag tells ufsdump to update the
dumpdate file so it knows what timestamp to check against for
file changes.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2008631
I made a general purpose suggestion, not limited to any UNIX flaviour ;-)

You're lucky if your Solaris can do it that simple way (ufsdump).
0
 

Author Comment

by:jmahtani
ID: 2008632
Hello,
      I have added the following statement to the root crontab ( /var/spool/cron/crontabs/root ), but at 15:15, it does not dump the /usr/local filesystem.
15 15 * * * /usr/sbin/ufsdump 1uf /dev/rmt/0 /dev/rdsk/c1t1d0s7
Can someone please tell me whats going on ???
Waiting for your response.

The following are the contents of the root crontab file :
#ident  "@(#)root       1.12    94/03/24 SMI"   /* SVr4.0 1.1.3.1       */
#
# The root crontab should be used to perform accounting data collection.
#
# The rtc command is run to adjust the real time clock if and when
# daylight savings time changes.
#
0 2 * * 0,4 /etc/cron.d/logchecker
5 4 * * 6   /usr/lib/newsyslog
15 3 * * * /usr/lib/fs/nfs/nfsfind
1 2 * * * [ -x /usr/sbin/rtc ] && /usr/sbin/rtc -c > /dev/null 2>&1
15 15 * * * /usr/sbin/ufsdump 1uf /dev/rmt/0 /dev/rdsk/c1t1d0s7          

0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 51

Expert Comment

by:ahoffmann
ID: 2008633
Did you just add this with an editor? Probably you need a special command to edit the crontab files (crontab, cronvi, ..) or your crond must be informed that something changed: send a HUP signal or kill it and restart.
0
 

Author Comment

by:jmahtani
ID: 2008634
I did reboot the system after adding the entry to the cron. So, the crond must have read the entries once again.
Also, when the system was rebooting, it displayed a message something like %root is no user, cron entry not created
Any suggestions ??
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2008635
> cron entry not created
check your var/adm/{messages,syslog} if there is more information
you also need to read your man-pages about cron, crontab etc. (sorry I don't have them available)
0
 

Author Comment

by:jmahtani
ID: 2008636
Ahoffman,
         Its working. I checked up the /etc/dumpdates file and it had dumped it at the time that I had specified in the root crontab file.
Thanks.
Jeetandra
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2008637
That's what e-e is for ;-)
Thanks for grading.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now