Clone/Replace HDD in Software RAID

When replacing hdd in software raid, easiest way to do it is to clone partition table from the healthy disk on the new one. Regenerate UUIDS and add new disk in the array.

Here's how we do it. (/dev/sda is healthy disk)

For MBR Disks:

# sfdisk -d /dev/sda | sfdisk /dev/sdb

also can do a partitions rescan:
# sfdisk -R /dev/sdb

For GPT Disks:
WARNING: /dev/sdb is the DESTINATION! /dev/sda is SOURCE.

# sgdisk -R /dev/sdb /dev/sda

then set new UUIDs

# sgdisk -G /dev/sdb

then check if partitions have appeared:

# fdisk -l /dev/sdb

after that simply add your partitions:

# mdadm /dev/md0 -a /dev/sdb1
....add all md dev-disk pair...

then you can watch it syncing:

# watch cat /proc/mdstat

afterwards don't forget to install grub:

# grub-install /dev/sdb


Trackback specific URI for this entry

This link is not meant to be clicked. It contains the trackback URI for this entry. You can use this URI to send ping- & trackbacks from your own blog to this entry. To copy the link, right click and select "Copy Shortcut" in Internet Explorer or "Copy Link Location" in Mozilla.

No Trackbacks


Display comments as Linear | Threaded

No comments

Add Comment

You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.