LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Making mirror copy of a partition with CP command? (https://www.linuxquestions.org/questions/linux-software-2/making-mirror-copy-of-a-partition-with-cp-command-444834/)

brgr88 05-14-2006 09:20 PM

Making mirror copy of a partition with CP command?
 
I have Slackware 10.2, though I guess this question isn't distro-specific.

Currently, I have mounted:
/dev/hdb6 on /
/dev/hdb1 on /boot
/dev/hdb5 on /home

I've formatted a new ext3 partition as
/dev/hdb7
mounted on
/mnt/hd

Basically, I want to create a 'mirror' copy of my base install (hdb6) onto hdb7 so I can mess around with stuff in hdb7 w/o messing up my base working system on hdb6. If I'm in /dev/hdb6 and copy like so:
cp -r /* /mnt/hd

Am I looking at problems with those different partitions mounted as '/boot' and '/home'? Since hdb7 is mounted on the current root, but is also the one I'm copying to, is there going to be some looping issues to worry about?

Is there a better way to do this? Perhaps some special utility for copying entire partitions as opposed to a mounted filesystem? Maybe I'm not wording that right...

I guess I could just re-run the install CD on hdb7, but now I'm wondering if there's a quicker way.

syg00 05-14-2006 09:40 PM

Do it from a liveCD - then all your (valid) concerns evaporate.

brgr88 05-14-2006 11:49 PM

syg00, thanks, I didn't really think of that. Anyway, the 'cp' method went into an endless loop somewhere in '/dev/fd' and filled up all the space, but I remembered the DD command and used that and it seemed to work ok.

Looking back (and at man pages for cp), I probably could've used 'cp -R -P' to not follow symblinks.

syg00 05-15-2006 12:09 AM

I deliberately avoided mentioning dd (and partimage) for this. The image you get is the same size (regardless of larger target partition) due to the filesystem being copied "as-is". Can be rectified, but just extra grief.


All times are GMT -5. The time now is 12:41 PM.