LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-19-2017, 09:48 AM   #1
Ormu
Member
 
Registered: Jun 2011
Posts: 92

Rep: Reputation: 15
Running hdparm from Grub - disk mode problems (AHCI/ATA)


I'd like to use hdparm via Grub to configure HDD APM before booting Windows. So I tried

Code:
hdparm -B 254 hd0
on the Grub command line but it says "not an ATA device". I also tried

Code:
hdparm -B 254 ahci0
but it says device not found.

I found this:
https://www.unixadm.org/needful-things/ataunlock

and it tells what to do when the disk controller is in AHCI mode but Grub is not. I suppose this is the case on my computer - or am I wrong?

I tried to run nativedisk as instructed but it caused Grub to hang. How long should it take? I waited for 30 seconds at least.

According to that article I could install Grub using native disk module like this:
Code:
grub2-install --disk-module=native /dev/sda
but how safe is this when the nativedisk command didn't apparently work as desired? And what happens when a package update wants to update Grub?

Setting the disk controller to IDE/ATA mode is possible but what are its side effects? Windows wouldn't like it?


There is a hdparm implementation for Windows, which I could use, but using Grub would be more elegant.
https://disablehddapm.blogspot.fi/

Windows power management settings are configured to never stop the hard disk but it still spins down. CrystalDiskInfo shows that the APM value is 96. It can be used to set the APM parameters but it seems that it can't be run on boot.

Computer is Thinkpad T410 with Debian 9 + Windows 7 on a single HDD.
 
Old 12-23-2017, 06:36 AM   #2
_roman_
Member
 
Registered: Dec 2017
Location: _Austro_Bavaria_
Distribution: gentoo / linux mint
Posts: 433

Rep: Reputation: 28
Quote:
I'd like to use hdparm via Grub to configure HDD APM before booting Windows
It is a windows issue

I would not touch hdparm as those values are wrong for some drives. You have been warned!

Quote:
grub2-install --disk-module=native /dev/sda
So what has this to do with your running Spyware 95 from microsoft?

I am using grub2-install to tell my UEFI ASUS bios, hey i have gentoo linux on my drive, make partition sda2 bootable please. Job done, thanks.


Quote:
Setting the disk controller to IDE/ATA mode is possible but what are its side effects? Windows wouldn't like it?
ATA modes are afaik only an indicator on how "fast" a drive works.
optical drives reports lower ata modes as harddrives


First popup window in google chrome, search term: AHCI mode
Quote:
IDE mode is the simplest mode. In IDE mode, the hard drive is set to run as an IDE or Parallel ATA (PATA) hard drive. Advanced Host Controller Interface (AHCI) mode enables the use of advanced features on SATA drives, such as hot swapping and Native Command Queuing (NCQ).
you definitely want AHCI

Newbie feature so they can run windows95 on that platform most probably.

https://en.wikipedia.org/wiki/Advanc...ller_Interface
Quote:
Many SATA controllers offer selectable modes of operation: legacy Parallel ATA emulation, standard AHCI mode (also known as native mode), or vendor-specific RAID (which generally enables AHCI
in order to take advantage of its capabilities).
Makes things clear.

Parallel ATA emulation, => Hey my windows 95 does not run on my fancy pants notebook. Than you enable this!
standard AHCI mode (also known as native mode) => default mode, as designed for, usual best transfer rate. RAnt: why do they call it native mode?

vendor-specific RAID => fake raid, do not touch it for several reasons which are out of the scope.

-- the side effects may be that your box will refuse to load your spyware 95 maybe when you enable IDE emulation

-- It also seems you are mixing up shell commands, with build in grub recovery shell commands(which should maybe use busybox, but not sure!), with bios features.

--

When you want to disable the power down feature, do it in linux, do it windows.
linux. e.g. /etc/init.d/ custom script (Assuming you use something which is not SYSTEMD disease)
spyware95 e.g. fancy pants startup software which does this

--

Quote:
and it tells what to do when the disk controller is in AHCI mode but Grub is not.
Indicates you are wanting to change settings in your bios, which you should not when you do not know exactly what it does.

edit:

-- Warning. Not any of my past 7 drives had any correct smartctl values or hdparm values. Those linux tools are outdated. The manufacturers can choose whatever they like, whatever they like to interpret those values. Most of the time you see something like is not in teh drive database, and even so these values may work or not work.

Warning: When you are really on an old hdd with windows 7, which is dated, you may replace the drive asap. as the drive may die tommorrow without any notice and all your fancy data will be unrecoverable.

Hint: Also backups may help, but backups on unreliable media will be also unrecoverable.

--

Quote:
Grub command line
The grub recovery shell has a subset of features. It is a recovery shell. Could be busybox based or not. too lazy to look that up. Just treat it as busybox alike shell, with same constraints.

Last edited by _roman_; 12-23-2017 at 06:53 AM.
 
Old 01-03-2018, 02:35 PM   #3
Ormu
Member
 
Registered: Jun 2011
Posts: 92

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by _roman_ View Post
It is a windows issue

I would not touch hdparm as those values are wrong for some drives. You have been warned!
Using hdparm to set the APM value for this disk works really well on Linux. It can be put into /etc/hdparm.conf and it is set on boot.

Also, CrystalDiskInfo can successfully set it on Windows but it can't do it during boot which is important.

I could use the aforementioned hdparm port for Windows, but I'd like to use the hdparm module of Grub(2) instead because it feels simpler.

I performed a quick search for "apm" through Windows registry but didn't find anything useful.


Quote:
-- the side effects may be that your box will refuse to load your spyware 95 maybe when you enable IDE emulation
This is what I'm afraid of, and I'd not like to lose the AHCI features/performance either.

Last edited by Ormu; 01-03-2018 at 02:38 PM.
 
Old 01-10-2018, 06:16 AM   #4
Stéphane Ascoët
Member
 
Registered: Feb 2004
Location: Orleans, 120 km south of Paris
Distribution: Mandrake, Freeduc (the one I'm making), Slackware, MacOS X
Posts: 202

Rep: Reputation: 41
Your window$ take so much time to load that the drive goes to sleep?
 
Old 01-19-2018, 10:50 AM   #5
Ormu
Member
 
Registered: Jun 2011
Posts: 92

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Stéphane Ascoët View Post
Your window$ take so much time to load that the drive goes to sleep?
No, this is not related to Windows startup time. With the default APM value of 60(hex) = 96, it spins down very easily unless it's accessed constantly.
 
  


Reply

Tags
ahci, grub, hdparm


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
hdparm doesn't load hdparm.conf KOTAPAKA Linux - Hardware 2 05-21-2008 09:54 AM
Running GRUB at its prompter grautu Linux - General 6 09-19-2005 09:01 AM
hdparm and modprobe not running as root nishmal Linux - Newbie 2 05-23-2004 01:14 PM
running HDPARM Aeon Linux - Newbie 6 07-31-2003 09:09 PM
hdparm -g NOT= hdparm -i ---LILO hangs @ L stevewalsh Linux - General 4 07-23-2001 09:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration