<div>dd is wildly inefficient: it copies over empty blocks, discarded blocks, etc., and I don't recommend it. rsync is great: you have to be careful with the "exclude" syntax to avoid recursion, but it works well. /bin/cp -a is almost as good as rsync, but doesn't allow you to efficiently do it twice. tar has some useful options to avoid descending to other partitions, which is handy for avoiding NFS mounts or
</div>
<div> </div>
<div>You also really, really want to make sure the partition layouts are similar. For speed and ease, I tend to use only a few primary partitions and avoid using LVM or LVM with different /tmp, /var, /usr, /home, /opt, etc., etc., etc. partitions to ease exactly this sort of duplication. One big swap partition, one big / partition on a primary partition, and you're done in almost all situations. I can program that with a few lines of fdisk code, rather than the complexity of LVM and software RAID and allocating disk sizes or squashing a directory that turns out to need to be larger than I expected.
</div>
<div> </div>
<div>You also need to make sure that any necessary boot-time disk controllers are in the system's initrd: look up the manual page for mkinitrd, and for "grub-install" in order to create a new MBR that points to the right grub configuration on your new disk.
<br><br>I've used such procedures for, roughly, 15000 active servers, so I know it works.</div>
<div> </div>
<div> </div>
<div><span class="gmail_quote">On 11/14/06, <b class="gmail_sendername">Brendan Whelan</b> <<a href="mailto:b_whelan@mistral.co.uk">b_whelan@mistral.co.uk</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Thank you for the responses.<br><br>As Steve D noted when using dd if=/dev/sda of /dev/sdb the output disk must
<br>be at least as large as the input disk. I have found that the inevitable few<br>blocks difference in size, in 73GB, is enough to stop this working. I seem<br>to remember, that on occasions, there were problems with bad block
<br>information.<br><br>Regarding using "cp" I had understood (possibly wrongly) that cp didn't<br>always give a perfect copy and that rsync was more reliable.<br>Would the cp command be cp -Ra /dev/sda /dev/sdb ?
<br><br>I have found with proprietary disk copying programs that I get problems when<br>I upgrade/replace the hardware.<br><br>I will look at the other options suggested.<br>Once again thanks for the advice and I welcome any more comments or
<br>suggestions.<br><br>Brendan<br><br>----- Original Message -----<br>From: <<a href="mailto:linux@oneandoneis2.org">linux@oneandoneis2.org</a>><br>To: <<a href="mailto:sussex@mailman.lug.org.uk">sussex@mailman.lug.org.uk
</a>><br>Sent: Monday, November 13, 2006 5:19 PM<br>Subject: Re: [Sussex] Simple cloning<br><br><br>> > Does the following approach look sensible:<br>> ><br>> > 1. Install a virgin copy of FC5 on the target disk.
<br>> ><br>> > 2. Place the original drive in the server with a low address.<br>> ><br>> > 3. Place the target drive in the server with a higher address.<br>> ><br>> > 4. Boot the system and allow to settle down.
<br>> ><br>> > 5. rsync /dev/sda /dev/sdb is this too simplistic? Should I repeat<br>> > this step a couple of times.<br>> ><br>> > 6. Shutdown<br>> ><br>> > 7. Reboot with only the target drive installed and check that all is
<br>well.<br>><br>> Can't you just use "cp -Ra" for this? It's all I've ever used to move an<br>> install from one disk to another. .<br>><br>> Dominic<br>><br>> __<br>> Sussex mailing list
<br>> <a href="mailto:Sussex@mailman.lug.org.uk">Sussex@mailman.lug.org.uk</a><br>> E-mail Address: <a href="mailto:sussex@mailman.lug.org.uk">sussex@mailman.lug.org.uk</a><br>> Sussex LUG Website: <a href="http://www.sussex.lug.org.uk/">
http://www.sussex.lug.org.uk/</a><br>> <a href="https://mailman.lug.org.uk/mailman/listinfo/sussex">https://mailman.lug.org.uk/mailman/listinfo/sussex</a><br>><br>><br><br><br><br>__<br>Sussex mailing list<br><a href="mailto:Sussex@mailman.lug.org.uk">
Sussex@mailman.lug.org.uk</a><br>E-mail Address: <a href="mailto:sussex@mailman.lug.org.uk">sussex@mailman.lug.org.uk</a><br>Sussex LUG Website: <a href="http://www.sussex.lug.org.uk/">http://www.sussex.lug.org.uk/</a><br>
<a href="https://mailman.lug.org.uk/mailman/listinfo/sussex">https://mailman.lug.org.uk/mailman/listinfo/sussex</a><br></blockquote></div><br>