Commit Graph

3 Commits

Author SHA1 Message Date
Lidong Zhong 75562b57d4 Dump: get stat from a wrong metadata file when restoring metadata
The dumped metadata files are shown as below
localhost:~ # ll -ih test/
total 16K
34565564 -rw-r--r-- 2 root root 1.0G Dec 14 21:15
scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-3
34565563 -rw-r--r-- 2 root root 1.0G Dec 14 21:15
scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-4
34565563 -rw-r--r-- 2 root root 1.0G Dec 14 21:15 sda
34565564 -rw-r--r-- 2 root root 1.0G Dec 14 21:15 sdb

It reports such error when trying to restore metadata for /dev/sda
localhost:~ # mdadm --restore=test /dev/sda
mdadm: test/scsi-0QEMU_QEMU_HARDDISK_drive-scsi0-0-0-4 is not the same
size as /dev/sda - cannot restore.
It's because the stb value has been changed to other metadata file in
the while statement.

Signed-off-by: Lidong Zhong <lidong.zhong@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2020-12-20 13:45:30 -05:00
Anthony Youngman 29446c962f Coverity: Resource leak: close fds and free array before return
Signed-off-by: Anthony Youngman <anthony@youngman.org.uk>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2018-07-11 13:08:25 -04:00
NeilBrown 74db60b00a Add --dump / --restore functionality.
This allows the metadata on a device to be saved and later restored.
This can be useful before experimenting on an array that is misbehaving.

Suggested-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-05-16 15:07:16 +10:00