You are not logged in.

#1 2016-05-19 17:26:55

BasT
Member
Registered: 2010-08-28
Posts: 105

btrfs fails to mount after removing device [Solved]

Typing this on my phone, so excuse the lack of logs please.

My btrfs partition was full and in need of a rebalance. However to perform the balance operation I had to add a file on another disk.

What I did was:
I created the file extend.img with dd
I mounted the file as loop0
Add the loop device to the btrfs:

btrfs device add /mnt/ramdisk/extend.img /

Start the operation over the combined filesystem.

btrfs balance start /

Convert the btrfs back to non-raid mode:

btrfs balance start -f -dconvert=single -mconvert=single /

At this point I probably should have removed the loop device with btrfs device delete. But I didn't.
I removed the loop device (losetup -d) and deleted the extend.img.

Now when I do

btrfs filesystem show

it lists the one drive and says "some devices missing".

Trying to mount normally or with "-o degraded" gives "wrong fs type, bad option, bad superblock"

dmesg gives:

too many missing devices, writable mount is not allowed.
open_ctree failed

Any hope of restoring the partition? The image file I deleted should have been empty. All the data should still be there...

Edit: Was able to restore my data almost completely using "btrfs restore". Out of 60GB data only 8 irrelevant files were lost.

Last edited by BasT (2016-06-02 11:26:38)

Offline

Board footer

Powered by FluxBB