Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mergerfs.balance] balance only specified disks #86

Closed
CWempe opened this issue Jul 10, 2019 · 10 comments
Closed

[mergerfs.balance] balance only specified disks #86

CWempe opened this issue Jul 10, 2019 · 10 comments

Comments

@CWempe
Copy link

CWempe commented Jul 10, 2019

Lets say I have a pool with three disks.

  • disk1 (60%)
  • disk2 (70%)
  • disk3 (70%)
  • disk4 (90%)

disk1 containes /other_stuff/.
disk2 containes /Media/Movies/.
disk3 containes /Media/Movies/.
disk4 containes /Media/TV Shows/.

Now I created a folder /Media/TV Shows/ on disk3.

If I start mergerfs.balance the tool starts to move files from /Media/TV Shows/ to disk1 instead of disk3 where the parent folder already exists.

Is there a way I can prevent mergerfs.balance from creating new directories when there is already a matching directory on a disk with less free space?

Otherwise I would like to see a feature to exclude (or include) specific disks from the balancing job.

@trapexit
Copy link
Owner

The general idea is to balance across all drives in the pool so no it doesn't try preserving paths because you can't know without a full scan and somewhat complex binning what would be a optimal "balance".

Exclude from the target drives?

@CWempe
Copy link
Author

CWempe commented Jul 11, 2019

Exclude from the target drives?

Yes.
Like mergerfs.balance /Media/TV Shows -exclude-disk /dev/disk1 -exclude-disk /dev/disk2

I thought it might have been easy to implement because if I copy files manually to /Media/TV Shows mergerfs knows which disks already have the needed directory and balances to files correctly.

But if it is not easy to implement, ok. :)

@trapexit
Copy link
Owner

Its easy... just want to make sure I understand the behavior you're looking for. The tool doesn't actually write data through mergerfs. It only uses it to query the underlying information needed moves files between the drives directly. That said if its simply removing drives from the list of targets its a simple process of just black listing those drives.

@CWempe
Copy link
Author

CWempe commented Jul 11, 2019

I manually moved my files like I wanted, now.

So if this feature will be implemented I think I wont need it anytime soon. :)

But thanks for the quick response.

@trapexit
Copy link
Owner

It just dawned on me that this is already supported.

  -E EXCLUDEPATH, --exclude-path EXCLUDEPATH
                        fnmatch compatible path filter (can use multiple
                        times)

You can exclude the drives based on their mount point.

-E '/mnt/drive_i_dont_want/*' -E '/mnt/other_drive_i_dont_want/*'

@trapexit trapexit closed this as completed Sep 2, 2019
@undaunt
Copy link

undaunt commented Jun 26, 2020

@trapexit I'm not sure if this is doing what I would expect it to do. I am trying to exclude a drive from being balanced to as a destination, not exclude a drive as being balanced from.

Currently, I'm attempting to exclude a drive, let's call it drive 4, from a balance process. Drive 4 currently has the least used disk space. Disk 3 has slightly more used space, and disks 1 and 2 are almost full.

My intent is to wholly exclude any data from winding up on disk 4, and by running balance and excluding disk 4, balance out some portion of data from the more full disk(s) to disk 3.

If I do the following, it immediately begins trying to copy data from disk 1 to disk 4.

mergerfs.balance /mnt/storage/media/ -E '/mnt/disk4/*'

/mnt/storage is the mergerfs mount of disks 1 - 4. Is this what should be happening? Am I just misunderstanding the feature set? Thank you.

Edit: My conceivable workaround right now would be to create a duplicate mergerfs mount of only disks 1 - 3 in a temporary mount point and run balance against that.

@trapexit
Copy link
Owner

The exclude arguments is about excluding the files from being balanced. Not about excluding targets. As the descriptions mention they are file and path filters. The targets are just the list of branches. If you want that that'd be a new feature.

@undaunt
Copy link

undaunt commented Jun 26, 2020

Makes sense. I think I was asking similarly for what CWempe wanted above - to prevent the disk with the least used space from having things copied to it if another disk, with more used space but less than the full disk, already has that directory - and then you had said the feature already exists, so maybe I misunderstood.

I'll just stand up a temp mount that doesn't include disk4 to run the balance.

@trapexit
Copy link
Owner

I was under the impression that the question was about excluding the drive from picking up files from "target" disks. Maybe I misunderstood. Regardless, it's trivial to add removing drives from being targets.

@undaunt
Copy link

undaunt commented Jun 26, 2020

If it would be simple to add, that would truly be excellent. Thanks either way, I'm sure you're busy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants