LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 06-06-2009, 01:51 PM   #1
borgibo
Member
 
Registered: Aug 2007
Posts: 47

Rep: Reputation: 15
Unhappy cp command Howto copy files from /home of one distro to another in a multiboot mach


Hello,

I want to copy some files from Sidux, its "/" is installed in /dev/hda13" its "/home" in lvm, to Lenny, installed "/" in hda5 its "/home" in hda6, in a multiboot machine.

Those are very small files of some written documents.

I am lost as I cannot instruct cp to use another /dev . I try from Sidux where the files are: "cp /home/jv/x /dev/hda5/home/jv but get errors.

The files reside in Sidux's /home and must be copied to Lenny's /home.

Please instruct me if possible.

In the meantime I have copied them to a cd using k3b and will try to copy them over from the cd to Lenny's /home.

Thank you for your attention,

borgibo
 
Old 06-06-2009, 01:56 PM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
You have to mount the device to get access to its directory tree. Create a mount point or use an existing one if empty. For example:
Code:
# mkdir /mnt/lenny
# mount /dev/hda6 /mnt/lenny
# cp -p file_to_copy /mnt/lenny/path/to/dir/in/lenny/home/
 
Old 06-07-2009, 05:08 AM   #3
borgibo
Member
 
Registered: Aug 2007
Posts: 47

Original Poster
Rep: Reputation: 15
@colucix

I had made a mistake, Lenny's home is hda5 and / hda6, not the other way around.

So I tried first the wrong one and then the correct one and got the following: jv@siduxbox:~$ su
Password:
root@siduxbox:/home/jv# mkdir /mnt/Lenny
root@siduxbox:/home/jv# mkdir /mnt/lenny
root@siduxbox:/home/jv# mount /dev/hda6 /mnt/lenny
mount: special device /dev/hda6 does not exist
root@siduxbox:/home/jv# mount /dev/hda5 /mnt/lenny
mount: special device /dev/hda5 does not exist
root@siduxbox:/home/jv#

So it seems I am doing something wrong.

Thank you very much for your help. Waiting for more instructions?

borgibo
 
Old 06-07-2009, 05:13 AM   #4
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Well, it looks like /dev/hda5 and /dev/hda6 don't exist. Check the partition layout of the disk using fdisk -l as root and post the output so we can see it together.
 
Old 06-07-2009, 05:19 AM   #5
borgibo
Member
 
Registered: Aug 2007
Posts: 47

