Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 12-22-2007, 08:20 PM   #1
Registered: Nov 2005
Location: California
Distribution: ubuntu 10
Posts: 162

Rep: Reputation: 33
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:
$ls -s /source > data0
$ls -s /destination > data1
$md5sum data0
$md5sum data1
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.
$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"?
Old 12-22-2007, 08:51 PM   #2
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,795

Rep: Reputation: 3575Reputation: 3575Reputation: 3575Reputation: 3575Reputation: 3575Reputation: 3575Reputation: 3575Reputation: 3575Reputation: 3575Reputation: 3575Reputation: 3575
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).

Old 12-23-2007, 04:30 AM   #3
Registered: Oct 2007
Location: India
Distribution: Ubuntu 8.04
Posts: 93

Rep: Reputation: 15
use the dd command it is best...
Old 01-24-2008, 12:07 AM   #4
Registered: Nov 2005
Location: California
Distribution: ubuntu 10
Posts: 162

Original Poster
Rep: Reputation: 33
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.


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
LXer: Can Linux Adoption Ever be Accurately Gauged? LXer Syndicated Linux News 0 07-09-2007 01:31 PM
Command to copy files/folders but skip bad/corrupt files?? leemoreau Linux - Newbie 2 04-02-2007 02:27 PM
Mepis, copy files to thumb drive, files deleted? vremenno Linux - Newbie 6 09-15-2006 11:21 PM
accurately measure time rasselin Programming 1 09-05-2003 05:18 PM
how to accurately measure processing time rasselin Programming 3 09-01-2003 11:45 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:27 PM.

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