You are not logged in.
Hello. I have added SSD disk to my laptop (/dev/sda), but I have kep old HDD (/dev/sdb).
Because HDD is rarely used, I decided to spare some power by putting this HDD to rest. So I checked out the command in terminal:
sudo hdparm -Y /dev/sdb
It worked. However, when I added
hdparm -Y /dev/sdb
to the bottom of /etc/rc.conf file, nothing happens.
Why is this and how can I debug that? Can I somehow prevent HDD spinning up in the first place?
Offline
Offline
Oh, sorry. Of course I meant /etc/rc.local. I don't konw why I had typed /etc/rc.conf
Here is the output:
[rok@rok-laptop ~]$ cat /etc/rc.local
#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
# Let SSD handle data scheduling on it's own
echo deadline > /sys/block/sda/queue/scheduler
echo 1 > /sys/block/sda/queue/iosched/fifo_batch
# Turn off auxilary disk
hdparm -Y /dev/sdb
Are there any other startup files I can try putting that line into?
Offline
You can try with
(sleep 30 && hdparm -Y /dev/sdb) &
Maybe a process in your DE wakes up the drive if it is in sleep too early.
rc.local is a perfect place for this.
Offline
Thanks! That did it just perfectly. Nice idea.
I guess there persists only one question - is it possible not to spin up the disk in the first place? But I guess this is not really vital and I guess I'd take a lot of effort, as that'd probably involve BIOS tweaking.
Thanks again, If anyone has an idea, I'd be happy to hear it
Offline
You're welcome.
It'll spin up, I don't think you can prevent it. If you use this for backup, just buy an USB3.0 docking station and USB3.0 PCI card. Safer if backup hdd is stored separately. Or if it's a SATA disk and AHCI is enabled you can hot swap, I mean you can attach power cable only when needed.
Offline
One more thing.
Does there exist startup file which is invoked after the start of X server instead of last boot stage? I have tried ~/.xinitrc but doesn't work.
The comand you provided has one weak point: I have to log in and startx within 30 seconds, because startx (gdm) wakes up disk. If I fail to do that fast, command has no effect.
Thanks for the help, I'm new to arch linux, but not to linux in general, and I'm catching up on some things.
Offline
Is there any reason booting into console instead of X?
Start X at Boot
Problem is that hdparm needs root privilage to run. So if you want that command invoked in ~/.xinitrc you have to write a script which asks for root password then execute hdparm.
There may be other ways I'm not aware of, but I'm not a guru either.
Don't give up I learnt a lot about linux when I installed arch first and keep learning. My experience says arch community is very helpful and these people created an excellent and outstanding wiki.
Offline
I have come up with solution:
(
until [ "$(pidof X)" ]; do
sleep 1
done
sleep 10
hdparm -Y /dev/sdb
) &
Is solution like this acceptable?
Offline
Problem is that hdparm needs root privilage to run. So if you want that command invoked in ~/.xinitrc you have to write a script which asks for root password then execute hdparm.
There may be other ways I'm not aware of, but I'm not a guru either.
You can work around that with proper sudo configuration. Say, this should work for whole wheel group to be able to use sudo hdparm without root password:
%wheel ALL = NOPASSWD: /sbin/hdparm
Obviously could be done for other groups as well. Just an example.
I have come up with solution:
( until [ "$(pidof X)" ]; do sleep 1 done sleep 10 hdparm -Y /dev/sdb ) &
Is solution like this acceptable?
edit, nevermind, I'm just dumb looks good
edit2 actually... a script put this way will ask for a pid of a process, on whose creation it is waiting. Either I'm very very tired (which I am), or the logic is a bit faulty.
Last edited by meph (2012-01-29 16:08:24)
Running arch is like raising a puppy - if you spend a bit of time with it each day and do just a bit of training you'll end up with the most loyal partner you could want; if you lock it in a room and don't check on if for several days, it'll tear apart your stuff and poop everywhere.
Offline
The logic behind this script is:
1. wait until there exists proces named X
(the pidof is actually used only to check if process exists, the result is not used anywhere else)
2. sleep 10 seconds for x to fully initialize
3. turn off the hard disk
You can try with
(sleep 30 && hdparm -Y /dev/sdb) &
Maybe a process in your DE wakes up the drive if it is in sleep too early.
Is it possible to configure X or GDM not to wake the -Y ed disk? I googled, found nothing. I guess that would be solving the problem the arch way.
Offline
I just realized I might suffer from an OCD. After a very long day at work and coming home tired to death, instead of dying into pillow I go and check Arch forums You are right, makes sense.
How about this. Get sg3_utils from extra repo, and do
sudo sg_start --stop --readonly /dev/sdb
That *should* stop the drive for good, until you wake it up with sg_start --start, or reboot. It's a tool originally made for generic SCSI drives, but it *should* work on SATA drives as well. I can't test it myself though, as I'm nowhere near a linux box with more than 1 physical drive. Can someone confirm?
Running arch is like raising a puppy - if you spend a bit of time with it each day and do just a bit of training you'll end up with the most loyal partner you could want; if you lock it in a room and don't check on if for several days, it'll tear apart your stuff and poop everywhere.
Offline
Your command has the same effect as hdparm -Y, gnome is able to wake the disk up again.
I managed to google this command:
echo 1 > /sys/block/sdb/device/delete
Which powers down device completely, but I am not able to undo that change (except reboot).
Offline