LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 07-30-2011, 09:40 AM   #1
zeelog
Member
 
Registered: Jan 2008
Posts: 139

Rep: Reputation: 1
copying files from one external USB hard drive to another


I have two USB 2 external hard drives. I want to copy about
30 gigs of data from one to another. What command line command
do I use ? I was thinking of using cp with the -R and -n options,
but I have no idea what devices to refer to. I can't find
any external hard drives in /etc/fstab and I'm not sure what
/dev device each USB external hard drive uses.
I just want to copy the files and the directories that they are
in just as they are. There are no links and I do not want
to do a backup. Any suggestions would be welcome.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 07-30-2011, 10:15 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
My old favourite is rsync, the drives are probably mounted under /media.

Example:

Quote:
rsync -av /media/<disk1>/ /media/<disk2>/
Note that the trailing slash on the source is important, it indicates that you want the content of the last directory in the path, if you leave the slash off you'll get the directory as well

Source-no-slash example:
Code:
rsync -av /tmp/dir1 /tmp/dir2
result:
Code:
/tmp/dir2/dir1/<content of dir1>

Last edited by kbp; 07-30-2011 at 10:17 AM.
 
1 members found this post helpful.
Old 07-30-2011, 12:19 PM   #3
mesiol
Member
 
Registered: Nov 2008
Location: Lower Saxony, Germany
Distribution: CentOS, RHEL, Solaris 10, AIX, HP-UX
Posts: 731

Rep: Reputation: 137Reputation: 137
rsync is not the fastest from my experience. For first time copy i mostly use cp command, which is much more faster, later for synchronization i use rsync.
 
1 members found this post helpful.
Old 07-30-2011, 12:32 PM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
plug in both drives and show us the output of df -h

fedora automatically opens a file navigator whenever a drive/ cd is inserted.

if you want a byte-for-byte copy, mite i suggest dd. e.g:
Code:
dd if=/dev/sda of=/dev/sdb
 
1 members found this post helpful.
Old 07-30-2011, 12:46 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,978

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
use mount to see what is connected before you begin.

I might suggest you stay away from dd just now. It is a bit like a nuclear weapon. One small mistake and boom.


Might see if mc or midnight commander is installed. Would help if you told us the distro.
 
2 members found this post helpful.
Old 08-02-2011, 08:46 AM   #6
zeelog
Member
 
Registered: Jan 2008
Posts: 139

Original Poster
Rep: Reputation: 1
copying files from one external USB hard drive to another

When I do the mount command I get:
/dev/sdd1 on /media/Expansion Drive type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
/dev/sdb1 on /media/Expansion Drive type fuseblk
(rw,nosuid,nodev,allow_other,blksize=4096)

I can't see any reference to these external hard
drives in /etc/fstab
The directory /media has two identical /media/External Drive
I can't see any easy way to identify one of these external drives
from the other under /media
The system is my old basement computer running Fedora 10
kernel 2.6.27 i686 Gnome 2.24.3 /01/16/2009 USB 2
I keep it off the internet and run my important stuff on it.

Last edited by zeelog; 08-02-2011 at 08:47 AM.
 
Old 08-02-2011, 03:06 PM   #7
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
^ seems weird that it seems to be mounting both drives in the same directory.

not really sure what you are doing but it mite be easier to do this by hand.
Code:
sudo umount /dev/sdb1 /dev/sdd1
mkdir hd1 hd2
sudo mount /dev/sdb1 hd1
sudo mount /dev/sdd1 hd2
then navigate thru those directories to find out which one is which (since they are your drives, only you know what data is in each).

they wouldnt be in /etc/fstab unless you put them in there because you want them mounted every time you start your machine.

did you mean to say one is mounted on /media/Expansion Drive and the other is mounted on /media/External Drive ?; keep in mind that copy-and-paste is the easiest way for us to understand what is going on. (your descriptions are helpful but a screenprint would paint 1,000 words).

Last edited by schneidz; 08-02-2011 at 03:09 PM.
 
Old 08-02-2011, 06:01 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Also, try
Code:
cat /etc/mnttab
This shows what is actually currently mounted, as opposed to /etc/fstab, which show what you asked to be mounted at boot time
 
Old 08-02-2011, 06:20 PM   #9
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by chrism01 View Post
Also, try
Code:
cat /etc/mnttab
This shows what is actually currently mounted, as opposed to /etc/fstab, which show what you asked to be mounted at boot time
Shouldn't that be
Code:
cat /etc/mtab
 
Old 08-02-2011, 07:27 PM   #10
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
If you can't tell the difference between the drives then it's probably better to label them. Remove both then plug in one and see which drive it is, if it mounts automatically then unmount it. If its an ext based filesystem use e2label, then remove it, plug in the next drive and repeat.

Then with both plugged in you should have /media/<drive1label> and /media/<drive2label>

cheers
 
Old 08-02-2011, 08:22 PM   #11
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,698

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
When a USB drive is plugged in it will be automatically mounted (if so configured) to /media/disk_label or /media/disk-x if no label. No fstab line is required. So it seems that if the drives have the same label then they will be mounted at the same mount point.

You can try changing one of the drives labels or as suggested manually mount them. If manually mounted you can create a directory with a unique name. Then you will easily know which drive is the source and which is the destination.

https://help.ubuntu.com/community/Mount/USB
 
  


Reply

Tags
copying, usb disk



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
Booting Linux on an external USB hard drive (not a memory stick, a hard drive) comcastuser Linux - Hardware 4 01-13-2010 06:59 PM
Transferring/copying files to an external USB hard drive rasupi Linux - Newbie 1 12-17-2008 03:04 AM
Copying files from internal Hard drive to USB 2.0 Hard Drive is NOT Behaving tubatodd Ubuntu 4 02-19-2007 04:32 PM
DD issues, copying hard drive to external satanspetcat Linux - General 2 06-13-2006 03:23 PM
external enclosure for an internal hard drive vs external USB hard drive powah Linux - Hardware 1 03-10-2006 09:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration