Skip to contentSkip to conversation

btrfs restore

DISCUSSION Mihail Zaporozhets 2 participants 4 messages Aug 21, 2014 – Aug 22, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hello,
I'm create btrfs multi-device volume: (2TB * 5disks)
1. one device was converted from ext3,
then delete sub-volume 'ext2';
2. 'btrfs device add /dev/sd* /mnt/sdc1';
and some times again, Every disk adds by one, then move data from other disks. 2 times was running 'btrfs fi defrag -r -v -t 700K /mnt/sdc1; btrfs balance start /mnt/sdc1; btrfs scrub start /mnt/sdc1'. Finally I have FS at 5 devices.

After, go to reboot pc, and I seen that 1 drive have no any partition. I'm full of sadness. I think that device was not correctly unmounted and one disk fail.
mount -t btrfs -o degreded,ro,recovery,nospace_cache ...
mount -t btrfs -o recovery,nospace_cache ...
btrfs-find-root, btrfs-zero-log ..

Finaly:
btrfs restore -t 10404875644928 -v -i /dev/sda1 /mnt/uh1/eric/ - Success! but some directory is absent; 3.4 TB restored, but 4 (available disks)*1.82 Tb = 7.28 TB; and 7.28-3.4 = about 3.8 TB which is missing . Where is it ? How can i get it back?

How can i try to restore more data?

Please advice.

_____
mount -t btrfs -o degraded,ro,recovery,nospace_cache /dev/sda1 /mnt/tmp3; dmesg | tail

[11774.958996] BTRFS info (device sde1): allowing degraded mounts
[11774.959001] BTRFS info (device sde1): enabling auto recovery
[11774.959003] BTRFS info (device sde1): disabling disk space caching
[11774.959955] BTRFS warning (device sde1): devid 5 missing
[11774.986391] BTRFS: failed to read tree root on sde1
[11774.986408] BTRFS: failed to read tree root on sde1
[11774.986456] BTRFS: failed to read tree root on sde1
[11774.986473] BTRFS: failed to read tree root on sde1
[11774.986481] BTRFS: failed to read tree root on sde1
[11775.014471] BTRFS: open_ctree failed
# btrfs-zero-log /dev/sda1                         
warning devid 5 not found already
Check tree block failed, want=16845270495232, have=0
read block failed check_tree_block
Couldn't read tree root
______
# uname -a
Linux oit-875u 3.16.0-031600rc7-generic #201407271635 SMP Sun Jul 27
20:36:48 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
    # btrfs fi show                                         
Label: none  uuid: 841f1b5c-adb2-485f-a4cf-83bbf880dced
        Total devices 5 FS bytes used 9.09TiB
        devid    1 size 1.82TiB used 1.82TiB path /dev/sda1
        devid    2 size 1.82TiB used 1.82TiB path /dev/sdc1
        devid    3 size 1.82TiB used 1.82TiB path /dev/sdd1
        devid    4 size 1.82TiB used 1.82TiB path /dev/sde1
        *** Some devices missing

Btrfs v3.14.1

#1 lore raw
Quoted 5 lines · Mihail Zaporozhets
# btrfs-zero-log /dev/sda1                         
warning devid 5 not found already
Check tree block failed, want=16845270495232, have=0
read block failed check_tree_block
Couldn't read tree root

You may be hitting the same problem I was a week back. See the thread that says "btrfs-zero-log fails, can't mount FS"

Download the source for btrfs-progs, and apply this patch from Chris:

disk-io.c +2 -2
index 8db0335..d9a8e19 100644
@@ -911,13 +911,13 @@ int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info, u64 root_tree_bytenr,
                        return -EIO;
        }
        fs_info->csum_root->track_dirty = 1;
-
+#if 0
        ret = find_and_setup_log_root(root, fs_info, sb);
        if (ret) {
                printk("Couldn't setup log root tree\n");
                return -EIO;
        }
