All Projects → dkorunic → findlargedir

dkorunic / findlargedir

Licence: MIT License
find all "blackhole" directories with a huge amount of filesystem entries in a flat structure

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to findlargedir

InitKit
Neo-InitWare is a modular, cross-platform reimplementation of the systemd init system. It is experimental.
Stars: ✭ 364 (+2326.67%)
Mutual labels:  freebsd, unix, system
Fselect
Find files with SQL-like queries
Stars: ✭ 3,103 (+20586.67%)
Mutual labels:  utility, filesystem, find
ModernOperatingSystems AndrewTanenbaum
My notes after reading 'Modern Operating Systems' book by Andrew Tanenbaum and Herbert Bos.
Stars: ✭ 71 (+373.33%)
Mutual labels:  unix, filesystem, os
Rm Protection
A safe alternative for "rm".
Stars: ✭ 416 (+2673.33%)
Mutual labels:  unix, utility, filesystem
Ecominit
eComInit is a free init system and service manager designed to scale from lightweight desktops to web-scale cloud deployments. It aims to offer feature-parity with systemd but with a modular, portable architecture compliant with software engineering best-practice.
Stars: ✭ 352 (+2246.67%)
Mutual labels:  freebsd, unix, system
osutil
Go library to easily detect current operating system, current Linux distribution, macOS version and more...
Stars: ✭ 22 (+46.67%)
Mutual labels:  freebsd, system, os
Bfs
A breadth-first version of the UNIX find command
Stars: ✭ 336 (+2140%)
Mutual labels:  unix, filesystem, find
InitWare
The InitWare Suite of Middleware allows you to manage services and system resources as logical entities called units. Its main component is a service management ("init") system.
Stars: ✭ 164 (+993.33%)
Mutual labels:  freebsd, unix, system
Aqeous
(Inactive, Checkout AvanaOS, Rewrite of this) This is a New Operating System (Kernel right now). Made completely from scratch, We aim to make a complete OS for Learning purpose
Stars: ✭ 23 (+53.33%)
Mutual labels:  system, filesystem, os
Coherent
Coherent OS
Stars: ✭ 20 (+33.33%)
Mutual labels:  unix, os
toolkit
some useful library of the php
Stars: ✭ 15 (+0%)
Mutual labels:  system, filesystem
airyx
A BSD-based OS project that aims to provide an experience like and some compatibility with macOS (formerly known as airyxOS)
Stars: ✭ 2,490 (+16500%)
Mutual labels:  freebsd, unix
MooInfo
Visual implementation of OSHI, to view information about the system and hardware.
Stars: ✭ 83 (+453.33%)
Mutual labels:  system, os
sOS
Solar Operating System - The ASCII OS nobody asked for.
Stars: ✭ 11 (-26.67%)
Mutual labels:  system, os
FreeBSD-Ask
FreeBSD 教程——FreeBSD 从入门到跑路。
Stars: ✭ 113 (+653.33%)
Mutual labels:  freebsd, unix
duckOS
Yet another hobby x86 UNIX-like operating system written in C and C++. Features a dynamically linked userspace, an in-house c standard library, and more! And yes, it runs DOOM.
Stars: ✭ 250 (+1566.67%)
Mutual labels:  unix, os
disfetch
Yet another *nix distro fetching program, but less complex.
Stars: ✭ 45 (+200%)
Mutual labels:  system, os
Onyx
UNIX-like operating system written in C and C++
Stars: ✭ 52 (+246.67%)
Mutual labels:  unix, os
Windows10Tools
Tools for Windows 10
Stars: ✭ 45 (+200%)
Mutual labels:  utility, os
whichpm
Locates installed Perl modules.
Stars: ✭ 20 (+33.33%)
Mutual labels:  unix, filesystem

findlargedir

GitHub license GitHub release Build Status codebeat badge Go Report Card

About

Findlargedir is a quick hack intended to help identifying "black hole" directories on an any filesystem having more than 100,000 entries in a single flat structure. Program will attempt to identify any number of such events and report on them.

