1

I have external SSD that I want to safely remove (as part of automation):

lsblk
NAME                  MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0                   7:0    0  89.3M  1 loop /snap/core/6673
loop1                   7:1    0    91M  1 loop /snap/core/6350
sda                     8:0    0  29.3G  0 disk
├─sda1                  8:1    0     1M  0 part
└─sda2                  8:2    0  29.3G  0 part /
sdb                     8:16   0 111.8G  0 disk
├─sdb1                  8:17   0   512M  0 part
├─sdb2                  8:18   0   732M  0 part
└─sdb3                  8:19   0 110.6G  0 part
  ├─goldVM--vg-root   253:0    0 109.6G  0 lvm
  └─goldVM--vg-swap_1 253:1    0   980M  0 lvm
sr0                    11:0    1  1024M  0 rom

Running:

udisksctl power-off --block-device /dev/sdb

Results in:

Error powering off drive: Error opening /dev/sdb: Device or resource busy (udisks-error-quark, 0)

After trying eject/udisksctl unmount that didn't do the trick I followed response from here:

echo 'offline' > /sys/block/sdb/device/state
echo '1' > /sys/block/sdb/device/delete

Which did lead to remove of sdb, but when I connect the device (unplug and plug again) it shows up as sdc, leading me to believe there is some occupied resource.

How to make sure all resources are properly freed, and ensure external device will be always connected to same device port?

  • You can try to use man 1 eject instead. Hope it helps. – Yurij Goncharuk Apr 30 at 8:32
  • not working, for now I have work around for not using the same device, it seems a bit ambiguous the inner working of the SCSI resource management – LordTitiKaka Apr 30 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.