[solved] Issues with btrfs balance of cache pool


Recommended Posts

Hi,

 

I recently installed a second SSD and created a btrfs cache pool. After a while I noticed performance degradation and came across several suggestions by @johnnie.black. After running:

 

btrfs balance start --full-balance /mnt/cache

 

and

 

fstrim -v /mnt/cache

 

performance was back to normal. Hence, I wanted to add a weekly script with:

 

btrfs balance start -dusage=75 /mnt/cache

 

This leads to the following error message: "ERROR: cannot access '/mnt/cache': No such file or directory" while the original command still works.

 

Running " btrfs device stats /mnt/cache" only worked once, usually I get "ERROR: cannot check /mnt/cache: No such file or directory" and "ERROR: '/mnt/cache' is not a mounted btrfs device".

 

Not sure what is going on here. Any help is much appreciated.

 

My diagnostics file:

 

EDIT: link removed

 

Thanks!

Seige

Edited by Seige
Link to comment

Thanks for the quick response! :)

 

I have copy pasted both commands from some of your posts. At the moment both commands work, but e.g.

 

btrfs fi df /mnt/cache

Does lead to the same "ERROR: cannot access '/mnt/cache': No such file or directory"

 

Could it be that these commands cannot be executed one after another? 

 

Edited by Seige
Link to comment
10 minutes ago, johnnie.black said:

There should be no problem with that.

 

Maybe putty does not like copy pasting from the web browser. I carefully ran it through Notepad++ and double checked all characters and seems to work for balance and stats. But  command

btrfs fi df /mnt/cache

still produces the error. Also tried the build in web terminal, same results. I feel rather inapt o.O

 

EDIT: It seems to work, when I type it manually. Not sure where this is coming from, never had any issues with copy paste before.

Edited by Seige
Link to comment

It's sometimes possible to get into troubles because of differences in line endings between Linux and Windows.


Windows uses a two-character sequence (carriage return + line feed) while Linux just uses the second character.


This means it's possible to paste a carriage return from the windows machine that ends up as a hidden character at the end of the pasted command.

And then follows the line feed that Linux sees as the real end of the line.

 

So your command could end up as:

btrfs fi df /mnt/cache^r

where ^r is that hidden carriage return character.

 

And btrfs can then treat this hidden character as an additional character belonging to the mount path.

 

If the above is what happens, then it can make a difference how you make your copy/paste selection on the Windows side.

 

When using the mouse to mark things for copying on Windows, it can often be a good idea to start from the right hand side of the line to copy and mark to the left. Then you avoid the selection logic in the program from also including the line ending in the selection. A number of programs will include the line ending when you select from left-to-right. You'll notice because directly when you paste on the Linux command line, Linux will execute the pasted line instead of waiting for you to press enter.

  • Like 1
Link to comment

 

5 minutes ago, Seige said:

Thank you @pwm for your additional explanation! I was not familiar with this, but it looks like that this is exactly what happened. I was able to replicate the issue depending on the way I use copy/paste from inside of windows.

 

The IT world is full of black magic. Until you know what happens it can be almost impossible to figure out the almost random outcomes.

 

And as software developer, it isn't always possible or practical to catch and hide all the strange magic from end users.

 

In the end, we'll just have to help each other.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.