Hi all

I just bought an external 60GB HDD I cant say what brand name as it doesn't have one written on it.
I know there are problems unmounting HDD's and then they do not spin down and I am having the same problem.
It is in /dev/sdc and the ntfs partition is in sdc1
I mount it in /media/portablehdd
I have tried the following script to unmount and spindown the drive and the script runs but the drive remains on with lights and spinning.

#!/bin/sh
pumount /dev/sdc1
#wait for mtab to be updated
sleep 3
#we search an occurency of our harddrive in mtab
UMOUNT=`grep '/dev/sdc1' /etc/mtab | wc -c`
if [ $UMOUNT -eq 0 ]
then
   #we sync the harddrive
   sdparm --command=sync /dev/sdc1
   #we can spindown the hardrive
   sdparm --command=stop /dev/sdc1
   zenity --info --title="Info" --text="You can unplug your Hardrive !"
else
   zenity --error --title="Info" --text="It seems your harddrive isn't unmounted , unmount it then try again"
fi

But the drive still keeps spinning. Can someone please help me as I am getting worried about just pulling the drive out and possibly losing data.


Many thanks

HLA91

Sorry forgot to mention its Ubuntu 9.04

assuming this is desktop edition, there should be an eject icon next to the device in the file explorer (can't remember what it is called). whenever i used my portable hdd with ubuntu 9.04 i used this, and it hasn't lost data.

hope that helps.

Ok thanks, I was just worried as it wasn't spinning down but I just tried it on Win XP and it still doesn't spin down after 'safely removing' it. It only stops spinning once you unplug it.

Cheers

HLA91

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.