On Thu, Feb 09, 2023 at 11:02:14AM -0500, Bryan Steele wrote:
> On Wed, Feb 08, 2023 at 10:34:07AM -0300, vitmau...@gmail.com wrote:
> > Hi,
> > 
> > I'm not using my drives for anything more than copying files, dd etc.
> > I just got curious because you mentioned the act of detaching a device
> > after umounting it and I don't know how to do that on OpenBSD. On
> > Fedora I would issue "udisks --detach /dev/sdX" (older versions) or
> > "udisksctl poweroff -b /dev/sdX" (newer versions).
> > 
> > Best,
> > Vitor
> 
> Umounting should be good enough, but you can also use eject(1), which
> should have the desired effect, e.g:

Eject is slightly different.

When you use eject against an sd device, it's basically setting a flag that
says, 'once any outstanding I/O is finished on this device, then mark it
offline', (I.E. no media present).

So if you have running, for example:

# dd if=/dev/rsd1c of=/dev/null bs=1m count=256 &

and then do an eject from a different terminal, it should let the dd process
complete, and then off-line the device.

> You'll need to physically reconnect the drive if you want to use it again.

Yes, although it's still active at the usb level, as far as the sd driver
is concerned, the device has no media present.

There is no reason why we couldn't implement support for 'eject -t' for sd
devices, (which is internally treated as a tape retension command).

In fact, I just made a patch to do that out of curiosity and was able to
access the usb device again after 'reloading' it.  Probably pointless but
a fun (*) programming exercise.

(*) Depends on your definition of fun, obviously.

Reply via email to