Re: add new disk with dd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Am 29.04.21 um 17:32 schrieb d tbsky:
Mateusz <mateusz-lists@xxxxxxxxxxxxxx>
Should in most cases [1], but IMHO it's good idea to
mdadm --zero-superblock /dev/YOU_ARE_SURE_IS_ONE_YOU_WANT_TO_ADD
before adding disk already used somewhere else.

    "madam --zero-superblock" is great.  I will add it to my procedure.
    thanks a lot for the hint!

BTW,  IMHO it's better to clone partition layout, and than install bootloaders
instead of dding disk.

    yes. but sometimes dd is easy, especially for mbr layout.
anyway I think your suggestion "--zero-superblock" make things safe
with new and old disks

doing both for years on dozens of machines which have 3 RAID partitions (boot, os, data) on 4 disks with a script

GOOD_DISK is a full working one and BAD_DISK the blank drive

[root@srv-rhsoft:~]$ cat /scripts/raid-recovery.sh
#!/usr/bin/bash

GOOD_DISK="/dev/sda"
BAD_DISK="/dev/sdd"

# --------------------------------------------------------------------------

echo "NOT NOW"
exit

# --------------------------------------------------------------------------

# clone MBR
dd if=$GOOD_DISK of=$BAD_DISK bs=512 count=1

# force OS to read partition tables
partprobe $BAD_DISK

# start RAID recovery
mdadm /dev/md0 --add ${BAD_DISK}1
mdadm /dev/md1 --add ${BAD_DISK}2
mdadm /dev/md2 --add ${BAD_DISK}3

# print RAID status on screen
sleep 5
cat /proc/mdstat

# install bootloader on replacement disk
grub2-install "$BAD_DISK"



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux