]> git.ipfire.org Git - thirdparty/mdadm.git/commit
super1: report truncated device
authorNeilBrown <neilb@suse.de>
Thu, 25 Aug 2022 22:55:56 +0000 (08:55 +1000)
committerJes Sorensen <jsorensen@fb.com>
Mon, 29 Aug 2022 15:45:39 +0000 (11:45 -0400)
commit171e9743881edf2dfb163ddff483566fbf913ccd
tree834a6ce71135fd753ac0c2c7fd1af44e059fb7d8
parent5c3c3df646dd3b7e8df81152f08e9ac4ddccc671
super1: report truncated device

When the metadata is at the start of the device, it is possible that it
describes a device large than the one it is actually stored on.  When
this happens, report it loudly in --examine.

....
   Unused Space : before=1968 sectors, after=-2047 sectors DEVICE TOO SMALL
          State : clean TRUNCATED DEVICE
....

Also report in --assemble so that the failure which the kernel will
report will be explained.

mdadm: Device /dev/sdb is not large enough for data described in superblock
mdadm: no RAID superblock on /dev/sdb
mdadm: /dev/sdb has no superblock - assembly aborted

Scenario can be demonstrated as follows:

mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md/test started.
mdadm: stopped /dev/md/test
   Unused Space : before=1968 sectors, after=-2047 sectors DEVICE TOO SMALL
          State : clean TRUNCATED DEVICE
   Unused Space : before=1968 sectors, after=-2047 sectors DEVICE TOO SMALL
          State : clean TRUNCATED DEVICE

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
super1.c