mountsnoop(8)
๐ mountsnoop(8) ๐
mountsnoop โจ is a tracing tool that sneaks a peek at the mount() and umount() syscalls. It's a Linux eBPF/bcc tool, so it's built on the good stuff. ๐
๐ธ NAME ๐ธ
mountsnoop - Trace mount() and umount() syscalls. Uses Linux eBPF/bcc.
๐ SYNOPSIS ๐
mountsnoop
โจ DESCRIPTION โจ
okay so mountsnoop watches the mount() and umount() syscalls and shows you which processes are mounting and unmounting filesystems, and which mount namespaces they're doing it in. ๐ง This is seriously useful when you're troubleshooting system or container setup. ๐ซถ
Under the hood, it works by tracing the kernel sys_mount() and sys_umount() functions using dynamic tracing. ๐ The catch? If those functions ever change in the kernel, this tool will need updating to match. ๐
It also makes use of a Linux 4.8 feature, bpf_get_current_task(), so your kernel needs to be at least that new. ๐
โ ๏ธ Since this uses BPF, only the root user can use this tool. No cap, it's a root-only situation. ๐
๐ฆ REQUIREMENTS ๐ฆ
You'll need CONFIG_BPF enabled in your kernel, plus bcc installed. ๐
๐ FIELDS ๐
Here's what shows up in the output:
COMMโ the process name ๐ฃPIDโ the process ID ๐ชชTIDโ the thread ID ๐งตMNT_NSโ the mount namespace inode number ๐CALLโ the system call, its arguments, and its return value ๐
๐ OVERHEAD ๐
Okay, the vibe check on performance: mountsnoop traces the kernel mount and umount functions and prints output for every event. Since these calls are generally expected to happen at a very low rate, the overhead is also expected to be negligible. ๐
Lowkey though, if your system calls mount() and umount() at a high rate, you need to test and understand the overhead before you use it. ๐จ
๐ SOURCE ๐
This one comes from bcc, the BPF Compiler Collection, which lives at:
https://github.com/iovisor/bcc
Also, go check the bcc distribution for a companion _examples.txt file. It has example usage, output, and commentary for this tool, and it's giving very helpful energy. ๐
๐ซง OS ๐ซง
Linux only, bestie. ๐ง
๐งช STABILITY ๐งช
Unstable - in development. ๐ง Don't be shocked if things shift around.
๐ AUTHOR ๐
Written by Omar Sandoval. Iconic. ๐
๐ฎ SEE ALSO ๐ฎ
๐ธ Bestie, that's the whole page. This is the USER COMMANDS section, last updated 2016-10-14, and it's a manual page for mountsnoop(8). Now go trace some mounts and be obsessed with it. ๐ โจ๐ฆ
๐ฆ where this page comes from
- alpine 3.24: bcc-doc 0.36.1-r1 ยท Apache-2.0
- nixpkgs unstable: bcc 0.37.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 ยท Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 ยท Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 ยท Apache-2.0
- opensuse-leap 16.0: bcc-tools 0.35.0-160000.2.2 ยท Apache-2.0
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms