Stop using a SATA drive

Polytropon freebsd at
Sat Aug 29 20:08:13 UTC 2015

On Fri, 28 Aug 2015 13:17:58 -0700, Chris Stankevitz wrote:
> On Thu, Aug 27, 2015 at 3:06 PM, Polytropon <freebsd at> wrote:
> > But on the other hand, what's wrong with _ignoring_ a
> > device file you don't want to have anything to do with?
> From my OP:
> > I imagine I would feel confident that nothing is using it
> > if the drive disappeared from /dev
> My only interest in the device file going away was that I would
> suddenly become confident that it is not in use (e.g. by smartd,
> gpart, etc).  If there is another way to become confident that a
> device is not in use then that would be okay too.
> "Device file disappearing" would only be useful to me if it happened
> before the drive was "ejected", not after.

The remaining question is: Is it technically valid to
remove a device special file from the devfs file system
corresponding to a device that currently is not in use
(anymore), but is _present_ (attached to the system in
some way)?

You can _almost_ be sure that a storage device is not
in use when it is not mounted. The only case where this
is not the case is when you're accessing raw devices,
for example when making a backup from (or to) an unmounted
partition. In this case, paying attention is required. :-)

So relying on mount itself is not sufficient. You'd have
to query the device driver for pending actions (like
reads or writes). Only when there's noting to be done,
device removal should be safe.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list