BTRFS reports errors but does not fix them

brtrfs check --repair /dev/sda1

Reports a list of errors that mostly contain “no inode item, link count wrong”.

But it does not fix the errors.

What should be done next?

Run fsck with the partition NOT mounted. You can not fix a mounted file system

There may be a great risk in using fsck with a btrfs filesystem. There shod be an equivalent in btrfsprogs.

fsck is just a shell the calls the appropriate fix program for the file system in question

No where did I say that the drive was mounted.

FSCK says, specifically, to use the BTRFS tool on a BTRFS file system.

Nor did you say it was not mounted, so we simply do not know.
It is a common error to try to fix a broken file system when mounted, thus gogalthorpe’s remark is very valid.
Also, while Btrfs is mostly only used on the root file system (it is the installation default on the root file system only) and because many people will probably forget that they have to unmount the root file system, which means that the system must be down and another system (life, rescue, multi-boot or whatever) must be booted, it is also very valid to remind people that this is a must.

And that is of course valid for fsck and the btrfs tool.

On Thu 06 Oct 2016 12:16:01 PM CDT, SUSEtoad wrote:

Code:

brtrfs check --repair /dev/sda1

Reports a list of errors that mostly contain “no inode item, link count
wrong”.

But it does not fix the errors.

What should be done next?

Hi
Have a read here;
https://btrfs.wiki.kernel.org/index.php/Btrfsck

The option you tried appears to be a last resort option…

Is this on the disk you used dd to copy to?


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
openSUSE Leap 42.1|GNOME 3.16.2|4.1.31-30-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

No. This is a physically separate drive where I keep /home. I reasoned that it was a good idea to scan the drive for errors after dealing with the previous re-install. It seems that I was right - the drive does need repair.

If BTRFS is not suitable for /home should I erase and re-build from backups?

What file system is more suited for /home?

On Thu 06 Oct 2016 01:46:01 PM CDT, SUSEtoad wrote:

hcvv;2795012 Wrote:
> Also, while Btrfs is mostly only used on the root file system (it is
> the installation default on the root file system only)
If BTRFS is not suitable for /home should I erase and re-build from
backups?

What file system is more suited for /home?

Hi
Depends an what you consider /home. I use /home on btrfs as a subvolume
so it’s excluded from snapshots. I use xfs (which is the default for
openSUSE /home) on a data partition (/data) which has symlinks to the
files I want to use in /home/username. I just have a script the setups
my desired user config.

I have no interest in system backups (apart from a few config files), if
snapper rollback doesn’t work (which I haven’t struck yet), simpler and
less time consuming for a re-install.


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
openSUSE Leap 42.1|GNOME 3.16.2|4.1.31-30-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

I think of “/home” as the directory where user home directories live and where all user documents, photos, music, configurations, preferences, etcetera are.

I use a completely separate drive and mount it as “/home” in fstab.

Please explain your method of having /home as a BTRFS subvolume but then using a separate /data partiton that you symlink to. I don’t understand why you would not simply mount the “data” partiton as /home. There must be an advantage to your way that I don’t yet know.

It sounds like XFS is more suitable? I was under the impresstion that BTRFS was “the future” and best.

XFS is default home FS. EXT4 is still a god choice. BTRFS seems stable now for the most part (no FS is perfect in all circumstance ) But since it has so many bells and whistles it is also complicated

Hi
I just run expert partitoner on the install and rescan the drive and don’t create a home. I could as my user then create a snapshot if I want to (thinking towards the future). But the main reason is multibooting and the separation of the user config files etc.

I also only use small SSD’s on my systems 120GB (except the MacBook it has a 240GB) so I can share data and not duplicate, I also have a NAS with data to share/backup across all systems ( 7 physical, 13 operating systems [2 winX, 1 osX and 10 openSUSE/SLE]).

OK. It sounds like there is no fix for the errors I am seeing and BTRFS is not a good choice for /home user data anyway.

What is the correct way to erase and rebuild from backups?

My first plan would be:

  • Boot from a USB drive.
  • Erase and reformat the “data” drive using XFS.
  • Copy the user directories from backups to the newly-formatted drive.
  • Edit the fstab file to use the new UUID to mount /home.

I assume that after re-start, will be able to log in and my user home & files will be as they were? Or will there be a permissions problem between the log-in account and the copied files from the backups?

Hi
Just make sure you set/check the username directory and contents are owned by the user and group users.

Set the partition to xfs defaults 1 2 in fstab as well.

And when you use cp for copying all in /home, run as root and use the -a option to preserve mode, ownership, timestamps.

In follow-up, the re-format and re-build from backup went well.

I used System Rescue CD as a neutral environment to reformat and copy.

I used cp -var as root to to the copying.

Thanks to everyone for their help.