cp command Howto copy files from /home of one distro to another in a multiboot mach
Linux - NewbieThis 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.
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.
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?
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.
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.
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" ?
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?
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.