path: root/btrfs.c
diff options
authorMiao Xie <>2013-07-03 21:25:17 +0800
committerChris Mason <>2013-07-03 14:06:55 -0400
commit30d5c8a49f088d76fb2806240393fc035ed75290 (patch)
treef5a1652ad936c259f1cbc653a61384b3b2a31c2a /btrfs.c
parent65534643f6e919c39f58bef31ebcffd48d8b1895 (diff)
Btrfs-progs: Add chunk recover function - using old chunk items
Add chunk-recover program to check or rebuild chunk tree when the system chunk array or chunk tree is broken. Due to the importance of the system chunk array and chunk tree, if one of them is broken, the whole btrfs will be broken even other data are OK. But we have some hint(fsid, checksum...) to salvage the old metadata. So this function will first scan the whole file system and collect the needed data(chunk/block group/dev extent), and check for the references between them. If the references are OK, the chunk tree can be rebuilt and luckily the file system will be mountable. Signed-off-by: Qu Wenruo <> Signed-off-by: Miao Xie <> Signed-off-by: Chris Mason <>
Diffstat (limited to 'btrfs.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/btrfs.c b/btrfs.c
index 691adef2..4e93e13a 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -247,6 +247,7 @@ const struct cmd_group btrfs_cmd_group = {
{ "device", cmd_device, NULL, &device_cmd_group, 0 },
{ "scrub", cmd_scrub, NULL, &scrub_cmd_group, 0 },
{ "check", cmd_check, cmd_check_usage, NULL, 0 },
+ { "chunk-recover", cmd_chunk_recover, cmd_chunk_recover_usage, NULL, 0},
{ "restore", cmd_restore, cmd_restore_usage, NULL, 0 },
{ "inspect-internal", cmd_inspect, NULL, &inspect_cmd_group, 0 },
{ "send", cmd_send, cmd_send_usage, NULL, 0 },