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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
05-23-2011, 12:05 PM
|
#1
|
|
Member
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 120
Rep:
|
I'm in LiveCD - Need help using cp and preserving all that is in my /home
I'm in a LiveCD session (Natty). I must copy my /home to an external hard drive (via USB).
I tried gksudo nautilus, but it cannot copy some files and/or directories due to file permissions.
I have a folder in /home named: .evolution. I believe this is where all the emails are stored. Is there a way, from the command line, to use
cp to copy all permissions, links - symbolic and/or hard, and all that is necessary to copy all of /home so that cp doesn't leave something out, change it or move it so it's a problem or useless? Also, is the reverse copy the exact set of commands, or after copying it all, do I only need to reverse the order of the devices-media? My /home is in it's own partition.
I was thinking of:
cp -ablpr /media/original-home /media/usb-hard-drive/
anybody ever done this and got it to work?
|
|
|
|
05-23-2011, 12:59 PM
|
#2
|
|
Senior Member
Registered: May 2005
Location: boston, usa
Distribution: fc-12/ fc-11-live-usb/ aix
Posts: 2,674
|
i usually just do cp -r /from /to to copy everything recursively. i dont think i've hit any problems...
|
|
|
|
05-23-2011, 01:35 PM
|
#3
|
|
Member
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 120
Original Poster
Rep:
|
I'm seeing permission errors. I'm in LiveCD (Natty) and cannot sudo. The cp won't handle .evolution, .libreoffice and all the very things I'm trying to save.
|
|
|
|
05-23-2011, 02:00 PM
|
#4
|
|
Senior Member
Registered: Apr 2008
Distribution: PCLinux, Ubuntu, Peppermint
Posts: 3,399
|
Quote:
|
I'm in LiveCD (Natty) and cannot sudo
|
Why not? Do you get some type of error message? Should be no reason why you could not use sudo from a Live CD.
As far as the copying, what I did when I had to copy an Ubuntu partition from sda1 to sdc5 is first create the mount point, mounted both partitions (sda1 ro) and ran this command:
sudo cp -a -x /mnt/sda1/* /mnt/sdc5
Meaning of options can be found here: http://www.computerhope.com/unix/ucp.htm
|
|
|
0 members found this post helpful.
|
05-23-2011, 03:23 PM
|
#5
|
|
Guru
Registered: Mar 2008
Posts: 8,561
|
Type whoami to see what you are.
|
|
|
|
05-23-2011, 06:13 PM
|
#6
|
|
Member
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 120
Original Poster
Rep:
|
Doing:
gksudo nautilus
brings up the 'root' file manager but no ability to control (mount, copy, delete) the /dev/sda and /dev/sdb
Please know that I am in a LiveCD session (Natty).
Using
cp /dev/sda5 /dev/usb/bu
the terminal says:
ubuntu@ubuntu:/dev$ cp /dev/sda5 /dev/usb/bu
cp: cannot open `/dev/sda5' for reading: Permission denied
|
|
|
|
05-23-2011, 07:24 PM
|
#7
|
|
LQ Veteran
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
|
Quote:
Originally Posted by Mark_in_Hollywood
Doing:
gksudo nautilus
brings up the 'root' file manager but no ability to control (mount, copy, delete) the /dev/sda and /dev/sdb
Please know that I am in a LiveCD session (Natty).
Using
cp /dev/sda5 /dev/usb/bu
the terminal says:
ubuntu@ubuntu:/dev$ cp /dev/sda5 /dev/usb/bu
cp: cannot open `/dev/sda5' for reading: Permission denied
|
yancek told you to mount the /dev before trying to copy.
Use fdisk -l command to find the dev number of your usb
sudo mkdir /mnt/doc
sudo mount /dev/sda5 /mnt/doc
sda5 is now mounted
sudo mkdir /mnt/usb
sudo mount /dev/sdxx /mnt/usb (xx use the correct dev numbers from your fdisk -l)
usb is now mounted
I do not know if you want to copy the sda5 partition or just a couple of files.
This is a simple copy 'cp /mnt/doc /mnt/usb'
I hope this will get you started down the right path.
Last edited by Larry Webb; 05-23-2011 at 07:29 PM.
|
|
|
|
05-23-2011, 07:48 PM
|
#8
|
|
Member
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 120
Original Poster
Rep:
|
Thanks, Larry.
If I'm understanding you
ubuntu@ubuntu:~$ sudo fdisk -l
Disk /dev/sda: 400.1 GB, 400088457216 bytes
255 heads, 63 sectors/track, 48641 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf3e1e104
Device Boot Start End Blocks Id System
/dev/sda1 1 13 102400 7 HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2 13 8937 71680000 7 HPFS/NTFS
/dev/sda3 * 8938 10842 15301912+ 83 Linux
/dev/sda4 10843 48641 303620437 5 Extended
/dev/sda5 10843 47583 295122051 83 Linux
/dev/sda6 47584 48641 8498353+ 82 Linux swap / Solaris
Disk /dev/sdb: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x511bee84
Device Boot Start End Blocks Id System
/dev/sdb1 1 38914 312568832 7 HPFS/NTFS
so, after the mounting commands I can:
cp -adlpr /dev/sda5 /dev/sdb1
which will preserve as much as possible from /sda1?
|
|
|
|
05-23-2011, 08:36 PM
|
#9
|
|
Senior Member
Registered: Apr 2008
Distribution: PCLinux, Ubuntu, Peppermint
Posts: 3,399
|
Your usb is probably mounted already in the /media directory. Did you check that?
Also need to prefix the cp command with sudo and copy from the mount point to the other mount point.
If you use the suggestion of Larry Webb, do sudo cp -adlpr /mnt/doc/* /mnt/usb
The forward slash and asterisk should be added to get all contents.
|
|
|
|
05-23-2011, 10:27 PM
|
#10
|
|
LQ Veteran
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
|
You can not copy a /dev, you can copy the information on the dev. That is the reason to make a directory to copy and move the information and mount it to the /dev location. If you want to copy all the files on sda5 to your usb you will need to use the following.
sudo mkdir /mnt/doc (the name doc can be any name you wish but keep it simple)
sudo mount /dev/sda5 /mnt/doc
sudo mkdir /mnt/usb (usb can be any name except doc or the other dir name)
sudo mount /dev/sdb1 /mnt/usb
sudo cp -adlpr /mnt/doc/* /mnt/usb (the /* is for all files in sda5.)
Now if you only want to copy your Pictures from sda5 then you would have to specify that location in the mount location.
Last edited by Larry Webb; 05-23-2011 at 10:30 PM.
|
|
|
|
05-24-2011, 10:18 AM
|
#11
|
|
Member
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 120
Original Poster
Rep:
|
I thought I had this knocked with:
sudo mkdir /mnt/doc
sudo mount /dev/sda5 /mnt/doc
sudo mkdir /mnt/usbex
sudo mount /dev/sdb1 /mnt/usbex
sudo cp -adlpr /mnt/doc/* /mnt/usbex
this string didn't make a folder on the external (usb) hard drive. And the terminal spun out nothing but lines like this:
cp: cannot create link `/mnt/usbex/mark/Food & Foodways/Mexico/México Desconocido Las haciendas pulqueras, ruta cultural de gran atractivo._files/redes_btn6_off.png': Invalid cross-device link
cp: cannot create link `/mnt/usbex/mark/Food & Foodways/Mexico/México Desconocido Las haciendas pulqueras, ruta cultural de gran atractivo._files/footer_logo_iasa.png': Invalid cross-device link
I apologize for not making myself clear, but I'm not literate at geek-speak. I also wanted to keep this question as simple as possible, but I now believe that to be a big mistake.
I had Ubuntu Natty on my 'puter. I'm not using Unity. I tried to install Evolution 3. I didn't understand that I had to install Gnome 3 before that. Those acts "blew up" my OS. I cannot get past the log-in screen. The 'puter hangs.
I am trying to make a copy of the /home and nothing more. I have / and /home on separate partitions. If cloning the /sda5 will copy the symlinks, timestamps, permissions, groups, etc., I would prefer to do that ... I'm looking for the easiest way to do this. I'm not chary of using the command line. My plan is to clone/copy/backup my /home, re-install Natty and only if necessary, clone/copy/restore the /home.
|
|
|
|
05-24-2011, 10:36 AM
|
#12
|
|
Senior Member
Registered: May 2005
Location: boston, usa
Distribution: fc-12/ fc-11-live-usb/ aix
Posts: 2,674
|
hi mark, lets start from the beginning.
please plug in all drives that you want to copy from/ to and run and show us the output of: df -h
since it seems like you wanna' just copy a few directorys you can just copy from the directory where the device nodes are mounted like this: sudo cp -r /media/your-usb-name/home/your-user/.evolution /whatever/floats/your/boat.
(you can backup an image of the whole drive by duplicating the device nodes like: dd if=/dev/sdxy of=sdxy.iso
but that doesnt seem to be what you want.)
Last edited by schneidz; 05-24-2011 at 10:40 AM.
|
|
|
|
05-24-2011, 11:11 AM
|
#13
|
|
Member
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 120
Original Poster
Rep:
|
1st -
ubuntu@ubuntu:/$ df -h
Filesystem Size Used Avail Use% Mounted on
aufs 1006M 112M 895M 12% /
none 1000M 768K 999M 1% /dev
/dev/sr0 686M 686M 0 100% /cdrom
/dev/loop0 658M 658M 0 100% /rofs
none 1006M 276K 1006M 1% /dev/shm
tmpfs 1006M 64K 1006M 1% /tmp
none 1006M 108K 1006M 1% /var/run
none 1006M 4.0K 1006M 1% /var/lock
/dev/sda5 278G 36G 228G 14% /mnt/doc
/dev/sdb1 947M 625M 275M 70% /mnt/usbex
/dev/sde1 299G 158G 141G 53% /media/TV - this is the external USB hard drive.
/dev/sda5 is where my /home is.
/dev/sde1 is where I want to put the "copy" of /home is going.
My /home is about 40 gig-a-bytes.
I am not particular in how I get a "copy" of /home. I wish-desire-prefer to copy ALL file and directory attributes, such as permission, timestamps, symlinks, etc. to the "copy". Lacking that a copy is better than nothing, should I further damage my /home on re-installation of Natty. Seeing the output of df -h reminds me I cannot clone /sda5 to sde1 as it isn't nearly big enough to house 275 gig.
|
|
|
|
05-24-2011, 11:26 AM
|
#14
|
|
Member
Registered: Mar 2011
Distribution: Slack64
Posts: 107
Rep:
|
Quote:
Originally Posted by Mark_in_Hollywood
I am not particular in how I get a "copy" of /home. I wish-desire-prefer to copy ALL file and directory attributes, such as permission, timestamps, symlinks, etc. to the "copy".
|
I'm not sure cp will do all that. You might want to look at using tar in order to archive your /home directory.
|
|
|
|
05-24-2011, 11:44 AM
|
#15
|
|
Member
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 120
Original Poster
Rep:
|
I am now reading up on tar. Please don't forget this poster. I may be gone for a day or two, while I learn enough of tar to ask intelligent questions, if needs be. Thanks, linux community.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:07 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|