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! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
11-14-2013, 03:53 PM
|
#1
|
LQ Newbie
Registered: Jul 2005
Location: Ireland
Distribution: Suse 9.3 Pro
Posts: 15
Rep:
|
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?
|
|
|
11-14-2013, 04:30 PM
|
#2
|
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908
|
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 - )
|
|
|
11-14-2013, 04:49 PM
|
#3
|
Member
Registered: Nov 2010
Location: The Danger Zone
Distribution: Slackware & everything else in a VM
Posts: 294
Rep:
|
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
|
|
|
11-14-2013, 05:20 PM
|
#4
|
LQ Newbie
Registered: Jul 2005
Location: Ireland
Distribution: Suse 9.3 Pro
Posts: 15
Original Poster
Rep:
|
Thanks Will i still have a one terabyte had when I am finished
|
|
|
11-14-2013, 05:22 PM
|
#5
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
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/
|
|
1 members found this post helpful.
|
11-14-2013, 05:26 PM
|
#6
|
LQ Newbie
Registered: Jul 2005
Location: Ireland
Distribution: Suse 9.3 Pro
Posts: 15
Original Poster
Rep:
|
Many thanks I will try tomorrow and post back.
|
|
|
11-14-2013, 10:51 PM
|
#7
|
Member
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529
|
Quote:
Originally Posted by Magic02
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.
Last edited by Beryllos; 11-14-2013 at 10:54 PM.
|
|
|
11-18-2013, 11:03 AM
|
#8
|
LQ Newbie
Registered: Jul 2005
Location: Ireland
Distribution: Suse 9.3 Pro
Posts: 15
Original Poster
Rep:
|
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.
|
|
|
11-18-2013, 11:21 AM
|
#9
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
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...
Last edited by suicidaleggroll; 11-18-2013 at 11:23 AM.
|
|
|
11-18-2013, 11:25 AM
|
#10
|
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,326
|
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 ?
|
|
|
11-18-2013, 04:53 PM
|
#11
|
LQ Newbie
Registered: Jul 2005
Location: Ireland
Distribution: Suse 9.3 Pro
Posts: 15
Original Poster
Rep:
|
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.
|
|
|
11-18-2013, 05:08 PM
|
#12
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
Quote:
Originally Posted by Magic02
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
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.
Last edited by suicidaleggroll; 11-18-2013 at 05:22 PM.
|
|
1 members found this post helpful.
|
11-18-2013, 07:23 PM
|
#14
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
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.
|
|
1 members found this post helpful.
|
11-18-2013, 07:32 PM
|
#15
|
Senior Member
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,954
|
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 10:37 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|