linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] add super-recover tool to recover bad supers
@ 2013-09-18  8:27 Wang Shilong
  2013-09-18  8:27 ` [PATCH 1/4] Btrfs-progs: do not run ioctls in check_mounted_where() Wang Shilong
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Wang Shilong @ 2013-09-18  8:27 UTC (permalink / raw)
  To: linux-btrfs

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 scan devices and find good superblocks
(max generation, checksum matched). And use this superblock to
recover bad superblocks.The process is:

Step1: scan btrfs devices
Step2: find good supers
Step3: open ctree
Step4: writ all supers

We pass the latest good supers into open_ctree() and open_ctree()
will recalucate every superblock's dev_item by searching chunk tree.

Notice: This patchset based on David's dev/rescue branch

Wang Shilong (4):
  Btrfs-progs: do not run ioctls in check_mounted_where()
  Btrfs-progs: pass flag to control whether run ioctl in
    btrfs_scan_for_fsid()
  Btrfs-progs: move ask_user() to utils.c
  Btrfs-progs: add super-recover to recover bad supers

 Makefile          |   2 +-
 btrfs-find-root.c |   2 +-
 chunk-recover.c   |  20 +---
 cmds-rescue.c     |  55 ++++++++++
 commands.h        |   2 +
 disk-io.c         |  37 +++++--
 disk-io.h         |   5 +-
 super-recover.c   | 323 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 utils.c           |  20 +++-
 utils.h           |   1 +
 10 files changed, 437 insertions(+), 30 deletions(-)
 create mode 100644 super-recover.c

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-09-23 12:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-18  8:27 [PATCH 0/4] add super-recover tool to recover bad supers Wang Shilong
2013-09-18  8:27 ` [PATCH 1/4] Btrfs-progs: do not run ioctls in check_mounted_where() Wang Shilong
2013-09-18  8:27 ` [PATCH 2/4] Btrfs-progs: pass flag to control whether run ioctl in btrfs_scan_for_fsid() Wang Shilong
2013-09-18  8:27 ` [PATCH 3/4] Btrfs-progs: move ask_user() to utils.c Wang Shilong
2013-09-18  8:27 ` [PATCH 4/4] Btrfs-progs: add super-recover to recover bad supers Wang Shilong
2013-09-18 15:13   ` David Sterba
2013-09-18 15:31     ` Wang Shilong
2013-09-18 16:31       ` David Sterba
2013-09-21  1:16         ` Wang Shilong
2013-09-23 12:10           ` [offlist] " David Sterba
2013-09-18 15:18 ` [PATCH 0/4] add super-recover tool " David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).