Welcome! Log In Create A New Profile

Advanced

How to suspend an USB port? Needed for poweroff an HDD.

Posted by Ultrazauberer 
How to suspend an USB port? Needed for poweroff an HDD.
March 22, 2011 11:23AM
Hello,

today I attached my new 3,5" HDD to the Dockstar. I want to suspend the disk in idle, but sdparm, hdparm and sg3-utils doesn't work. I have this HDD: CnMemory Core 3,5" 2TB HDD

Is there a way to poweroff the HDD? I think about a workaround: when I'm pulling off the USB cable the HDD is going in standby. If there is a way to suspend the USB port I can poweroff the HDD.

I think "poweroff" does the same because the HDD is going in standby when the system is switched off.

Or are there any tools to modify the HDD on windows or linux permanently (like the Seagate HDD enclosure - it switches automatically off). Thanks for any hints!

PS: sg_start --stop /dev/sdc is not fully working, the HDD spins down but immediatly it turns on again.

EDIT: I need a solution that works like the safely remove on WinXP machines. That would helps a lot!



Edited 1 time(s). Last edit at 03/22/2011 11:31AM by Ultrazauberer.
Re: How to suspend an USB port? Needed for poweroff an HDD.
March 22, 2011 01:18PM
Hi,
this is easy to set up with autofs and hd-idle: http://dev.shyd.de/2011/01/dockstar-nas-automount-hd-idle-samba-ftp/
To mount/umount the disk automatically use autofs and for spindown use hd-idle. This is most likely what you want to do inspired by safe removal from windows.

--
shyd

Goflex Net 3.9.5 | Dockstar 3.9.5 | http://dev.shyd.de
Re: How to suspend an USB port? Needed for poweroff an HDD.
March 22, 2011 02:32PM
shyd, you've made my day!

I knew your site before because there is a great tutorial for pyLoad, but this feature rocks! I've searched the whole day for a solution and you showed me an easy way to solve my problem! Thanks a lot!

Ohhh no... there are some new problems, I don't know how this can be happen?
root@debian:~# screen mc
mkfifo /var/run/screen/S-root/895.pts-0.debian failed

Screen isn't working, also apt-get is showing some problems:
root@debian:/var/cache/apt# apt-get update
Ign http://ftp.de.debian.org squeeze Release.gpg
Ign http://ftp.de.debian.org/debian/ squeeze/contrib Translation-en
Ign http://ftp.de.debian.org/debian/ squeeze/main Translation-en
Ign http://ftp.de.debian.org/debian/ squeeze/non-free Translation-en
Hit http://ftp.de.debian.org squeeze Release
Ign http://ftp.de.debian.org squeeze/main armel Packages/DiffIndex
Ign http://ftp.de.debian.org squeeze/contrib armel Packages/DiffIndex
Ign http://ftp.de.debian.org squeeze/non-free armel Packages/DiffIndex
Hit http://ftp.de.debian.org squeeze/main armel Packages
Hit http://ftp.de.debian.org squeeze/contrib armel Packages
Hit http://ftp.de.debian.org squeeze/non-free armel Packages
Ign http://repo.dev-eth0.de squeeze Release.gpg
Ign http://repo.dev-eth0.de/ squeeze/main Translation-en
Hit http://repo.dev-eth0.de squeeze Release
Ign http://repo.dev-eth0.de squeeze/main armel Packages/DiffIndex
Ign http://www.debian-multimedia.org squeeze Release.gpg
Ign http://repo.dev-eth0.de squeeze/main armel Packages
Ign http://www.debian-multimedia.org/ squeeze/main Translation-en
Ign http://www.debian-multimedia.org/ squeeze/non-free Translation-en
Ign http://www.debian-multimedia.org unstable Release.gpg
Hit http://repo.dev-eth0.de squeeze/main armel Packages
Ign http://www.debian-multimedia.org/ unstable/main Translation-en
Hit http://www.debian-multimedia.org squeeze Release
Hit http://www.debian-multimedia.org unstable Release
Ign http://www.debian-multimedia.org squeeze/main Sources/DiffIndex
Ign http://www.debian-multimedia.org squeeze/non-free Sources/DiffIndex
Hit http://www.debian-multimedia.org squeeze/main armel Packages/DiffIndex
Ign http://www.debian-multimedia.org squeeze/non-free armel Packages/DiffIndex
Ign http://www.debian-multimedia.org unstable/main Sources/DiffIndex
Hit http://www.debian-multimedia.org unstable/main armel Packages/DiffIndex
Hit http://www.debian-multimedia.org squeeze/main Sources
Hit http://www.debian-multimedia.org squeeze/non-free Sources
Hit http://www.debian-multimedia.org squeeze/non-free armel Packages
Hit http://www.debian-multimedia.org unstable/main Sources
W: Not using locking for read only lock file /var/lib/apt/lists/lock
W: Failed to fetch http://ftp.de.debian.org/debian/dists/squeeze/Release  rename failed, Read-only file system (/var/lib/apt/lists/ftp.de.debian.org_debian_dists_squeeze_Release -> /var/lib/apt/lists/ftp.de.debian.org_debian_dists_squeeze_Release).

W: Failed to fetch http://repo.dev-eth0.de/dists/squeeze/Release  rename failed, Read-only file system (/var/lib/apt/lists/repo.dev-eth0.de_dists_squeeze_Release -> /var/lib/apt/lists/repo.dev-eth0.de_dists_squeeze_Release).

W: Failed to fetch http://www.debian-multimedia.org/dists/squeeze/Release  rename failed, Read-only file system (/var/lib/apt/lists/www.debian-multimedia.org_dists_squeeze_Release -> /var/lib/apt/lists/www.debian-multimedia.org_dists_squeeze_Release).

W: Failed to fetch http://www.debian-multimedia.org/dists/unstable/Release  rename failed, Read-only file system (/var/lib/apt/lists/www.debian-multimedia.org_dists_unstable_Release -> /var/lib/apt/lists/www.debian-multimedia.org_dists_unstable_Release).

E: Some index files failed to download, they have been ignored, or old ones used instead.
W: Not using locking for read only lock file /var/lib/dpkg/lock

Hmm, it must have to do with the new packages, or I'm wrong?
Re: How to suspend an USB port? Needed for poweroff an HDD.
March 22, 2011 03:05PM
No idea what happen, but after 2 reboots the dockstar is working fine again with hd-idle! Very nice!

Edit: Should I mount all USB devices with autofs like in your tutorial? Normally I create some folders in /mnt/ and let the devices mounted by the fstab (with UUIDs).

I have attached 1 USB stick (boot stick with debian), 1 Seagate Freeagent Go and 1 2TB external Harddrive. But now I only mount the 2TB drive with the autofs config. Is this ok or should I change the fstab?

Edit2: Is autofs needed for a correct spin-down? As far as I know is autofs just a deamon for external storage devices which mounts automatically the sticks. Am I wrong? Because I add all my devices to the fstab so autofs isn't really needed.



Edited 2 time(s). Last edit at 03/22/2011 03:21PM by Ultrazauberer.
Re: How to suspend an USB port? Needed for poweroff an HDD.
March 22, 2011 06:00PM
Hi Ultrazauberer,

you are right, you don't need autofs when you are using fstab to mount the devices. autofs is only important if you want to detach the drives, when my drive spinned down I know it has been umounted before, so I can plug it out safely.

--
shyd

Goflex Net 3.9.5 | Dockstar 3.9.5 | http://dev.shyd.de
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: