LinuxQuestions.org
Help answer threads with 0 replies.
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 04-28-2009, 12:45 AM   #1
joseph2020
Member
 
Registered: Mar 2009
Location: USA
Distribution: Ubuntu 12.04
Posts: 235

Rep: Reputation: Disabled
I can't copy from drive x to drive Y?


This is starting to get so old...I can't do the simplest thing without asking how.

OK, this time its a simple copy from one hard drive (sda1) to another hard drive (sdb1) in the same Linux box. Easy in windows...a simple copy and paste op. I tried that with Nautilus...not even close. Is there a better file manager?

I know how to use cp:
Code:
cp /etc/fstab  home/joe/mydir
would copy fstab to dir mydir. I should be able to enter:

Code:
cp /etc/fstab  sdb1/mydir
would copy fstab to drive sdb1/mydir. I was dreaming, it won't even try. Where am I going wrong? How can I copy a file or directory from one disk drive to another?

I can't seem to figure anything out in Linux, so please assume I know nothing and please keep it ultra simple so I can understand.

Any help is appreciated. Thanks in advance.
 
Old 04-28-2009, 12:55 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You need to mount sdb1 somewhere and then copy. E.g.

Mount the FAT partition /dev/sdb1 on /mnt/tmp:
# mount -t vfat /dev/sdb1 /mnt/tmp

Copy the file named "file" in /home/foo to the mounted partition:
# cp /home/foo/file /mnt/tmp
 
Old 04-28-2009, 12:58 AM   #3
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Hi Joseph,
Have you mounted the /dev/sdb1 drive? It seems not. You need to do something like this:
Code:
sudo mount /dev/sd1 /mnt/mydir
then your copy command would go like this:
Code:
cp /etc/fstab  /mnt/mydir
cheers,
jdk
 
Old 04-28-2009, 02:36 AM   #4
joseph2020
Member
 
Registered: Mar 2009
Location: USA
Distribution: Ubuntu 12.04
Posts: 235

Original Poster
Rep: Reputation: Disabled
nothing is easy

Thank you for your replies, jdkaye and Nylex

drive sdb1 is mounted with fstab:

Code:
/dev/sdb1   /media/backdrive  ext2  defaults    0  0
It shows as mounted on desktop and with all the apps, but I canoot add or delete files.

I will try your suggestions, thanks again
 
Old 04-28-2009, 06:10 AM   #5
ozminh
Member
 
Registered: Aug 2007
Posts: 73

Rep: Reputation: 19
'/dev/sdb1 /media/backdrive ext2 defaults 0 0'

you should 'cp source /media/backdrive/..' instead of 'cp source /dev/sdb1/..'

Last edited by ozminh; 04-30-2009 at 03:45 AM.
 
Old 04-28-2009, 06:27 AM   #6
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Note also the use of a leading "/".

If I enter "cp foo home/bar", cp looks for home/bar in the current ditectory. What you probably want is "cp foo /home/bar", which tells cp to copy to home/bar in the root directory (ie, /home/bar rather than current_directory/home/bar). These are only the same thing if the current working directory is /
 
Old 04-28-2009, 08:52 AM   #7
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,627

Rep: Reputation: 471Reputation: 471Reputation: 471Reputation: 471Reputation: 471
joseph2020:

Copying file from one drive to another is easy in Linux, as long as both drives or partitions are mounted.

Now, they are mounted but you cannot "write" files? Chances are: either you mistyped something in the syntax or that you have no permission on either of the drives.

Note: Once the drive is already mounted you must use the mount point in the syntax:
E.g. "cp /home/myname/myfile.txt /mnt/mymountpoint"
but not "cp file /home/myname /dev/sda2/mymountpoint"

About permissions you may also read and understand commands like "chmod", "chown" and their switches. Below is a link to a tutorial on Gnu/Linux you will profit much by reading it. It will not take too much of your time, but once you understand how Gnu/Linux works things will become easier for you to handle.

Also note that in Linux running as "root" is discouraged, so you have to learn the ways how to become root when needed.

hope it helps.

goodluck

Last edited by malekmustaq; 04-28-2009 at 08:53 AM.
 
Old 04-28-2009, 11:35 PM   #8
joseph2020
Member
 
Registered: Mar 2009
Location: USA
Distribution: Ubuntu 12.04
Posts: 235

Original Poster
Rep: Reputation: Disabled
malekmustaq, billymayday, ozminh:

Thank you all for your helpful responses.

malekmustaq
Quote:
once you understand how Gnu/Linux works things will become easier for you to handle.
Thank you for that link, and I will be looking at it. "easier" sounds really good.
Quote:
you have to learn the ways how to become root when needed.
From the little I know, in Ubuntu you are a "normal" user unless you choose the "root console" from applications > system tools. I normally use "sudo" at the "normal" console unless I am planning on a lot of root commands. I don't know of any way to login as "root".

