installer: Try harder to stop pre-existing software raids.

This commit is contained in:
Michael Tremer
2014-08-13 12:04:08 +02:00
parent e9cf574d50
commit d2fafe0316

View File

@@ -809,12 +809,36 @@ int hw_umount_filesystems(struct hw_destination* dest, const char* prefix) {
return 0;
}
static int hw_destroy_raid_superblocks(const struct hw_destination* dest) {
char cmd[STRING_SIZE];
hw_stop_all_raid_arrays();
hw_stop_all_raid_arrays();
if (dest->disk1) {
snprintf(cmd, sizeof(cmd), "/sbin/mdadm --zero-superblock %s", dest->disk1);
mysystem(cmd);
}
if (dest->disk2) {
snprintf(cmd, sizeof(cmd), "/sbin/mdadm --zero-superblock %s", dest->disk2);
mysystem(cmd);
}
return 0;
}
int hw_setup_raid(struct hw_destination* dest) {
char* cmd = NULL;
int r;
assert(dest->is_raid);
// Stop all RAID arrays that might be around (again).
// It seems that there is some sort of race-condition with udev re-enabling
// the raid arrays and therefore locking the disks.
r = hw_destroy_raid_superblocks(dest);
asprintf(&cmd, "echo \"y\" | /sbin/mdadm --create --verbose --metadata=%s --auto=mdp %s",
RAID_METADATA, dest->path);
@@ -869,7 +893,7 @@ int hw_setup_raid(struct hw_destination* dest) {
}
int hw_stop_all_raid_arrays() {
return mysystem("/sbin/mdadm --stop --scan");
return mysystem("/sbin/mdadm --stop --scan --verbose");
}
int hw_install_bootloader(struct hw_destination* dest) {