LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-05-2017, 02:12 PM   #1
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Rep: Reputation: Disabled
tar - File changed as we read it


I was running a tar command on a folder with around 150GB of files. It is a website script and a picture galleries site. The exact command was:

tar -zcf target-file-name.tar.gz /home/www/html/site-folder

I was reading about this error on the Internet and I have a general idea what it is, but I was wondering about two things:

1) What is it that is changing these files or a file? What is it literally on a Centos 7 machine that is doing that? It is a basic installation with httpd, mariadb, php and other things like this that are needed for the serving of sites.

2) How can I stop that.

Find what it is and stop it... How to do that?

Thanks.
 
Old 06-05-2017, 02:16 PM   #2
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237
Blog Entries: 2

Rep: Reputation: Disabled
chattr +i /path/to/file (makes the file write immutable)

Also maybe this might help: lsof -p pid# | grep log (to see what logs something is writing to; replace log with bin to see where the binary is, or .so to see what shared library something is using)

Last edited by justmy2cents; 06-05-2017 at 02:26 PM.
 
Old 06-05-2017, 02:22 PM   #3
notKlaatu
Senior Member
 
Registered: Sep 2010
Location: Lawrence, New Zealand
Distribution: Slackware
Posts: 1,075

Rep: Reputation: 725Reputation: 725Reputation: 725Reputation: 725Reputation: 725Reputation: 725Reputation: 725
Install and run audit.

It tracks who or what changes files.

https://www.cyberciti.biz/tips/linux...to-a-file.html
 
Old 06-05-2017, 02:25 PM   #4
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 20 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2916Reputation: 2916Reputation: 2916Reputation: 2916Reputation: 2916Reputation: 2916Reputation: 2916Reputation: 2916Reputation: 2916Reputation: 2916Reputation: 2916
Have you searched through the source folder for all those files modified since you started the tar running? That should help you take the first step and pinpoint which file(s) are being modified, if any. Also check ctime and atime's.

I trust that you're not creating the target archive in the source folder.
 
Old 06-05-2017, 02:28 PM   #5
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237
Blog Entries: 2

Rep: Reputation: Disabled
Duplicity (the encrypted incremental backup program) can detect changes by comparing the latest backup with your current files.

Last edited by justmy2cents; 06-05-2017 at 02:30 PM.
 
Old 06-05-2017, 02:36 PM   #6
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by AdultFoundry View Post
I was running a tar command on a folder with around 150GB of files. It is a website script and a picture galleries site. The exact command was:

tar -zcf target-file-name.tar.gz /home/www/html/site-folder

I was reading about this error on the Internet and I have a general idea what it is, but I was wondering about two things:

1) What is it that is changing these files or a file? What is it literally on a Centos 7 machine that is doing that? It is a basic installation with httpd, mariadb, php and other things like this that are needed for the serving of sites.

2) How can I stop that.

Find what it is and stop it... How to do that?

Thanks.
You are in /home/www/html/site-folder/ when you ran it.
 
Old 06-05-2017, 10:26 PM   #7
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,852

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
Is it the live folder for your site?

Is it a dynamic website that allows users on the net to make changes? (like uploading files, chat etc.)
 
Old 06-06-2017, 01:47 AM   #8
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hydrurga View Post
Have you searched through the source folder for all those files modified since you started the tar running? That should help you take the first step and pinpoint which file(s) are being modified, if any. Also check ctime and atime's.

I trust that you're not creating the target archive in the source folder.
No, I was not doing that. I was one directory above that. I actually used the tar command on Windows Cygwin and it worked. I dont have to rsync that data too and my connection speed is not very good (I have a lower plan).
 
Old 06-06-2017, 01:48 AM   #9
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by JJJCR View Post
Is it the live folder for your site?

Is it a dynamic website that allows users on the net to make changes? (like uploading files, chat etc.)
It was taken down from the Internet. The Apache screen was showing for this domain. No entry in /etc/httpd/httpd.conf
 
Old 06-06-2017, 02:35 AM   #10
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,482

Rep: Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530Reputation: 5530
when tar drops a message like X file changed, you can use fuser on that file (immediately) to check who is/are opened that.
 
Old 06-06-2017, 07:59 AM   #11
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by JJJCR View Post
Is it the live folder for your site?

Is it a dynamic website that allows users on the net to make changes? (like uploading files, chat etc.)
+1.
cd out of /home/www/html/
run tar.

Code:
sudo lsof +D /home/www/html/site-folder/
will show you what's is "open" and using resources in
/home/www/html/site-folder/
 
Old 06-06-2017, 08:05 AM   #12
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
If it's a live website, it's probably the active log files that are changing. You can put them in an exclusion file so they are not backed up by tar (you probably don't need them backed up anyway). You can leave archived log files being backed up since they no longer changing, if you have some log rotation script installed (just make sure the rotation doesn't conflict with your backup).

Forums and other stuff is usually saved to a database which should store its files somewhere else and should have its own backup tools.

Last edited by Laserbeak; 06-06-2017 at 08:07 AM.
 
Old 06-08-2017, 04:20 AM   #13
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 282

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Laserbeak View Post
If it's a live website, it's probably the active log files that are changing. You can put them in an exclusion file so they are not backed up by tar (you probably don't need them backed up anyway). You can leave archived log files being backed up since they no longer changing, if you have some log rotation script installed (just make sure the rotation doesn't conflict with your backup).

Forums and other stuff is usually saved to a database which should store its files somewhere else and should have its own backup tools.
Thanks for the info. I will be looking into all that later on. As far as that, the site was not live. If it would be live, there are in fact some folders there that constantly change, like caching.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tar - file changed as we read it robertkwild CentOS 23 03-14-2017 03:31 AM
Backup Script Using tar - Error "file changed as we read it" 3rods Linux - Software 6 03-08-2014 05:18 AM
Script to find tar archives, read tar file contents, output content to an index file. bluesword1969 Linux - General 4 02-07-2011 12:15 PM
tar command : error: file changed as we read it sneezesnoeze Linux - General 2 04-05-2004 06:56 PM
Problem creating tar.gz archive - File changed as we read it doctorwebbox Linux - General 1 02-04-2004 05:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration