PDA

View Full Version : hdd noise on "shutdown -p now"


octix
March 3rd, 2009, 17:27
Hi everyone.

I'm a little concerned about a noise my hdd makes when I'm shutting down(shutdown -p now) laptop... Apparently it's powered off too sudden and I'm afraid that this would damage it.

I think windows slows down or stops hdd 1st, and only after that laptop is powered off.

Does anyone have the same problem?

Thank you in advance.

Djn
March 3rd, 2009, 17:41
Given that they're supposed to handle power cuts gracefully, I doubt anything done during a software power-off could harm it.

octix
March 3rd, 2009, 18:32
It sounds like hardware power-off.
At it's full speed HDD is powered off and I get that "unhealthy" noise.

trev
March 3rd, 2009, 23:17
I'm fairly certain that 'shutdown -p' uses the BIOS ACPI function to turn off the machine. There is no safer way and this _is_ how Windows does it :)

octix
March 3rd, 2009, 23:28
I guess then, windows does some additional work...

I'll try to play with "atacontrol spindown".

trev
March 3rd, 2009, 23:31
I'll try to play with "atacontrol spindown".

It won't work; at the very least, before FreeBSD turns off the power it flushes the disk buffers which will cause your drive to spin up...

octix
March 4th, 2009, 01:23
You're right.. it didn't work.

octix
March 4th, 2009, 04:47
Can I execute a command after disk sync? ataidle -s can put to sleep mode my HDD, but again.. disk sync wakes hdd..

trev
March 4th, 2009, 05:41
I don't believe so.

Really, I don't think you'll do your laptop any harm.

octix
March 4th, 2009, 06:07
OK, i'll try to be not so worried :)

Will continue looking, though.

Thanks for your time!

octix
March 6th, 2009, 04:31
OK. So far I've got some results. Basically I was advised to try to patch "ata-disk.c"

--- ata-disk.c 2008-04-08 05:48:21.000000000 -0500
+++ ata-disk-spindown.c 2009-03-05 21:21:12.000000000 -0600
@@ -57,6 +57,7 @@
static void ad_init(device_t);
static void ad_done(struct ata_request *);
static void ad_describe(device_t dev);
+static void ad_spindown(void *);
static int ad_version(u_int16_t);
static disk_strategy_t ad_strategy;
static disk_ioctl_t ad_ioctl;
@@ -218,6 +219,14 @@

if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE)
ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0);
+
+ if (atadev->param.support.command1 & ATA_SUPPORT_STANDBY) {
+ device_printf(dev, "Trying to spindown before poweroff.\n");
+ atadev->spindown = 1;
+ ad_spindown((void *)dev);
+ } else {
+ device_printf(dev, "Cannot spindown before poweroff.\n");
+ }
}

static int

however, this patch seems to work only with "halt" (shutdown -h) but not with "shutdown -p"

don't know yet, why "ad_shutdown" is not called at system's poweroff...

octix
March 6th, 2009, 04:33
Really, I don't think you'll do your laptop any harm.

Perhaps I wasn't able to explain _what_ kind of noise I hear. HDD behaves the same as with "emergency unload", which is dangerous. I mean it's not just arm parking, it's more...