Solved

Help :Backing up a file system

Posted on 1998-01-23
10
311 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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
 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

776 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