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 |
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 |
@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 |
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.
|
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 |
You need to use the -r (=recursive) flag with cp to copy directories.
|
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?
|
Quote:
/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" ? borgibo |
Quote:
|
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 |
In post #5 you already succeeded in mounting the partition:
Code:
mount /dev/sda5 /mnt/lenny Code:
ls /mnt/lenny |
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 |
All times are GMT -5. The time now is 08:23 AM. |