billymayday
Quote:
Note also the use of a leading "/".
Thank You!...from what I have read that's called "absolute (/)" or "relative" paths. I almost always use absolute paths to be safe for now, even though it means more typing.

ozminh
Quote:
you should 'cp source /media/backdrive/..' instead of 'cp source /media/sdb1/..'
Fantastic suggestion, thank You!!!

I will be trying your suggestions very soon...Thanks again to all.
 
Old 04-29-2009, 12:22 AM   #9
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
I always recommend creating such mountpoints in one's home directory, makes things a bit more manageable. You may still need to grant yourself write permissions, though, the first time a newly added partition is mounted (sudo chown -R $USER:$USER mountpoint).

Last edited by jay73; 04-29-2009 at 03:20 AM.
 
Old 04-29-2009, 01:39 AM   #10
joseph2020
Member
 
Registered: Mar 2009
Location: USA
Distribution: Ubuntu 12.04
Posts: 235

Original Poster
Rep: Reputation: Disabled
ozminh

My backup is now safe in the "other" drive after following your suggestion...Thanks again!


jay73

Thanks again for your reply!
 
Old 04-29-2009, 10:59 PM   #11
joseph2020
Member
 
Registered: Mar 2009
Location: USA
Distribution: Ubuntu 12.04
Posts: 235

Original Poster
Rep: Reputation: Disabled
why won't nautilus let me do easy operations?

In Nautilus I can't copy, cut, rename, move to trash, delete, or paste to the second drive (backdrive). I can do all this from the console. For Example to copy a file from Desktop to second drive I use:

Code:
cp /home/joe/Desktop/filex /media/backdrive/
to delete:

Code:
rm /media/backdrive/filex
ans so on. I think, this tells me I have permissions on the files, So why can't I do this in Nautilus?

Thanks in advance.
 
Old 04-29-2009, 11:16 PM   #12
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Quote:
Originally Posted by joseph2020 View Post
In Nautilus I can't copy, cut, rename, move to trash, delete, or paste to the second drive (backdrive). I can do all this from the console. For Example to copy a file from Desktop to second drive I use:

Code:
cp /home/joe/Desktop/filex /media/backdrive/
to delete:

Code:
rm /media/backdrive/filex
ans so on. I think, this tells me I have permissions on the files, So why can't I do this in Nautilus?

Thanks in advance.
A simple way to find out is to use Nautilus and right-click on a file you can't delete. A menu will appear and you select "Properties". You should see some tabs appear in a window that opens and select "Permissions".
What are the permissions set for? Owner? Group? Others? The window will also tell you who owns the file. You should be able to figure out what's wrong from that information. If you still don't understand report back the information that Nautilus gives you regarding permissions and ownership of the file in question.
Cheers,
jdk
 
Old 04-29-2009, 11:32 PM   #13
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
sudo chown -R $USER:$USER /media/backdrive/filex
 
Old 04-30-2009, 12:40 AM   #14
joseph2020
Member
 
Registered: Mar 2009
Location: USA
Distribution: Ubuntu 12.04
Posts: 235

Original Poster
Rep: Reputation: Disabled
Arrow

jdkaye:

Thank you for your response, heres a copy of the Permissions tab


Quote:
Owner root
Access Read and write

Group: root
Access: Read-only

Others
Access: Read-only

----------------------------------------
You are not the owner, so you
cannot change these permissions
----------------------------------------

I am the person who installed Ubuntu and the only user, also the person who made this file (it's a .tar file)... but I am not the owner?? huh?

thanks again
 
Old 04-30-2009, 12:49 AM   #15
joseph2020
Member
 
Registered: Mar 2009
Location: USA
Distribution: Ubuntu 12.04
Posts: 235

Original Poster
Rep: Reputation: Disabled
Jay73:

thanks for reply.

I need to know what that code does before I can type it in, especially using "sudo"

Code:
sudo chown -R $USER:$USER /media/backdrive/filex
Please explain step by step what this does. Thanks again.
 
  


Reply


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
using dd to copy 512M drive to 1GB drive DavidHB Linux - Hardware 1 12-12-2006 11:34 AM
Easiest way to copy a boot drive to a new hard drive lsgko Linux - Software 3 05-24-2005 09:38 PM
CD-R Drive to CD-RW Drive Direct Copy CooManChu Linux - Hardware 25 01-08-2005 10:55 AM
How to copy ext2fs from failed hard drive to good drive? DogWalker Linux - Hardware 2 08-30-2004 10:52 PM
Cannot Copy Files From Network FAT32/NTFS Drive to My Local Linux Drive michaelh Linux - Networking 3 10-29-2002 10:27 AM


All times are GMT -5. The time now is 09:07 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration