0

udisks exists for regular users, root must (and is) able to live without it, I need help figuring out how.

The goal is to do exactly what

udisks power-off /dev/sdX

does without udisks. hdparm is out of question, as it is assumed that UAS (https://linux-sunxi.org/USB/UAS) is in use and ATA pass-through is broken, which is the case for many external drives (i.e. all Seagate enclosures, see https://www.smartmontools.org/wiki/SAT-with-UAS-Linux).

To physically stop the drive from spinning I have successfully employed

scsi_stop /dev/sdX

which is a part of the sg3-utils (Debian and derivatives) package. Then, to remove the drive from the system, I used

echo 1 > /sys/block/sdX/device/delete

These two steps do most of, but not all the work. The block device itself is removed and is not visible anymore, however, the drive is still visible as a USB device through lsusb, which is not the case with udisks power-off. So how do I finish it?

3
  • 1
    no, root can use udisks just as well – your opening premise seems wrong. Commented Aug 1, 2024 at 18:49
  • I need to do it without udisks. My premise is correct. Whatever you can do with udisks you must to be (and are) able to do without udisks. Commented Aug 1, 2024 at 19:37
  • not saying anything in that direction! It's just incorrect to assume root can't use udisks. Commented Aug 1, 2024 at 19:48

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.