How can I check if a given block device is in use (i.e., mounted, used as swap, used as a software RAID device etc.)?
One could technicaly check /proc/swaps, /proc/mdstat, /etc/mtab, etc., but that's just checking in lots of places. And it doesn't cover everything (i.e. LVM, dm-crypt etc.).
Is there a generic way to check if a given block device is in use?