1

I got Pi4 4Gb running rasbian (similar to Debian) and Orico 4bay HDD rack connected with USB3.

Earlier with same host and one HDD in separate enclosure I was able to power off disk using:

sudo udisksctl power-off -b /dev/sda

But now, for this four disks enclosure rack I got errors like this:

pi@raspberrypi:~ $ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda           8:0    0 931.5G  0 disk  
└─sda1        8:1    0 931.5G  0 part  
  └─md0       9:0    0 931.4G  0 raid1 /mnt/raid
sdb           8:16   0 931.5G  0 disk  
└─sdb1        8:17   0 931.5G  0 part  
  └─md0       9:0    0 931.4G  0 raid1 /mnt/raid
sdc           8:32   0   2.7T  0 disk  
└─sdc1        8:33   0   2.7T  0 part  /mnt/wdred
sdd           8:48   0   1.8T  0 disk  
└─sdd1        8:49   0   1.8T  0 part  
mmcblk0     179:0    0  14.8G  0 disk  
├─mmcblk0p1 179:1    0   256M  0 part  /boot
└─mmcblk0p2 179:2    0  14.6G  0 part  /
pi@raspberrypi:~ $ sudo umount /mnt/raid 
pi@raspberrypi:~ $ sudo umount /mnt/wdred 
pi@raspberrypi:~ $ sudo udisksctl power-off -b /dev/sdc
Error powering off drive: Error opening /dev/sdb for fsync: Device or resource busy (udisks-error-quark, 0)
pi@raspberrypi:~ $ sudo udisksctl power-off -b /dev/sda
Error powering off drive: Error opening /dev/sdb for fsync: Device or resource busy (udisks-error-quark, 0)
pi@raspberrypi:~ $ sudo udisksctl power-off -b /dev/sdb
Error powering off drive: Error opening /dev/sdb for fsync: Device or resource busy (udisks-error-quark, 0)
pi@raspberrypi:~ $ sudo udisksctl power-off -b /dev/sdd
Error powering off drive: Error opening /dev/sdb for fsync: Device or resource busy (udisks-error-quark, 0)
pi@raspberrypi:~ $ 

If I shutdown pi and the turn off this rack with power button on it I see increment of Power-Off_Retract_Count attribute in HDD Smart (so this is not graceful power off, but emergency retract).

How can I properly power off drives in this rack?

garik f
  • 11
  • 2
    Device or resource busy is the problem. Something(s) are using the drives. – RonJohn Apr 01 '23 at 07:27
  • 1
    https://unix.stackexchange.com/questions/43413/how-can-i-safely-remove-a-sata-disk-from-a-running-system (from comments in the accepted answer, step 5 is more useful than step 4 and step 4 should not be done). You'll have to do something about MD raid (since this answer covers only DM raid). – A.B Apr 01 '23 at 07:27

1 Answers1

1

After the umount commands, you should do a

sudo mdadm --misc --stop /dev/md0

and make sure it's successfully completed before trying to power off drives.

Since you are getting "device or resource busy" errors on all four disks (even from the non-RAID sdc and unmounted sdd, the next step would be to ensure you don't have any disk monitoring software (e.g. smartd) running, and stop them first if you do.

You might also want to use sudo fuser -v /dev/sd* to see if any processes are still using the disks before trying to power them off.

telcoM
  • 96,466