Normally, Linux mdadm
RAID devices are always a little smaller than the size of the component devices (or their sum in the case of RAID 0), because MD devices store metadata.
In this case you have used --build
, which invokes a manual assembly mode that does not use metadata. Nevertheless, a linear array might be smaller than the sum of the sizes of the component devices because MD devices use a chunk size. Please note the following output or similar which you should get from your command:
mdadm: chunk size defaults to 64K
mdadm: array /dev/md0 started.
This means that the array works with chunks of 65536 bytes. For example, if it were a RAID0 array (which it isn't) then the data would be interleaved with 65536 bytes on one component, 65536 bytes on the next, and so on.
If there are extra bytes on the end that do not make up a full chunk, then the array cannot use them.
In linear mode, I am not sure whether MD will round down the size of each component to the nearest multiple of 65536 bytes, or only round down the size of the whole array. Either way, the size of one of your components if not a multiple of 65536 bytes (the other 2 are), resulting in a round-down of 65024 bytes — exactly the discrepancy you saw.
The best way to show the exact size of a block device is:
blockdev --getsize64 /dev/sda1
So if you take the sum of:
blockdev --getsize64 /dev/sda1
blockdev --getsize64 /dev/sda2
blockdev --getsize64 /dev/loop0
And the usable size of the resulting array which can be seen with:
blockdev --getsize64 /dev/md0
By the way, I think that the array you are trying to build here is pretty weird and possibly dangerous. The usefulness of an array made up of two physical block devices and a virtual block device backed by a file is weird. More importantly, you say:
/dev/sda1
is a very small partition needed by the /dev/sda2
Windows 7 partition in order for Windows to boot properly.
It certainly sounds like you will destroy Windows 7 but if you overwrite those partitions with a Linux MD RAID device then Windows cannot use it anymore!
Best Answer
I would use the command
it will stop at the first differing byte, writing out its offset, or on EOF on the shorter one.