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

GDU not ignoring directory #34

Closed
mahomedh opened this issue Mar 12, 2021 · 6 comments
Closed

GDU not ignoring directory #34

mahomedh opened this issue Mar 12, 2021 · 6 comments
Assignees

Comments

@mahomedh
Copy link

Hi

I can't seem to get gdu to ignore a directory. It still shows it as scanning.

gdu --version
Version:         v4.8.0
Built time:      Mon Mar  8 09:36:18 PM CET 2021
Built user:      dundee

Ubuntu 20.04.2 LTS

I have multiple directories that I want to scan inside /mnt/backups/minio but I want to exclude /mnt/backups/minio/dirC

/mnt/backups/minio
    dirA
    dirB
    dirC
    dirD
    dirE

I have tried:

cd /mnt/backups/minio
gdu /mnt/backups/minio -i /mnt/backups/minio/dirC
gdu /mnt/backups/minio -i /mnt/backups/minio/dirC/
gdu /mnt/backups/minio -i "/mnt/backups/minio/dirC"
gdu -i /mnt/backups/minio/dirC/
gdu -i /mnt/backups/minio/dirC /mnt/backups/minio
gdu -i "/mnt/backups/minio/dirC" /mnt/backups/minio
gdu -i "dirC" /mnt/backups/minio
gdu --ignore-dirs /mnt/backups/minio/dirC
gdu --ignore-dirs=/mnt/backups/minio/dirC

Probably tried several other combinations too. But every time it is still scanning dirC every time. The main reason for excluding dirC is because it has a lot of hard links which I think gdu is struggling with, but that's a different issue.

@dundee
Copy link
Owner

dundee commented Mar 12, 2021

That is strange. gdu /mnt/backups/minio -i /mnt/backups/minio/dirC should work properly, just tested similar case locally.

Do you have something not ordinary? Maybe case insensitive file system?

@dundee dundee self-assigned this Mar 12, 2021
@mahomedh
Copy link
Author

It's a standard Ubuntu 20.04 install. The partition is ext4. The directories inside /mnt/backups/minio/ are actually minio buckets. dirC is actually the bucket used for storing backup data from urbackup but I can't see anything that would make this directory anymore special than the other directories at that same level.

I can try to provide any other info if you can tell me what you need.

@dundee
Copy link
Owner

dundee commented Mar 15, 2021

Do you have some symlinked directories on the path? Maybe gdu is getting different absolute path.

@mahomedh
Copy link
Author

Yes /mnt/backups/minio/urbackup (or /mnt/backups/minio/dirC as per my example) has lots of symlinks inside of it. Even du and ncdu take absolute ages to process this directory. That's the reason I was trying to exclude it.

Does --ignore-dirs in gdu do pre or post filtering? It sound like it is probably doing post filtering and that's why I am still seeing it processing that directory and if I wait long enough for it to finish, then it will exclude that directory from the final display (I guess I could test it).

If that's the case, it's looking like my only option is going to be to go through each top-level directory separately to then be able to ignore dirC.

@dundee
Copy link
Owner

dundee commented Mar 17, 2021

Gdu does pre filtering. It checks absolute path of the every directory when entering it and checks if it matches some of the ignored dirs paths (exact match). If it matches, it ignores the directory completely.

My guess is that gdu sees different absolute path than /mnt/backups/minio/dirC.

I could probably add some debug flag to log all directory paths which are processed.

@dundee dundee closed this as completed Oct 11, 2021
@mgarort
Copy link

mgarort commented Mar 7, 2023

Hello,

I just encountered the same issue. Indeed, the reason why gdu was still looking at the directory to ignore was that the directory to ignore was reachable through a symbolic link in my home directory. I fixed it by ignoring the path through the symbolic link as well.

To be more specific, what I did was: instead of gdu --ignore-dirs /absolute/path, I did gdu --ignore-dirs /absolute/path,/absolute/path/through/symbolic/link.

The way that du indicates to ignore directories is through relative paths. Perhaps this would make it easier to avoid situations like mine or @mahomedh 's. @dundee perhaps this is worth looking into?

Thanks.

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