0

I generally use linux software md raid, but made the mistake of keeping IMSM "fakeraid" on a machine that came with it pre-configured. The fakeraid seeemed appealing because it worked seamlessly with both the bios and linux, which made it easier to configure (e.g., only install the bootloader once). Unfortunately, it seems to be impossible to set up a write intent bitmap with IMSM raid, and so my machine becomes painfully slow for 8 hours every time it crashes and reboots. (And unfortunately, I seem to be suffering a string of power outages.)

My question: is there an easy way to convert from IMSM fakeraid to linux software RAID without copying the data off somewhere (as I don't have another disk in the machine)? Alternatively, is there some way I haven't yet discovered to add a write intent bit map to fakeraid, so I don't have to rebuild the whole RAID array after every unexpected reboot?

user3188445
  • 141
  • 5

1 Answers1

1

Commands which I have used to convert my RAID10 from IMSM to software RAID:

Check which set of the disks:
# mdadm --detail /dev/md/vol0
Number   Major   Minor   RaidDevice State
3       8        0        0      active sync set-A   /dev/sda
2       8       48        1      active sync set-B   /dev/sdd
1       8       16        2      active sync set-A   /dev/sdb
0       8       32        3      active sync set-B   /dev/sdc

Remove set-B:
# mdadm /dev/md126 --fail /dev/sdc
# mdadm /dev/md126 --fail /dev/sdd

# mdadm /dev/md127 --remove /dev/sdc
# mdadm /dev/md127 --remove /dev/sdd

(Optional) Erase filesystem/old RAID info:
# dd if=/dev/zero of=/dev/sdc count=1024
# dd if=/dev/zero of=/dev/sdd count=1024

Create new RAID:
# mdadm --create --verbose /dev/md0 --level=10 --raid-devices=4 missing /dev/sdc missing /dev/sdd

Create new filesystem:
# mkfs.ext4 /dev/md0
Remember filesystem UUID
# mkdir -p /mnt/1
# mount /dev/md0 /mnt/1
Copy data:
# rsync -avux --progress --delete /mnt/raid/ /mnt/1

Edit fstab (change UUID of RAID filesystem to remembered):
# vim /etc/fstab

Synchronize changes while was long copy:
# rsync -avux --progress --delete /mnt/raid/ /mnt/1

=== Here if RAID filesystem is on / also needed bootloader setup. ===

Remount filesystem as readonly:
# mount -f -o ro,remount /mnt/raid

And again synchronize:
# rsync -avux --progress --delete /mnt/raid/ /mnt/1

# reboot
# mdadm --stop /dev/md126
# mdadm --stop /dev/md127
# mdadm /dev/md125 --add /dev/sda /dev/sdb
unDEFER
  • 11
  • 2
  • 1
    This doesn't answer my question and contains misinformation. First, IMSM is fakeraid, because whether or not the term is misleading, the technical definition of fakeraid is RAID that is configured by the BIOS but managed by the OS once booted. Second, the thread you linked concerned RAID arrays coming up in degraded mode, which is not my problem. My problem is that since I can't add a write intent bitmap, I have to rebuild the entire array on every reboot. But both disks are recognized on boot. – user3188445 Aug 29 '17 at 22:02
  • I think if you use RAID 10 or RAID 1, it is easy to reconfigure your RAID. If other level. it maybe impossible. So what level of RAID you use? – unDEFER Sep 08 '17 at 22:28
  • RAID 1, just two mirrored disks. – user3188445 Sep 10 '17 at 00:57
  • So you can do something like this: # mdadm /dev/md127 --fail /dev/sdb – unDEFER Sep 13 '17 at 02:39
  • So I have change the reply – unDEFER Sep 13 '17 at 02:53