Best way to replace a drive with a clone

Steven Stern subscribed-lists at sterndata.com
Sat Jul 31 20:05:05 UTC 2010


On 07/31/2010 02:18 PM, Andrew Haley wrote:
> On 07/31/2010 08:16 PM, Andrew Haley wrote:
>> On 07/31/2010 06:59 PM, Steven Stern wrote:
>>> According to the SMART stats, the single drive in my Fedora server is
>>> starting to fail.  Rather than backup, do a clean install, and rebuild,
>>> I'd like to try to clone the existing drive to a new one, then swap in
>>> the new one.
>>>
>>> What are the restrictions on doing this and the best way to accomplish
>>> it?  I have the Clonezilla Live CD that I use for backup.  Will that do
>>> it?
>>>
>>> Or will a straight dd do it?
>>>       add new drive as PATA slave /dev/sdb
>>>       dd -if /dev/sda -of /dev/sdb
>>>       remove /dev/sda
>>>       change the jumpers on /dev/sdb to match what was /dev/sda
>>>       reboot
>>>
>>> In the dd procedure, I'm not sure what to do if sdb is larger than sda.
>>
>> You can resize the FS later to occupy the whole partition.
>> It's worth doing an fsck first.
>>
>> Alternatively, a recipe I always use to copy a partition is:
>>
>> cd /newfs
>> dump 0f - /oldfs | restore rf -
>
> BTW, you should either do this in single user mode or with the fs
> unmounted or readonly.
>
>> This duplicates all the files, but onto a clean new filesystem.
>>
>> Andrew.
>

I like that.  Thanks.

-- 
-- Steve


More information about the users mailing list