The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 04:19 PM
Unzip files where modified time>05:00 ? SunnyK Shell Programming and Scripting 3 11-06-2007 10:15 AM
tarring large no. of files marwan UNIX for Dummies Questions & Answers 4 08-19-2007 03:45 PM
Finding modified files rhayabusa UNIX for Dummies Questions & Answers 2 12-16-2004 01:48 PM
tarring and gzipping dump files PSC UNIX for Dummies Questions & Answers 4 07-23-2004 03:50 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-12-2001
jamesbond jamesbond is offline
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 06:16 PM..
  #2 (permalink)  
Old 10-14-2001
kapilv kapilv is offline
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 (permalink)  
Old 10-14-2001
rwb1959's Avatar
rwb1959 rwb1959 is offline
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 (permalink)  
Old 10-14-2001
jamesbond jamesbond is offline
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 (permalink)  
Old 10-14-2001
kapilv kapilv is offline
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 (permalink)  
Old 10-15-2001
rwb1959's Avatar
rwb1959 rwb1959 is offline
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).
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:30 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0