LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 07-07-2011, 10:36 AM   #1
Willard
LQ Newbie
 
Registered: Nov 2009
Posts: 13

Rep: Reputation: 0
mv command, data integrity


Greetings.

I am creating a cron job on an archlinux server. This cron job should run daily, moving audio files and large bitmap files from a local directory A, to a remote directory (a samba share) B.

My first idea was to
  1. mount the remote samba share locally, in mount point C,
  2. mv the files from A to C.

To make sure the data finds its way to B exactly as it was in A, I felt the need to investigate how mv works.

According to the man file and the Debian info files, mv will copy the file from A to C, and only delete the original from A when the transfer to C completes successfully.

However, this documentation does not specify whether "successfully" just means the file was transferred, or whether it also does integrity checking (like computing an md5sum checksum etc).

Does mv do this?

If not, I need to use a different utility. I imagine loads of people have this very same need, and that this problem has been solved before. What other utility is ideal for this purpose?

Or do I use a combination of cp and rm, and do the md5sum check myself?

Thanks for your help,

Willard.
 
Old 07-07-2011, 11:49 AM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Debian, FreeBSD
Posts: 3,755
Blog Entries: 5

Rep: Reputation: Disabled
A few ramblings from me: I haven't reviewed the mv(1) source code. Like you, I poked through its man pages and info entry (in coreutils).

My gut feeling is that using mv to push the file over tcp should result in a "successful" operation (read: identical before and after), or a noisy error if something went awry.

That said, it's trivial enough to do a sha1sum(1) of the file before and after the copy, a la:
  1. generate crypto digest for /path/A/audio_file01
  2. copy (rather than move) /path/A/audio_file01 -> /path/B
  3. generate crypto digest for /path/B/audio_file01
  4. do digests match? make noise and exit if not
  5. remove /path/A/audio_file01

Might as well be sure about the file's integrity and sleep well at night.
 
Old 07-07-2011, 07:46 PM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.2, Centos 5.8
Posts: 11,740

Rep: Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905
There's always rsync; I believe that is very careful about checking whether it went ok.
 
  


Reply

Tags
backup, md5sum, mv


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Raw device data integrity test tool? dbrazeau Linux - Software 1 01-07-2010 06:57 AM
Testing the integrity and checking the data on a hard drive Cinematography Linux - Hardware 5 07-21-2009 04:45 PM
protecting data integrity of a server which is always on DJOtaku *BSD 4 09-22-2007 11:53 AM
Data Integrity Checks itnaa Linux - Software 7 12-22-2006 01:28 PM
creating tar files with high data integrity edman007 Linux - Software 13 10-10-2006 02:00 PM


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

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration