LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 05-23-2011, 12:05 PM   #1
Mark_in_Hollywood
Member
 
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 121

Rep: Reputation: 15
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?
 
Old 05-23-2011, 12:59 PM   #2
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,093

Rep: Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635
i usually just do cp -r /from /to to copy everything recursively. i dont think i've hit any problems...
 
Old 05-23-2011, 01:35 PM   #3
Mark_in_Hollywood
Member
 
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 121

Original Poster
Rep: Reputation: 15
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.
 
Old 05-23-2011, 02:00 PM   #4
yancek
Senior Member
 
Registered: Apr 2008
Distribution: PCLinux, Ubuntu, Slackware
Posts: 4,964

Rep: Reputation: 785Reputation: 785Reputation: 785Reputation: 785Reputation: 785Reputation: 785Reputation: 785
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.
Old 05-23-2011, 03:23 PM   #5
jefro
Guru
 
Registered: Mar 2008
Posts: 11,731

Rep: Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445
Type whoami to see what you are.
 
Old 05-23-2011, 06:13 PM   #6
Mark_in_Hollywood
Member
 
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 121

Original Poster
Rep: Reputation: 15
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
 
Old 05-23-2011, 07:24 PM   #7
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
Quote:
Originally Posted by Mark_in_Hollywood View Post
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.
 
Old 05-23-2011, 07:48 PM   #8
Mark_in_Hollywood
Member
 
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 121

Original Poster
Rep: Reputation: 15
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?
 
Old 05-23-2011, 08:36 PM   #9
yancek
Senior Member
 
Registered: Apr 2008
Distribution: PCLinux, Ubuntu, Slackware
Posts: 4,964

Rep: Reputation: 785Reputation: 785Reputation: 785Reputation: 785Reputation: 785Reputation: 785Reputation: 785
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.
 
Old 05-23-2011, 10:27 PM   #10
Larry Webb
LQ Veteran
 
Registered: Jul 2006
Location: Crystal Beach, Texas
Distribution: Suse for mail +
Posts: 5,100
Blog Entries: 7

Rep: Reputation: 229Reputation: 229Reputation: 229
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.
 
Old 05-24-2011, 10:18 AM   #11
Mark_in_Hollywood
Member
 
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 121

Original Poster
Rep: Reputation: 15
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.
 
Old 05-24-2011, 10:36 AM   #12
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,093

Rep: Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635
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.
 
Old 05-24-2011, 11:11 AM   #13
Mark_in_Hollywood
Member
 
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 121

Original Poster
Rep: Reputation: 15
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.
 
Old 05-24-2011, 11:26 AM   #14
hf2046
Member
 
Registered: Mar 2011
Distribution: Slack64
Posts: 109

Rep: Reputation: 20
Quote:
Originally Posted by Mark_in_Hollywood View Post
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.
 
Old 05-24-2011, 11:44 AM   #15
Mark_in_Hollywood
Member
 
Registered: Jan 2006
Location: USA
Distribution: Ubuntu - Precise Pangolin
Posts: 121

Original Poster
Rep: Reputation: 15
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.
 
  


Reply

Tags
/home, cp, links, permission


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
livecd-creator, kickstart files, adding files to /home directory. I.E. software dedicated livecd Bastian123 Fedora 2 03-13-2011 05:02 AM
[SOLVED] livecd and encrypted home linus.newbert Ubuntu 4 07-07-2010 10:55 PM
can I make a liveCD use HD's home folder? newbiesforever Linux - General 4 08-08-2009 10:48 PM
In LiveCD NOW & Formating Hard Disk Drive for Ubuntu Intrepid with /, /home, /usr/ Mark_in_Hollywood Linux - Newbie 2 11-17-2008 11:37 AM


All times are GMT -5. The time now is 02:48 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