Original Poster
Rep: Reputation: 15
I tried sda5 instead of hda5 and got the following:jv@siduxbox:~$ su
Password:
root@siduxbox:/home/jv# mkdir /mnt/Lenny
root@siduxbox:/home/jv# mkdir /mnt/lenny
root@siduxbox:/home/jv# mount /dev/hda6 /mnt/lenny
mount: special device /dev/hda6 does not exist
root@siduxbox:/home/jv# mount /dev/hda5 /mnt/lenny
mount: special device /dev/hda5 does not exist
root@siduxbox:/home/jv# mkdir /mnt/lenny
mkdir: cannot create directory `/mnt/lenny': File exists
root@siduxbox:/home/jv# mount /dev/sda5 /mnt/lenny
root@siduxbox:/home/jv# cp -p /home/jv/Polski_κόκκινο/ /mnt/lenny/home/jv
cp: omitting directory `/home/jv/Polski_κόκκινο/'
root@siduxbox:/home/jv# cp -p /home/jv/Polski_κόκκινο/ /mnt/lenny/path/to/dir/in/lenny/home/
cp: omitting directory `/home/jv/Polski_κόκκινο/'
root@siduxbox:/home/jv#

hope that is of some help,

borgibo, thanks again
 
Old 06-07-2009, 05:52 AM   #6
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,569
Blog Entries: 1

Rep: Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026
You need to use the -r (=recursive) flag with cp to copy directories.
 
Old 06-07-2009, 06:03 AM   #7
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
As sycamorex said. Now you should know that /dev/sda5 is a valid partition, but have you checked if it is the lenny's home partition?
 
Old 06-07-2009, 06:18 AM   #8
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,569
Blog Entries: 1

Rep: Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026Reputation: 1026
Quote:
Originally Posted by colucix View Post
As sycamorex said. Now you should know that /dev/sda5 is a valid partition, but have you checked if it is the lenny's home partition?
IMO you should first identify all the partitions you've got on your computer. Check fdisk -l and then mount them one by one (apart from swap) and make sure you know what they contain, eg.

/dev/sda1 - fedora 10 /
/dev/sda2 - fedora 10 /home
/dev/sda3 - swap
/dev/sda5 - debian /
/dev/sda6 - debian /home
/dev/sda7 - slackware /boot
/dev/sda8 - slackware /
/dev/sda9 - slackware /home
/dev/sda10 - data partition
I always write it down in my little notepad and update it whenever I change something. Knowing your system/partition table will make things easier for you.
 
Old 06-08-2009, 01:47 AM   #9
borgibo
Member
 
Registered: Aug 2007
Posts: 47

Original Poster
Rep: Reputation: 15
I do keep a copy of Gparted printed where I note all the partitions.

re cycamorex: "You need to use the -r (=recursive) flag with cp to copy directories." should I use "r" instead of "p" in the command: " # mkdir /mnt/lenny
# mount /dev/hda6 /mnt/lenny
# cp -p file_to_copy /mnt/lenny/path/to/dir/in/lenny/home/" ?

Using the correct sda partitions: (jv is user, sda5=lennys's/home, sda6=lenny's/, /home/jv/Polski=path of Polski file residing in sidux( sda13=/ lvm=/home) to be transferred to lenny.:

I.e. # mkdir /mnt/lenny
# mount /dev/sda5 /mnt/lenny
# cp -r /home/jv/Polski /mnt/lenny/path/to/dir/in/lenny/home/

Or am I very wrong in the last lines ? Should rather be: "/mnt/lenny/home/jv" ?


borgibo
 
Old 06-08-2009, 02:50 AM   #10
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Quote:
Originally Posted by borgibo View Post
I.e. # mkdir /mnt/lenny
# mount /dev/sda5 /mnt/lenny
# cp -r /home/jv/Polski /mnt/lenny/path/to/dir/in/lenny/home/

Or am I very wrong in the last lines ? Should rather be: "/mnt/lenny/home/jv" ?
Of course. Since I didn't know what is the exact path, I put something dummy to be substituted with the actual path. It should be ok now, with recursive option, right?
 
Old 06-08-2009, 04:51 AM   #11
borgibo
Member
 
Registered: Aug 2007
Posts: 47

Original Poster
Rep: Reputation: 15
I have tried without success. This is what I got:

jv@siduxbox:~$ su
Password:
root@siduxbox:/home/jv# mkdir /mnt/lenny
root@siduxbox:/home/jv# mount /sda5/mnt /mnt/lenny
mount: special device /sda5/mnt does not exist
root@siduxbox:/home/jv# mount /sda5 mnt/lenny
mount: mount point mnt/lenny does not exist
root@siduxbox:/home/jv# mount /sda5
mount: can't find /sda5 in /etc/fstab or /etc/mtab
root@siduxbox:/home/jv#

It seems I am unlucky.

I will try to copy the files using the cd that I burned with them, have not done it before, I think I will manage, using k3b.
Another way I tried was using knoppix live cd but unfortunately the files are in a lvm partition which knoppix does not recognize.


thank you everybody.

borgibo
 
Old 06-08-2009, 07:20 AM   #12
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
In post #5 you already succeeded in mounting the partition:
Code:
mount /dev/sda5 /mnt/lenny
what is the problem now? What is the output of
Code:
ls /mnt/lenny
after mounting it?
 
Old 06-08-2009, 08:39 AM   #13
borgibo
Member
 
Registered: Aug 2007
Posts: 47

Original Poster
Rep: Reputation: 15
Well I am sorry colucix, things are very confusing for me. I tried again and this time I got a step further then post 11.:
jv@siduxbox:~$ su
Password:
root@siduxbox:/home/jv# mkdir /mnt/lenny
mkdir: cannot create directory `/mnt/lenny': File exists
root@siduxbox:/home/jv# mount /dev/sda5 /mnt/lenny
mount: /dev/sda5 already mounted or /mnt/lenny busy
mount: according to mtab, /dev/sda5 is already mounted on /mnt/lenny
root@siduxbox:/home/jv# cp -r /home/jv/Polski_κόκκινο/ /mnt/lenny/home/jv
cp: cannot create directory `/mnt/lenny/home/jv': No such file or directory
root@siduxbox:/home/jv#

I am amazed with such inconsistency, I mean between post's #11 line "root@siduxbox:/home/jv# mount /sda5 mnt/lenny
mount: mount point mnt/lenny does not exist" and the present one's "root@siduxbox:/home/jv# mount /dev/sda5 /mnt/lenny
mount: /dev/sda5 already mounted or /mnt/lenny busy "

And you are right that in post #5 I managed better than in #11.

Which means that I now get stuck further down the line !

Anyway just to keep me and probably you also happy, I have managed to copy the files in Lenny's /home/jv using the cd I had burned with them. Extremely easy, I could not believe my eyes. The files emerged in the desktop as soon as I put the cd in, while in Lenny, complete as they were in sidux and I copied and pasted them in /home/jv. That sounds silly but for me it is unbelievable ! I even opened them and checked them !!!!

Of course I wish I could have done it as you suggested but my lack of knowledge is to blame for the inconsistencies and mistakes I presume.

Thanks a lot,

have a nice time,

borgibo
 
  


Reply

Tags
cp, files


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
in copy files or ls files the command want to invert select some files how to?? hocheetiong Linux - Newbie 3 06-27-2008 06:32 AM
How to find files and copy the found files to the floppy in one command justmehere Linux - Newbie 11 05-04-2008 11:29 PM
Command to copy files/folders but skip bad/corrupt files?? leemoreau Linux - Newbie 2 04-02-2007 02:27 PM
howto execute for loop on remote mach using shell script dsids Linux - Newbie 1 08-22-2006 03:07 AM
basic q. how to copy files over home (peer) network JacekZ Linux - Networking 6 07-17-2006 06:08 PM


All times are GMT -5. The time now is 09:46 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration