LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-15-2008, 03:05 PM   #1
s2cuts
Member
 
Registered: Mar 2007
Posts: 61

Rep: Reputation: 18
cp command problems when copying from NTFS...


Hello all, I've been trying to figure out why I'm having issues with the cp command used with the archive (-a) and update (-u) switches. What I'm attempting is to back up large amounts of media data that hardly ever changes, and typically only gets added to. I wanted to run some simple scripts to take advantage of the cp command's archiving and update only ability. As an example, in a script, something like this would exist:

cp -au $1/myvids $2/myvids

This script could be run on a regular basis, and should only copy new or changed files while preserving the file attributes, correct? Funny thing is, it works on almost all the files except a hand full (some of them quite large). It re-copies the problematic files every time as if there has been a change (no change that I can tell of course). It's always the same files, and in some instances I was able to make the files behave normally by making a local copy and replacing the original with the copy. This is not working for all the problem files.

The only other thing I can tell you is that the source for all these files is an NTFS partition. And that this problem seems to be with the preserve portion of the archive option of cp.

Has anyone else seen this kind of goofy-ness?

S2
 
Old 01-15-2008, 03:16 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
I don't know exactly what your problem is. From your description one theoretical cause of this problem could be if the user running the cp command had write permissions to the problematic portions of $2/myvids but did not have read permissions. In that case I think that cp would decide that the files do not exist on $2/myvids and copy backup copies to $2/myvids.

Check the permissions on the portion of the $2/myvids tree where you are having problems.

--------------------
Steve Stites
 
Old 01-18-2008, 12:38 AM   #3
s2cuts
Member
 
Registered: Mar 2007
Posts: 61

Original Poster
Rep: Reputation: 18
I've checked permissions and it seems to be 777 across the board.

I tend to think that there is some kind of NTFS file attribute that's not being translated or copied properly. I believe that Linux reading NTFS is still a work in progress for the most part, so maybe I'll pose this with the ntfs-3g people. I'll reply if I learn anything.
 
Old 01-18-2008, 12:53 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
NTFS doesn't use Unix file permissions so I don't think you can rely on these options. Why are you using NTFS?

Linux/Unix doesn't use an archive bit that is used by windows. It would probably be better to use tar for backups and use the SNAPSHOT-FILE option to create subsequent incremental backups.
 
Old 01-18-2008, 03:13 AM   #5
s2cuts
Member
 
Registered: Mar 2007
Posts: 61

Original Poster
Rep: Reputation: 18
The target is infact ext3 (where the permissions are 777), it's the source that's NTFS. The reason there's NTFS at all is I'm still dual booting with XP for a few things.
 
Old 01-19-2008, 02:03 PM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
The -a option doesn't mean to only copy new files. If is an alias for several options you would use for backing up files, so that they retain their original attributes. However, the NTFS filesystem uses a different set of attributes and some of the attributes that you see are temporary attributes maintained in the VFS layer while the filesystem is mounted. I think that one of the timestamps are used however, so using find and tar to select new files should work OK. There is a tar command option for creating and using a timestamp file that can achieve the same thing for incremental dumps.
 
Old 01-19-2008, 06:09 PM   #7
s2cuts
Member
 
Registered: Mar 2007
Posts: 61

Original Poster
Rep: Reputation: 18
I think I may give tar a try. So would it be unheard of to create a 80GB tar file over a 100Mb network?

Edit: without applying any compression

Last edited by s2cuts; 01-19-2008 at 07:50 PM.
 
Old 01-20-2008, 12:46 AM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I'm not certain but there may be a limit for a filesize over SMB. If you are using Samba or Windows networking an 80GB file may exceed the limit. You may need the -L and -M options to create multipart archives. If you are running a windows manager, another option is using dar or kdar. Kdar is a GUI front end to dar. Dar stands for Disk ARchiver.

---

Update:
I looked in the cifs.txt file in the kernel source documentation. CIFS has Large File support so maybe you won't run into a filesize limit problem. I once backed up my home directory before installing a newer version of my distro. The target external drive used FAT32 so I knew I would run into a filesize problem. I piped the output of tar through the "split" command to break it up into manageable slices. Then I used "par2" to create parity files in case one of the slices was damaged. I simply used cat to reassemble the slices but piped the output into tar, so a file of tens of GB wasn't necessary.

Last edited by jschiwal; 01-20-2008 at 12:59 AM.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying from NTFS within Linux to another NTFS drive? sandeepg Linux - General 4 01-21-2006 12:43 AM
Knoppix: copying files from NTFS to FAT32 Manhhh Linux - Newbie 6 08-25-2005 03:21 PM
Copying ReiserFS to NTFS GoatKing Linux - Software 4 03-25-2004 12:56 PM
Copying files to WinXP(NTFS)partition WindowsBurner Linux - General 14 11-11-2003 08:53 AM
I/O error when copying (some) NTFS files cherup Linux - Newbie 1 05-21-2003 04:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:45 PM.

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