h_ramus wrote:Hello there
I've successfully included a 2.5" HDD to the Pi 2 and it seems to be working OK being mounted and read normally.
I do have a question regarding the HDD health. Whenever I use the shutdown command I can hear the HDD plates spinning down after the Pi shuts down. However, whenever connect the same drive to a laptop (Mac OSX) and eject the drive before pulling the USB cable no such sound is heard. It seems that when ejecting the drive from the laptop the HDD plates stop spinning normally. When executing the shutdown -h now command in the Pi the HDD plates seem to abruptly stop as if I had just pulled the USB cable without the shutdown command.
I've been reading on other posts that when executing the shutdown command the Pi unmounts the HDD and can be safely disconnected. However, the difference between ejecting the same drive in a laptop and a Pi 2 seems evident. I fear a shorter lifespan of the HDD with the Pi.
Question: is there any way of ejecting the HDD in the Pi that doesn't cause it to abruptly stop spinning when running the shutdown command?
Running a Pi 2 with OSMC Alpha 4.
Thanks
H.
I have the same problems with my usb-wd drive. hdparm do not work with my drive. Here is solution:
try to umnount your drive via
Code: Select all
apt-get update
apt-get install udisks
/usr/bin/udisks --unmount /dev/sda1
sleep 5
udisks --detach /dev/sda
if is ok => you can do script on poweroff
I found that /etc/inid.d/yourscrips will not work as dbus already off (udisks or udisks2\udisksctl don`t work without) so we need to run script before poweroff command.
Before unount drives you need kill all that can use your drive (this script do not do this!!!)
All error will be in file /123.txt
Code: Select all
nano /myrandomfolder/hddunmount
=============================
#! /bin/sh
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#please kill all that can use your drive before go farther
# this script do not do this!!!
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#print all possible error\messages to file
echo " " > /123.txt
for i in `seq 1 300`; do
#i mounted my drive /dev/sda with partition sda1 in folder "/mnt"
#On hard drive i have folder "2TB"
# so if we have /mnt/2TB - so drive is mounted
#replace by your fo;der
if [ -e /mnt/2TB ]; then
echo $i >> /123.txt
#apt-get install udisks
/usr/bin/udisks --unmount /dev/sda1 >>/123.txt 2>&1
#/usr/bin/udisksctl unmount --block-device /dev/sda1 >>/123.txt 2>&1
echo ok >> /123.txt
break
fi
sleep 0.1
done
sleep 5
for i in `seq 1 300`; do
if [ -e /dev/sda ]; then
echo $i >> /123.txt
udisks --detach /dev/sda >>/123.txt 2>&1
#/usr/bin/udisksctl unmount --block-device /dev/sda1 >>/123.txt 2>&1
echo ok >> /123.txt
break
fi
sleep 0.1
done
sleep 5
====
mv /sbin/reboot /sbin/rebootok
nano /sbin/reboot
=============================
#! /bin/sh
/myrandomfolder/hddunmount
/sbin/rebootok
====
mv /sbin/poweroff /sbin/poweroffok
nano /sbin/poweroff
=============================
#! /bin/sh
/myrandomfolder/hddunmount
/sbin/poweroffok
====
mv /sbin/halt /sbin/haltok
nano /sbin/halt
=============================
#! /bin/sh
/myrandomfolder/hddunmount
/sbin/haltok
====
mv /sbin/shutdown /sbin/shutdownok
nano /sbin/shutdown
=============================
#! /bin/sh
/myrandomfolder/hddunmount
/sbin/shutdownok
====
chmod 755 /sbin/shutdown
chmod 755 /sbin/halt
chmod 755 /sbin/poweroff
chmod 755 /sbin/reboot
chmod 755 /myrandomfolder/hddunmount