LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Copy between Two USB Hard drives (https://www.linuxquestions.org/questions/linux-newbie-8/copy-between-two-usb-hard-drives-4175484599/)

Magic02 11-14-2013 02:53 PM

Copy between Two USB Hard drives
 
I have a 160Gb usb hard drive and I want to copy it's contents to a 1Tb usb hard drive.I have Ubuntu 13.04 installed.how do I go about it?

bigrigdriver 11-14-2013 03:30 PM

Assuming the 160 gig drive is one partition, and with the partitions (source and destination) mounted, you could the tar command to copy the files to the larger drive:
From tiplib.com
Code:

Copy filesystem to another filesystem using tar

We assume /source/dir is a filesystem, if there are other filesystems under /source/dir they
will also be copied to /destination/dir

cd /source/dir
tar -cf - . | ( cd /destination/dir ; tar -xpvf - )


Dman58 11-14-2013 03:49 PM

Maybe something like:

Code:

cp -vr /path/of/source /path/to/destination
Optionally you can leave out the (-v) option but but you won't see any screen output until its completed

Magic02 11-14-2013 04:20 PM

Thanks Will i still have a one terabyte had when I am finished

suicidaleggroll 11-14-2013 04:22 PM

The same way you copy any file/dir from one location to another. cp, rsync, etc.

Personally, I would use rsync -a so that everything is preserved (owner, timestamps, etc) and you can stop/resume the copy at any point:
Code:

rsync -av /path/to/source/ /path/to/destination/

Magic02 11-14-2013 04:26 PM

Many thanks I will try tomorrow and post back.

Beryllos 11-14-2013 09:51 PM

Quote:

Originally Posted by Magic02 (Post 5064540)
Thanks Will i still have a one terabyte had when I am finished

Using any of the three methods posted above, you will still have a one terabyte filesystem when you are finished.

rsync would be my preference too.

Magic02 11-18-2013 10:03 AM

I copied it over using the dd command but some of the files are pausing and not playing right so i want to try the rsync command but i cannot get it to work.Could you give me an example witn sdc1 as the input and sdd1 as the target drive.Thanks I am new to Linux.

suicidaleggroll 11-18-2013 10:21 AM

Two questions:

1) How did you use dd? What was the exact command?
2) WHY did you use dd? Nobody here recommended it, and that's for good reason. It is NOT designed to do what you asked in your original post. Why even bother posting this thread if you're not going to listen to the responses?


As for using rsync, as with ALL of the methods posted above, the drives need to be mounted first. These solutions do NOT work on the raw disk like dd does (again, for good reason).

You probably need to reformat your 1TB drive now, as I suspect you trashed the filesystem using dd. I hope you didn't have anything valuable on it...

schneidz 11-18-2013 10:25 AM

can you please post the output of df -h.

have you tried opening a file manager and rite-clik-copy the files and directorories you want and dragging them to the other location ?

Magic02 11-18-2013 03:53 PM

I used dd if=/dev/sdc1 of=/dev/sdd1 and it copied everything across.I could not get rsync to work and i got the dd command from a man who had a similar problem on this site.I am not sure if the problem could be that the Dreambox cannot handle a 1Tb hard drive or what.I tried what one member said here to my post to copy and paste and it is copying ok but it is 90gb of data so i will try it again then.I had nothing on the drive so i have not lost anything so it is no problem.

suicidaleggroll 11-18-2013 04:08 PM

Quote:

Originally Posted by Magic02 (Post 5066832)
I used dd if=/dev/sdc1 of=/dev/sdd1 and it copied everything across.I could not get rsync to work and i got the dd command from a man who had a similar problem on this site.

Then why didn't you ask what you were doing wrong? Are you sure the person with the dd command had same problem? Probably not. dd is used for an entirely different task than what you asked about in this thread.

In short, you asked for a way to copy files. dd, in the way that you used it, copies disks. Not just the files on the disk, but the disk itself, and every bit on it, used and unused. It doesn't care what's on the disk, it just copies it over, bit for bit, to the destination, wiping out everything in its path, including the filesystem

You can think of a disk like a plot of land, while a filesystem is a library built on that land, and files are books in the library. You asked for a way to copy files from one drive to another, that's like asking how to move some books from library A into library B. By using dd, you bulldozed library B and built a brick-for-brick copy of library A in its place. See the difference?

You need to be working on the filesystem level, NOT the raw disk, to accomplish what you asked about. You should reformat your 1 TB disk...wipe it and re-partition it from scratch. Then mount both drives and use any of the above suggestions to copy the files over.

Quote:

Originally Posted by Magic02 (Post 5066832)
I am not sure if the problem could be that the Dreambox cannot handle a 1Tb hard drive or what.

Doubtful. The more likely explanation is that dd corrupted the filesystem on your 1 TB drive.

They don't call dd "Disk Destroyer" for nothing.

Magic02 11-18-2013 05:41 PM

http://www.linuxquestions.org/questi...nother-894643/.
Is that the same as I want to do.i will do what you suggested.in bed now.Thanks

suicidaleggroll 11-18-2013 06:23 PM

Yes he's wanting to do the same thing, I'll let schneidz explain his reasoning for recommending dd in that application. It seems like he was just offering a bit-for-bit mirror option in case that's what the OP was really looking for.

Essentially, dd is good for mirroring a disk. This is VERY useful when you have a corrupted disk or deleted file you want to recover, you can use dd to mirror the disk into an image file (or onto another disk) and then work with the mirror to try to recover your data, rather than working with the original disk and risk corrupting it further. This works well since dd is not copying files, it's doing a bit for bit copy of the disk's actual contents...empty space, used space, it's all just bits on a platter, and it all gets copied equally.

dd is also useful for cloning a disk - partition table, boot sector, everything. It's good for when you set up a system exactly like you want it, and then clone the disk to a backup. Years later you might get a corruption, and you can just swap in your mirrored disk and pick right back up where you left off.

dd is not so good for copying or backing up files/directories, though. For one, the disk onto which you're copying becomes a mirror of the original - size, filesystem type, etc. Two is that dd copies everything, the entire disk. Even if you only have 1 1MB file on your source drive, dd is going to copy all 160 GB, every time you want to make a backup.

sgosnell 11-18-2013 06:32 PM

If you can't get rsync to work, probably because of syntax, install grsync, which is a gui frontend for rsync. If you can't make that work, you really need to spend some time learning computer basics.


All times are GMT -5. The time now is 11:10 AM.