[Malvern] New HDD - copying everything across

Chris Eilbeck chris at hyperspace.org.uk
Sun Jan 8 01:31:49 GMT 2006


On Sat, Jan 07, 2006 at 11:44:22PM -0000, Robin Wilson wrote:
> Hi all,
> 
> I've recently acquired a new hard drive to replace a failing one in my
> linux server. I want to copy everything that is currently on my hard drive
> to my new one. This is a secondary hard drive which has /home mounted on
> it - everything else will be staying on the first hard drive.
> 
> How should I do this? Will cp (with relevant recursive parameters - and
> any other parameters needed...could someone enlighten me?) work ok, or
> will I need to use some specialised disk mirroring/ghosting program?

Is the new drive exactly the same size as the old one?  If so, the fastest
way to do the copy is umounting the drive and using 

  dd if=olddiskpartition of=newdiskpartition

If not, you could use cp -a which will copy permissions and file ownerships,
or doing a piped tar-detar setup using something like

  ( cd /home ; tar cvf - . ) | ( cd /new ; tar xvf -)

that you can do across a network too using rsh or ssh commands too, or using
rsync, which is probably the way I'd do it, something like

  rsync -arv /home/ /new/

Chris
-- 
Chris Eilbeck
MARS Flight Crew                              http://www.mars.org.uk/
UKRA #1108 Level 2                                                UYB
Tripoli UK Member #9527                                          LSMR



More information about the Malvern mailing list