LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   TAR'ing a directory that's possibly in use? (https://www.linuxquestions.org/questions/linux-newbie-8/taring-a-directory-thats-possibly-in-use-752725/)

anon091 09-04-2009 01:43 PM

TAR'ing a directory that's possibly in use?
 
I want to make a TAR of a directory we have that is shared out with samba, but there may be some users using a couple files on it. Will this cause any issues TAR'ing the whole thing now? will it just skip the files that are opened by users? it's only a few files, and i really want to get a TAR file as a backup of how it is now.

TB0ne 09-04-2009 01:48 PM

Quote:

Originally Posted by rjo98 (Post 3670000)
I want to make a TAR of a directory we have that is shared out with samba, but there may be some users using a couple files on it. Will this cause any issues TAR'ing the whole thing now? will it just skip the files that are opened by users? it's only a few files, and i really want to get a TAR file as a backup of how it is now.

No, it won't skip them, but it might cause corruption in the file when you go to open it later. Tar will just get what's there now, and make it's best attempt to archive the data as is.

It won't damage what's there if someone has it open, but may not restore correctly later.

anon091 09-04-2009 01:49 PM

Corruption as in my TAR file would be totally useless, or just those couple open files might not extract right?

catkin 09-04-2009 01:52 PM

A solution is to put the directory on an LVM volume and then use an LVM snapshot. That way you get a consistent backup at a point in time and can restore the files as they were at that time.

anon091 09-04-2009 02:01 PM

I usually use a TAR then GZIP cron job, but i needed a more immediate, fresh backup for something. can't really move this shared volume to another server with LVM.

TB0ne 09-04-2009 03:23 PM

Quote:

Originally Posted by rjo98 (Post 3670008)
Corruption as in my TAR file would be totally useless, or just those couple open files might not extract right?

Just those files, and they MAY be ok, but you can't know for sure, until you restore them.

anon091 09-04-2009 03:25 PM

OK, thanks for clarifying. is there a way to tell what files are even open within a directory through Samba at a given time?

catkin 09-04-2009 04:07 PM

Quote:

Originally Posted by rjo98 (Post 3670105)
OK, thanks for clarifying. is there a way to tell what files are even open within a directory through Samba at a given time?

Even if there were, the "given time" is not precise enough because you don't know when tar is backing up specific files. A simpler and more do-able approach might be to script restoring the files to somewhere else and compare their checksums with the original files. If any did not match you could do whatever was necessary -- perhaps simply note that those files are not backed up or add them to the archive (and then repeat if they may still be changing).

anon091 09-04-2009 04:10 PM

Thanks everybody. I think I'm just going to wait till early morning and kick off the TAR file. guess i'll just have to be patient :-( haha


All times are GMT -5. The time now is 04:23 PM.