For those of you using btrfs and those of you still on the fence, one of the issues early on was lack of a repair tool. Well, I want to report "btrfs check --repair" works and apparently well. Short version if you don't care for the details: btrfs check --repair worked as advertised and return my file system to me intact and working
If you're interested in a bit more detail, read on:
I've been using btrfs full time since 2012. I have many btrfs filesystems. My root filesystem contained 4 installs and their homes all in separate subvolumes along with two others, so 10 subvolumes in total and about 380GB of data on a 2 disk btrfs pool consisting of two Samsung 850 Pro 256GB drives.
In 2014, I had been using an add-on SATA III card in my old PC since my mobo didn't support SATA III. After a year or so, the add-on card started randomly dropping drives off and on-line. This caused 4 bad file file extents (file system version of a drive sector) that btrfs.fsck could not repair then (2014). However, they didn't cause problems. I hunted down the damages files and replaced them. They couldn't be deleted, but I could rename them - so I did and copied clean versions into the install as replacements. The results of this was the subvolume in question could not be backed-up, but it continued to work (Kubuntu 14.04) without issue so I left it alone.
Yesterday, I was cleaning house - wiping old backups, clearing old snapshots, etc. I decided to make a full set of backups of this filesystem and delete all but Kubuntu 16.04 and KDEneon. I didn't feel I needed the others and hadn't booted to either of them in over a year. Last night, I did a send|receive backup of all the subvolumes to a backup drive (except 14.04 - still unable due to the broken extents). Tonight, I started deleting the subvolumes. I deleted three, no issue, then I attempted to delete 14.04. I assumed broken extents wouldn't matter once I deleted the subvolume, but it wouldn't let me delete it. It forced my entire filesystem to Read Only because of the error so basically I was toast for the moment. I rebooted and KDEneon came back up normally. I went to the subvolume location and not only was 14.04 still there, but two of the three other subvolumes I had deleted before were still there also. I assumed this was due to delayed "commits" (the file system finishing the action) so I deleted those two again use the --commit-each option. Then tried to delete 14.04 again. Once again - forced to Read-only. Rebooted again and this time the other subvolumes were gone (so it seems I was right about the commits) but 14.04 still there. One more attempt at deletion resulted in 14.04 subvolume deletion, but now reboot failed and I was dumped into emergency maintenance mode.
Since the file-system still mounted in emr. main. mode, I was unable to run a file check on it - if you don't know, file system check and repair is one of very few things you can't do with a btrfs file system while mounted. Luckily, I have a second install on a different disk for just this sort of emergency. I booted to it, ran "sudo btrfs check --repair /dev/sdc3" and crossed my fingers. A few minutes later, I'm pleased to report all was repaired and I'm typing this from my main install from my now repaired btrfs file system. Just for good measure, I ran btrfs check on all my other btrfs file systems as well.
If you're interested in a bit more detail, read on:
I've been using btrfs full time since 2012. I have many btrfs filesystems. My root filesystem contained 4 installs and their homes all in separate subvolumes along with two others, so 10 subvolumes in total and about 380GB of data on a 2 disk btrfs pool consisting of two Samsung 850 Pro 256GB drives.
In 2014, I had been using an add-on SATA III card in my old PC since my mobo didn't support SATA III. After a year or so, the add-on card started randomly dropping drives off and on-line. This caused 4 bad file file extents (file system version of a drive sector) that btrfs.fsck could not repair then (2014). However, they didn't cause problems. I hunted down the damages files and replaced them. They couldn't be deleted, but I could rename them - so I did and copied clean versions into the install as replacements. The results of this was the subvolume in question could not be backed-up, but it continued to work (Kubuntu 14.04) without issue so I left it alone.
Yesterday, I was cleaning house - wiping old backups, clearing old snapshots, etc. I decided to make a full set of backups of this filesystem and delete all but Kubuntu 16.04 and KDEneon. I didn't feel I needed the others and hadn't booted to either of them in over a year. Last night, I did a send|receive backup of all the subvolumes to a backup drive (except 14.04 - still unable due to the broken extents). Tonight, I started deleting the subvolumes. I deleted three, no issue, then I attempted to delete 14.04. I assumed broken extents wouldn't matter once I deleted the subvolume, but it wouldn't let me delete it. It forced my entire filesystem to Read Only because of the error so basically I was toast for the moment. I rebooted and KDEneon came back up normally. I went to the subvolume location and not only was 14.04 still there, but two of the three other subvolumes I had deleted before were still there also. I assumed this was due to delayed "commits" (the file system finishing the action) so I deleted those two again use the --commit-each option. Then tried to delete 14.04 again. Once again - forced to Read-only. Rebooted again and this time the other subvolumes were gone (so it seems I was right about the commits) but 14.04 still there. One more attempt at deletion resulted in 14.04 subvolume deletion, but now reboot failed and I was dumped into emergency maintenance mode.
Since the file-system still mounted in emr. main. mode, I was unable to run a file check on it - if you don't know, file system check and repair is one of very few things you can't do with a btrfs file system while mounted. Luckily, I have a second install on a different disk for just this sort of emergency. I booted to it, ran "sudo btrfs check --repair /dev/sdc3" and crossed my fingers. A few minutes later, I'm pleased to report all was repaired and I'm typing this from my main install from my now repaired btrfs file system. Just for good measure, I ran btrfs check on all my other btrfs file systems as well.
Comment