Slackware This Forum is for the discussion of Slackware Linux.
|
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-29-2006, 02:17 PM
|
#1
|
Member
Registered: Jun 2005
Location: The Pudding Isles
Distribution: Slackware
Posts: 573
Rep:
|
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 01:21 PM.
|
|
|
04-29-2006, 02:21 PM
|
#2
|
Member
Registered: Sep 2003
Location: The Netherlands
Distribution: Slackware
Posts: 124
Rep:
|
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".
|
|
|
04-29-2006, 02:22 PM
|
#3
|
Senior Member
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705
Rep:
|
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.
|
|
|
04-29-2006, 02:26 PM
|
#4
|
Member
Registered: Jun 2005
Location: The Pudding Isles
Distribution: Slackware
Posts: 573
Original Poster
Rep:
|
Thanks for your answers
I try this as soon as World Community Grid has finished it's latest unit.
|
|
|
04-29-2006, 04:09 PM
|
#5
|
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:
|
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
|
|
|
04-29-2006, 04:23 PM
|
#6
|
Senior Member
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705
Rep:
|
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)
|
|
|
04-29-2006, 04:54 PM
|
#7
|
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:
|
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
|
|
|
04-29-2006, 07:38 PM
|
#8
|
Member
Registered: Jun 2005
Location: The Pudding Isles
Distribution: Slackware
Posts: 573
Original Poster
Rep:
|
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
|
|
|
04-29-2006, 08:16 PM
|
#9
|
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:
|
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
|
|
|
04-29-2006, 09:19 PM
|
#10
|
Member
Registered: Jun 2005
Location: The Pudding Isles
Distribution: Slackware
Posts: 573
Original Poster
Rep:
|
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.
|
|
|
04-30-2006, 09:50 AM
|
#11
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
cp -avx /home /new/path
is the easiest and cleanest to move or copy something.
|
|
|
05-01-2006, 08:51 AM
|
#12
|
Member
Registered: May 2005
Location: NYC
Distribution: Slackware, Gentoo
Posts: 30
Rep:
|
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.
|
|
|
05-01-2006, 01:10 PM
|
#13
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
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.
|
|
|
All times are GMT -5. The time now is 11:08 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
|
|