Turn off usb hard drive

I have an external USB hard drive connected to a netbook with OpenWrt and I can't find anywhere how to eject it or turn it off (that's the idea).

you can simply unmount it, then unplug/turn off.

umount </path/to/drive/>
1 Like

there's a luci-app-hd-idle + hd-idle package.

2 Likes
root@netbook:~# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0 267.2M  0 loop /overlay
sda      8:0    1   1.9G  0 disk 
├─sda1   8:1    1    16M  0 part /boot
│                                /boot
└─sda2   8:2    1   300M  0 part /rom
sdb      8:16   0   1.8T  0 disk 
└─sdb1   8:17   0   1.8T  0 part /mnt/sdb1
root@netbook:~# umount /dev/sdb
umount: can't unmount /dev/sdb: Invalid argument

I have it installed but I see that it is to schedule the shutdown, not to eject the disk as in any Linux distro.

Try

umount /mnt/sdb1

I don't see the drive turning off (the light is on and it's still spinning).

root@netbook:~# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0 267.2M  0 loop /overlay
sda      8:0    1   1.9G  0 disk 
├─sda1   8:1    1    16M  0 part /boot
│                                /boot
└─sda2   8:2    1   300M  0 part /rom
sdb      8:16   0   1.8T  0 disk 
└─sdb1   8:17   0   1.8T  0 part /mnt/sdb1
root@netbook:~# umount /mnt/sdb1
root@netbook:~# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0 267.2M  0 loop /overlay
sda      8:0    1   1.9G  0 disk 
├─sda1   8:1    1    16M  0 part /boot
│                                /boot
└─sda2   8:2    1   300M  0 part /rom
sdb      8:16   0   1.8T  0 disk 
└─sdb1   8:17   0   1.8T  0 part

it cannot shut down the drive... but the unmounting process appears to have worked. From here you can unplug or turn it off manually.

1 Like

You can flip USB port power with uhubctl?

root@netbook:~# uhubctl
No compatible devices detected!
Run with -h to get usage info.

Then it is not supportes in that SoC :frowning: