Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Thanks to hdparm -B1 /dev/sdb my HDD does no longer spin up when powered up on boot. But after completing the BIOS POST messages and starting Ubuntu the HDD gets a signal over the SATA data cable and spins up.

Leaving the data cable (but still with plugged in SATA power cable) let the system boot up completely from my SSD without spinning up the HDD.

What causes the HDD to spin up? Maybe Grub2?


Edit: nope, doesn't seem to be Grub2 that spins up the drive. I just set up Grub to show its menu without timer. Nothings happens until I hit the Ubuntu standard boot option, then a few seconds later the drive spins up.


Edit: dmesg | grep sdb:

[    7.080043] ata2.00: qc timeout (cmd 0xef)

[    7.080057] ata2.00: failed to IDENTIFY (SPINUP failed, err_mask=0x4)

[    9.830035] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 300)

[    9.836555] ata2.00: ATA-8: SAMSUNG HD105SI, 1AJ10001, max UDMA/133

[    9.836564] ata2.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32)

[    9.842364] ata2.00: configured for UDMA/133

[    9.842644] scsi 1:0:0:0: Direct-Access     ATA      SAMSUNG HD105SI  1AJ1 PQ: 0 ANSI: 5

[    9.843249] sd 1:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)

[    9.843270] sd 1:0:0:0: Attached scsi generic sg1 type 0

[    9.843487] sd 1:0:0:0: [sdb] Write Protect is off

[    9.843497] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00

[    9.843590] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

[    9.844091]  sdb:

[    9.845127] scsi 2:0:0:0: CD-ROM            ATAPI    iHDS118   5      RL0C PQ: 0 ANSI: 5

[    9.851182] sr0: scsi3-mmc drive: 48x/48x cd/rw xa/form2 cdda tray

[    9.851191] Uniform CD-ROM driver Revision: 3.20

[    9.851554] sr 2:0:0:0: Attached scsi CD-ROM sr0

[    9.851802] sr 2:0:0:0: Attached scsi generic sg2 type 5

[    9.942896]  sdb1

[    9.943773] sd 1:0:0:0: [sdb] Attached SCSI disk
share|improve this question
    
What do you have on the HDD? Perhaps ureadahead is trying to cache something insignificant? Could you also post your associated /etc/fstab entry(ies) for the drive? –  M. Tibbits Jan 27 '11 at 3:10
    
My HDD holds data like pdf manual files, StarTrek episodes,...No program files, no configuration files or so. –  Oliver Jan 27 '11 at 7:29
1  
fstab=> /dev/sdb1 /media/data ext2 noatime,user,noauto 0 2 –  Oliver Jan 27 '11 at 7:44

4 Answers 4

up vote 0 down vote accepted

Pretty sure it's the kernel module for the controller scanning for disks that causes your hd to spin. Now, if I'm slightly wrong, and it's really a module for your hard drive, you could block loading that module during the boot process. Check out the blacklists at /etc/modprobe.d/.

share|improve this answer
    
Sounds easy. Do I just have to add a line "sd" in the blacklist.conf? How about the SSD which I asume is also started with the module sd? –  Oliver Feb 13 '11 at 20:57
    
Eheh, obviously blacklisting the sd module is undesirable. I think the only hope for it would be if your hard drive required a module specific to its model. But it answers the question "What causes the HDD to spin up?". –  djeikyb Feb 14 '11 at 0:25

I think you meant to say hdparm -s, not -B1, which asks APM compatible hard disks (which pretty much means only laptop ones) to automatically standby after a short period of inactivity. Also Western Digital disks don't seem to accept the -s command to power on in standby, but have a jumper on the back you can use to enable it.

The kernel sd (scsi disk) driver starts the disk up the first time it is accessed, which happens during boot to scan the partition table. It also will restart the drive after resume from suspend by default, but you can disable that by writing 0 to /sys/block/sda/device/scsi_disk/*/manage_start_stop.

I usually do this and then manually suspend drives I don't plan on using with hdparm -y after a reboot.

My last motherboard bios would simply not detect the drives that powered on in standby, but my new Asus sandy bridge one is apparently "smart" enough to notice that the drive is in standby and start it up.

share|improve this answer
    
Nope, I meant -B1. The -s option sets only the spin down time when idle as you described. E.g. -B255 can set drives to "constant run" to prevent spin down, spin up,... and so increase the HDD lifetime on some laptops (afaik even if you set a -s timer this will be ignored then). Writing 0 to /sys/block/sdb/... works like a charm regarding resume from STR/S3, thank you! A spinned up drive will spin up again and a spinned down drive will be left spinned down on resume. Perfect! :) –  Oliver Feb 13 '11 at 19:59
    
Damn... after a reboot /sys/block/sdb/... shows "1" again. Therefore resume from STR/S3 still lets the HDD spin up in any case. –  Oliver Feb 13 '11 at 20:29
    
@Oliver: no that is -S, not -s. –  psusi Feb 13 '11 at 20:57
    
oops! Sorry, you are right. I used -S to set a spindown time. I remember that I used -s... including the --yes-i-know-what-i-am-doing flag. But that was after using -B1. The -s option did not seem to have any further effect on my system. –  Oliver Feb 13 '11 at 21:48

I would look up the logs for sdb(1), starting with dmesg:

dmesg | grep /dev/sdb
share|improve this answer
    
I already looked at dmesg, but I don't know how to interpret the lines (see above). Any ideas? Thanks. –  Oliver Feb 13 '11 at 15:26
    
No, I'm sorry, no ideas. But I'm not in the hdd-business, so maybe someone else ... –  user unknown Feb 14 '11 at 0:32
    
@Oliver Maybe posting the lines to paste.ubuntu.com and giving a link could help. –  hexafraction Aug 16 '12 at 13:34
    
@ObsessiveFOSS: I think he inserted those lines in his post. –  user unknown Aug 20 '12 at 1:14

Linux will check for partitions on all hard drives on boot, and thus will read the partition table of all connected hard drives. This alone would cause your spin-up, but there may be additional causes.

For an in-depth analysis, AFAIK the backend tools for ureadahead build a list of device blocks read during boot. You could use its logs to determine which hard disk blocks are read, as a first step to determine the cause of your spin-ups.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.