BTRFS partition not mount parent transid verified failed and child eb corrupted

aug7744

Member
Credits
745
Using BTRFS in the last 3 months with good experience ... until today ... BTRFS is very good, but when happen a problem it is a big trouble.
Using Lubuntu 20.04 64 bits being an partition for root and another for home both being BTRFS. Not swap partition.
home partition BTRFS configured in fstab how being
defaults,noautodefrag,compress-force=zlib:9,nospace_cache,noatime,commit=36000,max_inline=0

Allways when system crash I run the command below
sudo btrfs check --force --readonly --progress /dev/sda
if has any error almost allways is "cache and super generation don't match, space cache will be invalidated"
I run the command below to fix
sudo btrfs check --force --readonly --progress --clear-space-cache v1 /dev/sda
and after
sudo btrfs check --force --repair --progress /dev/sda
Never had problems doing it.

Today the system had crashed. thus had run the command below in sequence in partition home
sudo btrfs check --force --readonly --progress /dev/sda
sudo btrfs check --force --readonly --progress --clear-space-cache v1 /dev/sda
sudo btrfs check --force --repair --progress /dev/sda

When the system was restarted in user login screen not is possible continue loading the system how if the home partition not was mounted.
Starting in recovery mode and running the command below
sudo btrfs check --force --readonly --progress /dev/sda
was that result

parent transid verified failed on 30638080 wanted 73427 found 73667
ignoring transid failure
error child eb corrupted : parent byte nr=305725544 item=1 parent level=2 child level=0
error failed to read block groups input/output error
error cannot open filesystem

Not is possible mount the home partition

After I had tried several others commands being in sequence
btrfs resuce zero-log sda
restarting adding in fstab
usebackuproot
mount -t btrfs -o usebackuproot /dev/<btrfs-device
and again
sudo btrfs check --force --readonly --progress /dev/sda

and nothing fixed with the same error results.

Not bad block or others problems with the disk.
How recover that partition ?

I've been using computers for years and never seen anything like this happen.
See the link about BTRFS when has problems
Now trying learn about ZFS if is good for compression and easy to fix.
Thanks very much for your reply.
 


hal_ifax

New Member
Credits
54
I've been using computers for years and never seen anything like this happen.
I agree . . .

This happened for Fedora 34 in my case . . .
I was able to draw a backup of the affected btrfs-partiton via "testdisk" or by

dd if=/dev/btrfs-partition of=image.dd

then do

mkfs.btrfs -f /dev/btrfs-partition

and restore by

dd if=image.dd of=/dev/btrfs-partition

I put the new UUID of "btrfs-partition", shown in /dev/disk/by-uuid into /boot/grub/grub.cfg of my Kubuntu-partition! as I'm booting Fedora 34 via Kubuntu-20.04-grub.cfg, which is just easily edited . . .

Good luck !

P. S.
Best thing is to have a tar-backup of Your btrfs-partition . . . :-(
 
Last edited:

hal_ifax

New Member
Credits
54
I've been using btrfs in openSUSE with no issues so far. Read here https://en.opensuse.org/SDB:BTRFS#How_to_repair_a_broken.2Funmountable_btrfs_filesystem and see if that helps.
Thank You for Your reply, I had a look to it already BEFORE I formatted the broken btrfs-partition . . . :-(

Since the partition coudn't be mounted, there's no other help as do a format !?
My above mentioned "dd-method" isn't functional at all in that case!
I'M SORRY FOR MISGUIDING @aug7744 AND ALL OTHER USERS ! :oops:
 

Tolkem

Well-Known Member
Credits
6,398
Thank You for Your reply, I had a look to it already BEFORE I formatted the broken btrfs-partition . . . :-(
You're welcome! :) Do you mean you had already formatted the partition before reading it? Or was it the other way around?

Since the partition coudn't be mounted, there's no other help as do a format !?
My above mentioned "dd-method" isn't functional at all in that case!
I'M SORRY FOR MISGUIDING @aug7744 AND ALL OTHER USERS ! :oops:
I don't know. I've been using btrfs for 2-3 months or so, and like I said haven't had any issues so far. Did you create any snapshots? It is good having some snapshots available, though I don't know if they'll work when in such situations.
 

hal_ifax

New Member
Credits
54
Do you mean you had already formatted the partition before reading it? Or was it the other way around?
The latter . . . ;)

Did you create any snapshots? It is good having some snapshots available, though I don't know if they'll work when in such situations.
As btrfs is "work in development", I think snapshots aren't already available for Fedora 34 ?!
In the beginning of this year I first read about btrfs-snapshots, tried to do one, but failed . . .

 

Tolkem

Well-Known Member
Credits
6,398
As btrfs is "work in development", I think snapshots aren't already available for Fedora 34 ?!
In the beginning of this year I first read about btrfs-snapshots, tried to do one, but failed . . .
Yes, they are, but need to install snapper first and create snapshots with it. Otherwise, use btrfs-subvolume to create them, however, snapper will do automatically, and if you install dnf-snapper-plugin too, every time you use dnf to install, remove or upgrade, snapshots will be created too. Read man btrfs-subvolume and here http://snapper.io/ and here https://wiki.archlinux.org/title/Snapper
I do recommend though using snapper, as it makes it real easy to create and manage snapshots. Fedora has plans to make it the default tool in the future for this task, so it is best to learn how to use it now https://fedoraproject.org/wiki/Changes/BtrfsWithFullSystemSnapshots#Scope
 

hal_ifax

New Member
Credits
54
Fedora has plans to make it the default tool in the future for this task, so it is best to learn how to use it now https://fedoraproject.org/wiki/Changes/BtrfsWithFullSystemSnapshots#Scope
Thank You so much for this useful information !

A minute ago I finished rebuilding my Fedora 34:
1. tar-restore of Fedora 33, correcting the UUIDs in grub.cfg and /etc/fstab, do a "touch ./autorelabel" ;) - reboot and WAIT . . . :eek:
2. system-upgrade to 34
3. recompiling the TPlink-WLAN-driver for kernel-5.12

Now I'll NOT forget the tar-backup of my Fedora 34 . . . :rolleyes:
THEN I'll try to install snapper . . .


Success . . .
AND did a

sudo dnf install dnf-plugin-snapper ;)

BUT
"sudo snapper create" fails for Fedora until now as there is Selinux . . .
One has to switch it off to get a snapper-snapshot:
i.e. put "selinux=0" to the end of "kernel"-line of Your grub.cfg and reboot . . . :oops:

You may check by "sestatus" . . .
 
Last edited:

Tolkem

Well-Known Member
Credits
6,398
Thank You so much for this useful information !
You're very welcome! :)
I recommend you to read openSUSE's docs regarding snapper and btrfs, it's really informative, and you'll learn lots of stuff on how to properly use and manage snapshots and your file system. Likewise, the Arch's wiki has valuable info too, so give a read as well. :)
 

hal_ifax

New Member
Credits
54
I get an I-O error, if Selinux is active('enforcing') . . .

Jeff Schaller wrote:
"It's been several years, since OP asked this question, but I have stumbled upon this today as well... And since both me and him were using Fedora when this happened, I believe this is caused by the SELinux itself (no surprise there... :D).
In any case, if anyone else stumbles upon this as well, try this:
sudo sestatus | grep -i "current"

If you see enforcing, then try temporarily disabling the SELinux:
sudo setenforce 0

and retry creating the snapshot via the snapper... ;)
NOTE: I'm planning to report this to SELinux guys, to see if the SELinux policies for snapper could be updated a little."

Quoted from
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Latest posts

Top