How do I Avoid a full raid resync with mdadm.
I recently delved into the world of software raid, and set up a sometimes-connected usb drive to mirror the disk in my laptop (raid 1). Everything works great except that when I connect the usb drive to the system and add one of its partitions to one of my raid devices, it insists on resyncing the entire partition, which is quite a drain on my not-so-powerful laptop.
Reading the man page for mdadm, the system should be smart enough to use the raid internal write-intent bitmap to only write the sectors that have changed. If I software-fail the device, remove it, and re-add it without stopping the array, this is exactly what happens. However; if I stop the array (either manually, or by shutting down), then start up in a degraded state and try to add the device back into the array, I get a full resync.
Right now I'm not using an initrd image to boot, and relying on the auto-detect feature of the kernel. This lets me boot with a root md device started in degraded mode by default.
I've tried all of the following:
- mdadm /dev/mdx -a /dev/sdax
- mdadm /dev/mdx --re-add /dev/sdax
- mdadm -I /dev/sdax
which all result in a full resync.
The one command that doesn't cause a full resync is:
- mdadm -A /dev/mdx /dev/hdax /dev/sdax
but I can only use this for my secondary partitions, as my root partition is already started, mounted, and in use in degraded mode.
Is there a way to do what I'm trying without having to also delve into custom initrd images?
You're using the wrong technology RAID, for the wrong purpose - mirrored backups. If your goal is simply mirroring a drive for backup purposes you should investigate `rsync' or `unison'. RAID is meant to have continuously connected hardware.
|All times are GMT -5. The time now is 07:21 PM.|