[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Copying partitions on same disk



At 05:15 17/09/2004, you wrote:
How do  copy my / containing directory root boot tmp bin
proc etc to a different partition of same disk.

I used dd if=/dev/sda1 of=/dev/sda4 but it seems to "hang".

cp -up could not handle /tmp correctly

Thank in advance for your reply.

Prashant kumar
home page http://home.iitk.ac.in/student/prashkr
+-----------------------------------------------------------------+
|Nothing is fool-proof for a sufficiently talented fool!          |
+-----------------------------------------------------------------+

AFAIK dd will only work if both partitions are the same size, which is probably why it's hanging.

You don't need to copy proc, it should be created by the kernel - you may need to manually make the /proc directory though.

As far as copying goes, a user on this list pointed out to me how to use tar to do very good copies: http://www.hantslug.org.uk/cgi-bin/wiki.pl?LinuxHints/OneDiskToAnother

namely, mount one partition as one thing (e.g. /mnt/first) and another as something else (/mnt/second), then use a command similar to the following:

(cd /mnt/first && tar cfl - . ) | (cd /mnt/second && tar xvfp -)

Note that the "l" (that's an L) switch in the first half of the command means that tar won't traverse to different partitions/filesystems, which you may or may not want. I found that this copied all my device nodes over nicely as well.

Don't forget to update your boot block!



Reply to: