How can I see if a (disk) block device is in use?
From: Leon Woestenberg <hidden>
Date: 2007-10-09 15:07:20
From: Leon Woestenberg <hidden>
Date: 2007-10-09 15:07:20
Hello, from userspace, how can I reliably see if a (hard disk) block device (say /dev/sda) is in use (either by the kernel, say through md or by any userspace application such as dd)? I would like to perform this check in a generic way, i.e. not per-se md related. Although the question is non-md specific, it is slightly related to this behaviour: $sfdisk -R /dev/sdb <race condition> $mdadm --assemble /dev/md0 --run /dev/sda /dev/sdb /dev/sdc mdadm: cannot open device /dev/sdc1: No such file or directory mdadm: /dev/sdc1 has no superblock - assembly aborted $sfdisk -R /dev/sdb <race condition> $sleep 1 $mdadm --assemble /dev/md0 --run /dev/sda /dev/sdb /dev/sdc this works Regards, -- Leon