The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
tarring/compressing files in Unix directory montski Shell Programming and Scripting 1 02-15-2008 01:19 PM
Unzip files where modified time>05:00 ? SunnyK Shell Programming and Scripting 3 11-06-2007 07:15 AM
tarring large no. of files marwan UNIX for Dummies Questions & Answers 4 08-19-2007 12:45 PM
Finding modified files rhayabusa UNIX for Dummies Questions & Answers 2 12-16-2004 10:48 AM
tarring and gzipping dump files PSC UNIX for Dummies Questions & Answers 4 07-23-2004 12:50 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-12-2001
Registered User
 

Join Date: Oct 2001
Posts: 9
backup : files being modified while tarring

I would like to back up several directories weekly using a cronjob.

I'm not experienced in UNIX, but I would start like this:

tar -cvf backup.tar dir1 dir2 dir3

Now if a file is being modified in the process it will result in an error.

How can I prevent this from happening and how can I determine if the backup has been succesful ?

Last edited by jamesbond; 10-12-2001 at 03:16 PM.
Forum Sponsor
  #2  
Old 10-14-2001
Registered User
 

Join Date: Nov 2000
Location: India
Posts: 83
Hi

I don't think if a file is being modified while the filesystem backup is going on, it will give you an error, But yes it will result in an inconsistent backup of the filesystem. For this either you have to confirm that the file backup starts late at night when no one modifies the files or The most recommended option is to bring the system in the single user mode and then start the filesystem backup.

  #3  
Old 10-14-2001
rwb1959's Avatar
Registered User
 

Join Date: Aug 2001
Location: Virginia, USA
Posts: 438
kapliv is correct in saying that the best
way to do a backup is in single user mode.

You can in fact get an error if a file that
tar is in the process of reading gets modified
by another process. You can use the...
--ignore-failed-read
...option and tar should just continue with the
next file. Check your man page carefully.
  #4  
Old 10-14-2001
Registered User
 

Join Date: Oct 2001
Posts: 9
Thank you both for your information!

One more question though:

Would it be possible to switch to 'single user mode' and back without rebooting?
If so, how is this done?
(I've searched the internet for info on this, but no luck)

I'm running freebsd 4.1
  #5  
Old 10-14-2001
Registered User
 

Join Date: Nov 2000
Location: India
Posts: 83
Hi

Quote:
Originally posted by rwb1959
kapliv is correct in saying that the best
way to do a backup is in single user mode.

You can in fact get an error if a file that
tar is in the process of reading gets modified
by another process. You can use the...
--ignore-failed-read
...option and tar should just continue with the
next file. Check your man page carefully.
I tried the tar -cvf filename pathname, and at the same time i was modifying a file in the same folder of which i am forming the tar file. But it didn't give me an error, also i could retrive the file successfully. SO when does it give an error ? Am i missing out something ?
  #6  
Old 10-15-2001
rwb1959's Avatar
Registered User
 

Join Date: Aug 2001
Location: Virginia, USA
Posts: 438
If you want to try to "get" the error you
must be writing the exact same file (not just
the directory) as tar just opened for reading.
Note that I have only experienced this problem
3 times in 2 years and it has been when
developers are working late (in the middle of the
night when the backups run) and makeing changes
to several source files in the CVS tree. It's
really hit or miss (especially with small files).
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:25 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0