LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I accurately copy files? (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-accurately-copy-files-608644/)

djeikyb 12-22-2007 08:20 PM

How do I accurately copy files?
 
I need to repartition my hard drives without losing any important data. My current partitioning scheme is wasting gigs of space, mostly because I've changed my primary OS a few times in the last year or so, like to keep a few versions of Windows around, and install new flavours of Linux when the urge strikes. In any case, I need to shuffle data. Circumstances demand WinXP is my main OS. I don't trust Windows to properly copy massive quantities of files across devices. I've tried it before, and always end up with missing, and sometimes corrupted, files. I'm hoping linux is more reliable. However, I'm still more or less a noob.

I tried "cp -Rv /source/* /destination". I think it worked, but I can't tell for sure. I expected the checksums to match, but no such luck:
Code:

$ls -s /source > data0
$ls -s /destination > data1
$md5sum data0
asfsa;dlkfaslkf
$md5sum data1
234-r89qwer-98

Looking at the contents of data0 and data1, the file sizes are similar, but not exact. This is probably okay, right? But now I'm paranoid. I'd really like a transfer method I can efficiently (lazily) and accurately verify.

DD looks useful, but I'm wary, especially after reading the lq tutorial on it. Destination partition is way bigger than source partition.* And how will I verify its success? Will I run into the same problems?

I decided I'd tar/bzip2 my files with cygwin. Tarring fifty gigs apparently takes a while. In retrospect, the bzip2 was unnecessary, as this set of files are compressed audio.
Code:

$tar -cvvf /destination/archive.tar.bz2 /source/
tar: Error exit delayed from previous errors
$cd /destination
$tar -xvvjf music-archive.tar.bz2
bzip2: (stdin) is not a bzip2 file.
tar: Child returned status 2
tar: Error exit delayed from previous errors

I scrolled up as far as I could, and didn't see any errors, and the tar file looks the right size.


*I plan on using gparted to make Destination partition even bigger once I degunk more of that drive. Hopefully someone will tell me now if using gparted to extend a fat32 partition will destroy all its data.

By the way, can Windows really only use fat and ntfs? Is it simply a matter of "no one has done it yet"?

syg00 12-22-2007 08:51 PM

Use "cp -a ..." that way it preserves any links. I use it all the time (and nothing else) to move systems around.
Do it from a liveCD - that way you don't have to worry about the pseudo filesystems (/dev, /proc, things like that).

Easy.

lin_myworld 12-23-2007 04:30 AM

use the dd command it is best...

djeikyb 01-24-2008 12:07 AM

Just for the record, I eventually bought another hard drive and used an Ubuntu livecd to rsync my data. Unlike cp, the transfer was perfect enough for checksums.


All times are GMT -5. The time now is 07:26 PM.