Program will not follow symlinks and requires r/w permissions to be able to calculate a directory inode size to number of entries ratio and estimate a number of entries in a directory without actually counting them. While this method is just an approximation of the actual number of entries in a directory, it is good enough to quickly scan for offending directories.

Caveats

  • requires r/w privileges for an each filesystem being tested, it will also create a temporary directory with a lot of temporary files which are cleaned up afterwards
  • does not work on FreeBSD 7.x and EMC Isilon 7.1 due to kernel stat structure incompatibilities with a recent FreeBSD kernel structure mapped in Golang syscall *Stat_t
  • accurate mode (-a) can cause an excessive I/O and an excessive memory use; only use when appropriate
  • on EMC Isilon OneFS >= 7.1 and < 8.0 it needs isilon mode (-7 parameter) due to differences in OneFS kernel stat structure
  • older FreeBSD systems (<8.3) and derivatives such as EMC Isilon OneFS < 7.2 without open O_CLOEXEC support require cloexec mode (-x parameter)

Installation

There are two ways of installing findlargedir:

Manual

Download your preferred flavor from the releases page and install manually.

Using go get

go get https://github.com/dkorunic/findlargedir

Usage

Usage:

Usage: findlargedir [-7ahopx] [-c value] [-t value] [parameters ...]
 -7, --isilon    enable support for EMC Isilon OneFS 7.x
 -a, --accurate  full accuracy when checking large directories
 -c, --testcount=value
                 set initial file count for inode size testing phase (default
                 20000)
 -h, --help      display help
 -o, --onefilesystem
                 never cross filesystem boundaries
 -p, --progress  display progress status every 5 minutes
 -t, --threshold=value
                 set file count threshold for alerting (default 50000)
 -x, --cloexec   disable open O_CLOEXEC for really ancient Unix systems

When using accurate mode (-a parameter) beware that large directory lookups will stall the process completely for extended periods of time. What this mode does is basically a secondary fully accurate pass on a possibly offending directory calculating exact number of entries.

When unsure of the program progress feel free to send SIGUSR1 or SIGUSR2 process signals (on Windows try with ^C) to see the last processed path or use progress flag (-p parameter) to see continous 5-minute status updates.

If you are trying to run it on EMC Isilon OneFS >= 7.1 and < 8.0 (based on FreeBSD 7.4), make sure to add isilon mode with -7 parameter otherwise program will detect invalid st_size and skip all filesystems. OneFS 8.0+ releases don't require use of -7 parameter. This will work only on 386 and amd64 platforms.

If you have really ancient FreeBSD system (<8.3) or a derivative such as EMC Isilon OneFS (<7.2) and program fails to create temporary files, try using cloexec mode with -x parameter. This will work only on 386 and amd64 platforms.

If you want to avoid descending into mounted filesystems (as in find -xdev option), use onefilesystem mode with -o parameter. This will not work on Windows however.

Typical use case to find possible offenders on several filesystems:

root@box:~# findlargedir -c 10000 -t 50000 -a /var /home
2018/09/04 08:13:16 Note: program will attempt to alert on directories larger than 50000 entries by default.
2018/09/04 08:13:16 Determining inode to file count ratio on "/var". Please wait, creating 10000 files...
2018/09/04 08:13:16 Done. Approximate directory inode size to file count ratio on "/var" is 26.2144.
2018/09/04 08:13:21 Found 0 large directories in "/var".
2018/09/04 08:13:21 Determining inode to file count ratio on "/home". Please wait, creating 10000 files...
2018/09/04 08:13:21 Done. Approximate directory inode size to file count ratio on "/home" is 27.0336.
2018/09/04 08:13:21 Directory "/home/user/torrent" is possibly a large directory with ~100k entries.
2018/09/04 08:13:21 Calculating "/home/user/torrent" directory exact entry count. Please wait...
2018/09/04 08:13:21 Done. Directory "/home/user/torrent" has exactly 99164 entries.
2018/09/04 08:13:21 Found 1 large directories in "/home".
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].