HLK wrote:# ls /media/SD_Card1/
led mlwG3_v;telnetd; .x.x.bin System Volume Information
# umount /media/SD_Card1/
# ls /media/SD_Card1/
#
# mount /dev/mmcblk0p1 /media/SD_Card1/
# ls /media/SD_Card1/
led mlwG3_v;telnetd; .x.x.bin System Volume Information
#
Type in
to get the help page about gpios.
You can contact me here:
forum (at) linka.systems
Yesterday night I tested this and... long story short: this device will NEVER totally disconnect your portable hard drive. Even after you totally power off the reader, because of the powerbank functionality, the USB port remains powered with electricity, so the hard drive will remain turned on.
Now the long story: initially I thought that umount is not working because the LED on the hard drive remained turned on after I gave the umount /media/USB1 command and checking with ls /media/, both SD_Card1 and USB1 was present, and I found that strange. When I give Safely Remove Hardware from Windows, not only the hard's partition disappeared from the Explorer, the hard's LED turned off too, meaning it was totally shut down. I was expecting the same behavior from Linux too.
Until now, I don't really unmounted devices from Linux, and for sure not by using the terminal. Even from Windows I rarely unmount something, I usually turn off the computer and I take it out after. I proceed this way with my Raspberry Pies too, and I expected this behavior with this card reader. When I saw that is not the case, and read in it's manual that the USB is always under power, so that you could recharge your phone without needing to power on the whole card reader with WIFI and all (this way preserving some power in the battery), I decided that I will unmount and eject the hard drive manually.
I tried eject, detach, udisks, udiskssctl power-off, suspend and nothing worked, only umount. After I tried how you pointed it out, I was curious what is the exact equivalent solution in Linux for Windows's Safely Remove Hardware and my conclusion was that it is not quite possible, at least not on this Linux that is on this card reader. More information on this blog.
So the remaining possibilities are:
1. When you power off the device, there are a few seconds when both the device and the hard drive are powered off. Unplug the hard drive at that moment, before the device enters in powerbank functionality.
2. Unmount the hard drive and hope for the best: the internal mechanism of the hard drive to be in stand by so that, by disconnecting it from the USB port, nothing will be damaged in the hard drive. Today's hard drives are build to last, and being portable I guess the manufacturers thought about these situations as well.
3. While I was studying what else is on this Linux version, I've found a script in /sbin/ folder called safe_remove.sh. Here it is it's content:
# vi /sbin/safe_remove.sh
#! /bin/sh
if [ "$1" == "" ]; then
echo "parameter is none"
exit 1
else
echo "***** safe remove $1 *****"
fi
sync
mounted=`mount | grep $1 | wc -l`
while [ $mounted -ge 1 ]
do
media_rmname=`mount | grep $1 | cut -d '/' -f 5 | cut -d ' ' -f 1`
mount_node_no=`ps | grep mount_node | grep $media_rmname | cut -d ' ' -f 1`
echo "R/media/$media_rmname"
widrive_aloha_out $media_rmname
if [ "`echo $media_rmname | head -c 3`" == "USB" ] ; then
rm -f /tmp/security_usb_login_list
rm -f /tmp/security_usb_login_time
killall security_usb_loop
nvram set current_security_usb_in=0;
fi
kill $mount_node_no
Running it gives:
./safe_remove.sh media/USB1
***** safe remove media/USB1 *****
R/media/USB1
killall: security_usb_loop: no process killed
kill: you need to specify whom to kill
killall: security_usb_login.sh: no process killed
killall: Tester_run: no process killed
killall: sambaset: no process killed
# killall: nmbd: no process killed
kill samba server firsthello, samba!
/sbin/security_usb_login.sh: line 4: Tester_run: not found
/sbin/security_usb_login.sh: line 5: Tester_run: not found
/sbin/security_usb_login.sh: line 6: Tester_run: not found
/sbin/security_usb_login.sh: line 8: Tester_run: not found
User guest password set to none.
And here I needed to press the Enter key to continue, otherwise it would just hang on and do nothing...
After this I check with ls /media/USB1 and for my surprise there was no longer an USB1 present in media. The strange part was that the LED on the hard drive was still on, so I don't really know what this script actually does. My Linux knowledge is basic, I understand individually the commands but not as a whole program. Maybe somebody can shed a light on it and explain it.