-
+#endif
        fs_info->generation = generation;
        fs_info->last_trans_committed = generation;
        if (extent_buffer_uptodate(fs_info->extent_root->node) &&

Or if you're desparate and want a binary, I'll Email you one directly (not that you should run a binary you got from someone via Email as root, so it's only if you're desperate)

Marc

Signature · 4 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/                         | PGP 1024R/763BE901
#2 lore raw

I just created
https://btrfs.wiki.kernel.org/index.php/Btrfs-zero-log

and added the info about this failure of btrfs-zero-log as well as the patch from Chris.
Whenever it's in a new version of btrfs-zero-log, I or someone else can update that wiki page to tell people to just update to a newer version to get around this "Couldn't setup log root tree" problem.

However, re-reading your error message you got a different error, so the patch isn't likely to work for you

read block failed check_tree_block
is a warhing

Your actual error is

	if (!extent_buffer_uptodate(root->node)) {
		fprintf(stderr, "Couldn't read tree root\n");
		return -EIO;
	}

This looks more serious, and I'm not sure if btrfs-zero-log can help with that.

I'll let someone else answer.

Marc

Quoted 44 lines · Marc MERLIN
Quoted 5 lines · Mihail Zaporozhets
# btrfs-zero-log /dev/sda1                         
warning devid 5 not found already
Check tree block failed, want=16845270495232, have=0
read block failed check_tree_block
Couldn't read tree root

You may be hitting the same problem I was a week back. See the thread that says "btrfs-zero-log fails, can't mount FS"

Download the source for btrfs-progs, and apply this patch from Chris:

disk-io.c +2 -2
index 8db0335..d9a8e19 100644
@@ -911,13 +911,13 @@ int btrfs_setup_all_roots(struct btrfs_fs_info *fs_info, u64 root_tree_bytenr,
                        return -EIO;
        }
        fs_info->csum_root->track_dirty = 1;
-
+#if 0
        ret = find_and_setup_log_root(root, fs_info, sb);
        if (ret) {
                printk("Couldn't setup log root tree\n");
                return -EIO;
        }
-
+#endif
        fs_info->generation = generation;
        fs_info->last_trans_committed = generation;
        if (extent_buffer_uptodate(fs_info->extent_root->node) &&

Or if you're desparate and want a binary, I'll Email you one directly (not that you should run a binary you got from someone via Email as root, so it's only if you're desperate)

Marc

Signature · 4 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/                         | PGP 1024R/763BE901
Signature · 4 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/                         | PGP 1024R/763BE901
#3 lore raw
In reply to Marc MERLIN
Quoted 17 lines · Marc MERLIN <marc <at> merlins.org> writes:
Quoted 5 lines · Mihail Zaporozhets
# btrfs-zero-log /dev/sda1                         
warning devid 5 not found already
Check tree block failed, want=16845270495232, have=0
read block failed check_tree_block
Couldn't read tree root

You may be hitting the same problem I was a week back. See the thread that says "btrfs-zero-log fails, can't mount FS"

Download the source for btrfs-progs, and apply this patch from Chris:

disk-io.c +0 -0
index 8db0335..d9a8e19 100644

disk-io.c

Quoted 1 line
disk-io.c +0 -0
 <at>  <at>  -911,13 +911,13  <at>  <at>  int btrfs_setup_all_roots(struct

btrfs_fs_info *fs_info, u64 root_tree_bytenr,

Quoted 16 lines
                        return -EIO;
        }
        fs_info->csum_root->track_dirty = 1;
disk-io.c +2 -2
-
+#if 0
        ret = find_and_setup_log_root(root, fs_info, sb);
        if (ret) {
                printk("Couldn't setup log root tree\n");
                return -EIO;
        }
-
+#endif
        fs_info->generation = generation;
        fs_info->last_trans_committed = generation;
        if (extent_buffer_uptodate(fs_info->extent_root->node) &&
Quoted 5 lines

Or if you're desparate and want a binary, I'll Email you one directly (not that you should run a binary you got from someone via Email as root, so it's only if you're desperate)

Marc

Thanks for answers.
ok,
git clone git://repo.or.cz/btrfs-progs-unstable/devel.git;
make;
Do I need to patch devel's version, or it contains this changes? if no:

sudo ./btrfs-zero-log /dev/sda1
warning devid 5 not found already
Check tree block failed, want=16845270495232, have=0 read block failed check_tree_block
Couldn't read tree root

sudo btrfs-debug-tree -R /dev/sda1
warning devid 5 not found already
Check tree block failed, want=16845270495232, have=0 read block failed check_tree_block
Couldn't read tree root

sudo ./btrfs-show-super /dev/sda1
superblock: bytenr=65536, device=/dev/sda1
---------------------------------------------------------
csum 0x9867082d [match]
bytenr 65536
flags 0x1
magic _BHRfS_M [match]
fsid 841f1b5c-adb2-485f-a4cf-83bbf880dced
label
generation 59176
root 16845270495232
sys_array_size 97
chunk_root_generation 59166
root_level 2
chunk_root 11409648779264
chunk_root_level 2
log_root 0
log_root_transid 0
log_root_level 0
total_bytes 10001983041536
bytes_used 9997613580288
sectorsize 4096
nodesize 4096
leafsize 4096
stripesize 4096
root_dir 6
num_devices 5
compat_flags 0x0
compat_ro_flags 0x0
incompat_flags 0x1
csum_type 0
csum_size 4
cache_generation 59176
uuid_tree_generation 59176
dev_item.uuid 1ef01e06-b355-4a17-a2c8-5623188813f9
dev_item.fsid 841f1b5c-adb2-485f-a4cf-83bbf880dced [match]
dev_item.type 0
dev_item.total_bytes 2000397885440
dev_item.bytes_used 1999324119040
dev_item.io_align 4096
dev_item.io_width 4096
dev_item.sector_size 4096
dev_item.devid 1
dev_item.dev_group 0
dev_item.seek_speed 0
dev_item.bandwidth 0
dev_item.generation 0

./btrfs --version
Btrfs v3.14.2

last dmesg :

[110290.284290] show_signal_msg: 174 callbacks suppressed                  
[110290.284294] btrfs-debug-tre[6014]: segfault at e0 ip 00000000004022b0 sp
00007fffcb77d1d0 error 4 in btrfs-debug-tree[400000+27000]            
[111278.465863] btrfs-debug-tre[10907]: segfault at e0 ip 00000000004022b0

sp 00007fff856c6bd0 error 4 in btrfs-debug-tree[400000+27000]

sudo ./btrfs rescue chunk-recover -v /dev/sda1
All Devices:
Device: id = 4, name = /dev/sde1
Device: id = 3, name = /dev/sdd1
Device: id = 2, name = /dev/sdc1
Device: id = 1, name = /dev/sda1

still waiting....
I started this before write to mail list, but, as i remember, my pc after
one night stay fully freeze, and had no reaction for anyone keys, and I just reboot it at that time.

Nothing changes until this moment...