diff options
author | Wang Shilong <wangsl.fnst@cn.fujitsu.com> | 2013-09-21 16:34:18 +0800 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-10-16 08:23:08 -0400 |
commit | 7985fe64e0e290d6107bc4218920238928300010 (patch) | |
tree | 405340b03e06f4596237f5b2cb99e4e39d046a0c /disk-io.h | |
parent | 39813fb7ac3e622b25f27dcd78e98242e121011e (diff) | |
download | btrfs-progs-7985fe64e0e290d6107bc4218920238928300010.tar.gz |
Btrfs-progs: add super-recover to recover bad supers
Until now if one of device's first superblock is corrupt,btrfs will
fail to mount. Luckily, btrfs have at least two superblocks for
every disk.
In theory, if silent corrupting happens when we are writting superblocks
into disk, we must hold at least one good superblock.
One side effect is that user must gurantee that the disk must be
a btrfs disk. Otherwise, this tool may destroy other fs.(This is also
reason why btrfs only use first superblock in every disk to mount)
This little program will try to correct bad superblocks from
good superblocks with max generation.
There will be five kinds of return values:
0: all supers are valid, no need to recover
1: usage or syntax error
2: recover all bad superblocks successfully
3: fail to recover bad superblocks
4: abort to recover bad superblocks
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'disk-io.h')
-rw-r--r-- | disk-io.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -70,6 +70,8 @@ struct btrfs_fs_info *open_ctree_fs_info_restore(const char *filename, struct btrfs_fs_info *open_ctree_fs_info(const char *filename, u64 sb_bytenr, u64 root_tree_bytenr, int writes, int partial); +struct btrfs_root *open_ctree_with_broken_super(const char *filename, + u64 sb_bytenr, int writes); int close_ctree(struct btrfs_root *root); int write_all_supers(struct btrfs_root *root); int write_ctree_super(struct btrfs_trans_handle *trans, |