LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 04-29-2006, 01:17 PM   #1
Eternal_Newbie
Member
 
Registered: Jun 2005
Location: The Pudding Isles
Distribution: Slackware 13.37
Posts: 573

Rep: Reputation: 58
Question Copying /home - use dd or cp ? SOLVED


I want to copy my /home partition over to a new disc as I am running short of space.

The existing /home is on /dev/hdb2 ,is Rieser3 and the new one will probably be on /dev/sda5 and Reiser3

I am unsure whether to use cp or dd to do this . Most of what I have read seems indicate dd is better for this sort of task, but I am still unsure what command switches/options I should use.

I think that this would work for cp:
boot using Slax
mount existing partition as /mnt/hdb2
mount new (formatted) partition as /mnt/sda5
cp -dpR /mnt/hdb2/ /mnt/sda5/

I have no idea how use dd - the options confuse me. I do know that I want to copy the contents of the partition, not the actual partition, if possible.


I assume changing the fstab entry to point at /dev/sda5 is enough or does anything else need changing

Last edited by Eternal_Newbie; 11-26-2006 at 12:21 PM.
 
Old 04-29-2006, 01:21 PM   #2
Speek
Member
 
Registered: Sep 2003
Distribution: Slackware
Posts: 100

Rep: Reputation: 29
I'va once copied an entire Slackware system from one partition to another with "cp -a" and everything was fine. So I recommend "cp -a".
 
Old 04-29-2006, 01:22 PM   #3
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 54
I think dd is better suited for making exact images of stuff that shouldn't be moved. When you're copying files and directories, cp is fine.

The other thing you could do is to tar home and untar it in the new partition. That way you would also have a backup.
 
Old 04-29-2006, 01:26 PM   #4
Eternal_Newbie
Member
 
Registered: Jun 2005
Location: The Pudding Isles
Distribution: Slackware 13.37
Posts: 573

Original Poster
Rep: Reputation: 58
Thanks for your answers

I try this as soon as World Community Grid has finished it's latest unit.
 
Old 04-29-2006, 03:09 PM   #5
Pollyanna
Member
 
Registered: Oct 2003
Location: Germany
Distribution: Slackware 10.2, SuSE 10.0, Solaris(SPARC) 9+Solaris(x86) 9, NetBSD(sparc) 2.0.2
Posts: 43

Rep: Reputation: 15
Cool tar!

Hello,

my personal favorite for doing this is "tar":

(cd /home_old; tar cf - .)|(cd /home_new; tar pxvf -)

It does the same thing as "cp -a":
* preserves mode, ownership, timestamp
* copys symolic links as links
* includes subdirectories and hidden files

Please pay close attention to the ownership of files and directories, because it is preserved as *numerical* value (=UID). In your case this doesen't seem to be a problem, but if you transfer partitions between different Systems, on the same machine, or even on different machines, this is will sureley get in your way.
Trust me. 8-(


Hopefully helpfull

Pollyanna
 
Old 04-29-2006, 03:23 PM   #6
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 54
The only thing I would add is that when making a tar and if space is at a premium, use bzip2 compression (j switch). For less compression and faster processing, use gzip (z switch)
 
Old 04-29-2006, 03:54 PM   #7
Pollyanna
Member
 
Registered: Oct 2003
Location: Germany
Distribution: Slackware 10.2, SuSE 10.0, Solaris(SPARC) 9+Solaris(x86) 9, NetBSD(sparc) 2.0.2
Posts: 43

Rep: Reputation: 15
Thumbs down compression?

Hi,

well I think under this circumstances, transfering the contents of one directory to another directory on the same machine, compression is not only unnecessary but obstructive.
The only thing it does is to compress bits (slow), move them from harddisk to harddisk (fast) (or partition to partition, fast too) and then decompress bits (slow). If you get rid of compression here there is only one fast step left. 8-)

When it comes to archiving data, compression is a must! Well, mostly a must. ;-)


Hopefully clarifing

Pollyanna
 
Old 04-29-2006, 06:38 PM   #8
Eternal_Newbie
Member
 
Registered: Jun 2005
Location: The Pudding Isles
Distribution: Slackware 13.37
Posts: 573

Original Poster
Rep: Reputation: 58
Smile Up and running, thanks for the help :)

Thanks for all the advice everyone

I am now posting from my spacious new /home

In the end I decided to go with cp -a /mnt/hdb2/*.* /mnt/sda8 (not sure why I've got so many partitions on this disk). Everything seems OK.

Next time I will try using tar
 
Old 04-29-2006, 07:16 PM   #9
Pollyanna
Member
 
Registered: Oct 2003
Location: Germany
Distribution: Slackware 10.2, SuSE 10.0, Solaris(SPARC) 9+Solaris(x86) 9, NetBSD(sparc) 2.0.2
Posts: 43

Rep: Reputation: 15
Wink hounted by microsoft

Hi

while this is Your life and You do as You please, there is one thing I want to tell. ;-)

In Linux and Unix as a whole, there are no such beasts as "extensions" in filenames. The dot is simply a part of the filename.
Take a look at /etc/rc.d/ and at the files therein. "rc.inet1" has its "filetype" at the beginning! (It is a "rc-script".) And what about "/etc/ssh/ssh_conf"? Look Ma, no extension! ;-)
"ls *.*" is very different from "ls *" which is what you actually meant.

"*.*" means "all things with names containing a dot", while "*" means "all things, with a name at all". Try it for yourself and please be sure that really all files have been transferred!

And the partitions can be checked with "fdisk -l" (as root) or, even much nicer, with "parted" (also root required) which shows the filesystems on the partitions too.


Yours

Pollyanna
 
Old 04-29-2006, 08:19 PM   #10
Eternal_Newbie
Member
 
Registered: Jun 2005
Location: The Pudding Isles
Distribution: Slackware 13.37
Posts: 573

Original Poster
Rep: Reputation: 58
thanks for the warning - the curse of m$ strikes again

As far as I can tell I did copy everything. I just made typo in the post thankfully

I will triple check everything, though - just in case.
 
Old 04-30-2006, 08:50 AM   #11
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,724

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
cp -avx /home /new/path
is the easiest and cleanest to move or copy something.
 
Old 05-01-2006, 07:51 AM   #12
ArmOrAttAk
Member
 
Registered: May 2005
Location: NYC
Distribution: Slackware, Gentoo
Posts: 30

Rep: Reputation: 15
I was trying to do this with dd and cp one day. The target and source directories didn't have the same number of files or innode count or something when i did ls -a. rsync is what i ended up using.
 
Old 05-01-2006, 12:10 PM   #13
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,724

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
cp won't copy hidden files unless you use the -a option, which also preserves all permissions and ownership of the files if possible.
cp -av is what the Slackware ZipSlack HOWTO recommends for 'migrating' your installation to a linux partition. Works fine if you don't need any compression during transfer.
 
  


Reply

Tags
cp, dd, important


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
win xp home edition and samba home shares scheidel21 Linux - Software 8 10-09-2008 12:47 AM
Apache Root/Home Directory and setting up FTP for home directories? Mankind75 Linux - Newbie 6 07-23-2006 02:37 PM
copying files from my home directory to my USB Flash Disk neo_phyte Red Hat 9 04-24-2006 12:32 AM
want to ssh/ftp to home machine (Slack) from office through home router fincher69 Linux - Networking 2 09-21-2005 10:55 PM
Mountind drives / Copying file from home drive to floppy ozwalker Linux - Newbie 1 09-04-2003 09:06 PM


All times are GMT -5. The time now is 08:17 PM.

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