disk_check_media_change(9)
π disk_check_media_change(9) β the kernel API manual, bestie edition π
okay so picture this: it's a page out of the Kernel API Manual, and it's all about one tiny lil function that answers the question every removable-media disk has been dying to ask β did somebody swap the disc while I wasn't looking?? πβ¨
β¨ NAME β¨
disk_check_media_change β check if a removable media has been changed π¦
like, literally that's the whole job. vibe check for your media. ππ
πΈ SYNOPSIS πΈ
bool disk_check_media_change (struct gendisk *disk );
yes bestie that's a bool β we're getting a true or a false, no in-between, no "it depends", no π² chaos. icon behaviour fr fr. π
π ARGUMENTS π
diskβ thegendiskyou wanna check. that's it. that's the whole argument list. one (1) gendisk, hand it over and let the function cook. π
π DESCRIPTION π
so here's the tea β: this function looks at your removable media and tells you whether it changed.
- If the media has been changed β it returns
trueand marks the disk for a partition rescan. ππ₯ two-for-one, no cap. - If the media did not change β it returns
false. that's it. nothing happens. go home. π
the whole "marks the disk for a partition rescan" part is lowkey the main character energy of this function β you don't just get a yes/no, you get the disk queued up to get looked at again. periodt. πβ¨
π SEE ALSO π
the whole squad lives in the kernel file ./block/disk-events.c β go say hi:
disk_block_events(9)disk_unblock_events(9)disk_flush_events(9)disk_clear_events(9)disk_force_media_change(9)
π«Ά friendly reminder: this page is filed under ./block and it's dated October 2026 β so yes, the future called, and it's still checking whether you swapped the disc. π
β¨
go off bestie, may all your media changes be detected πΈππ¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms