Re: ???root account locked??? after removing one RAID1 hard disc

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

 





Am 30.11.20 um 21:06 schrieb David T-G:
Reindl, et al --

...and then Reindl Harald said...
%
...
%
% typically fire up my "raid-repair.sh" telling the script source and
% target disk for cloning partition table, mbr and finally add the new
% partitions to start the rebuild
[snip]

Oooh!  How handy :-)  Share, please!

just make sure GOOD_DISK is one of the remaining and BAD_DISK is the repalcement drive before uncomment the "exit"

and yeah, adjust how many raid-partitions are there

the first is my homeserver with 3 filesystems (boot, system, data), the second one is a RAID10 on a HP microserver with the OS on a sd-card

---------------------------------------------------------------------

DOS:

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

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

echo "NOT NOW"
exit 1

# 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"

---------------------------------------------------------------------

GPT:

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

GOOD_DISK="/dev/sda"
BAD_DISK="/dev/sde"

echo "NOT NOW"
exit 1

echo "sgdisk $GOOD_DISK -R $BAD_DISK"
sgdisk $GOOD_DISK -R $BAD_DISK

echo "sgdisk -G $BAD_DISK"
sgdisk -G $BAD_DISK

echo "sleep 5"
sleep 5

echo "partprobe $BAD_DISK"
partprobe $BAD_DISK

echo "sleep 5"
sleep 5

echo "mdadm /dev/md0 --add ${BAD_DISK}1"
mdadm /dev/md0 --add ${BAD_DISK}1

echo "sleep 5"
sleep 5

echo "cat /proc/mdstat"
cat /proc/mdstat

---------------------------------------------------------------------



[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