[SOLVED] Automatically put HDD to sleep mode after start

Hi everyone.
I use a secondary HDD for backups. It's plugged to my computer permanently but actually it is needed for a few seconds per day. A backup script automatically shuts it down after backing up with `hdparm -Y` to save a power and reduce a noise. And I want to shut down an HDD also every time after the system is started.
I tryed two ways to implement this.
1. Udev rule that runs `hdparm -Y` for the device identified by ID_SERIAL_SHORT attribute.
2. Following systemd service:
[Unit]
Description=Put HDD to sleep mode immediately
After=systemd-udev-trigger.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/hdparm -Y /dev/disk/by-id/ata-SAMSUNG_SP2514N_S08BJ1HL210777
[Install]
WantedBy=sysinit.target
Both methods actually run hdparm, but state of the HDD is active after login (I check it with hdparm -C). It looks like something in systemd "touches" the hard drive and wakes it up back. And I can't find what may access the secondary HDD after udev rules are processed.
What is correct way to solve the issue?
Thanks.
Last edited by dimich (2013-05-03 02:32:38)

Well, I think you would need to determine everything that might be polling your drives during the boot process, which might be a pretty big task.  Then use that information to determine either when udev should run that command, and use the lexicographically ordered rules to try finding just the right spot (and even then it might just come down to a race).  Or you can use the gathered info to try and make systemd's service dependencies do the work for you.  Either way, I would honestly rather just use a timer.

Similar Messages

  • What do I do when my mac won't start up? I put it in sleep mode after installing the latest OS Lion update and now it won't open up.

    Near new mac pro retina, updated OS last night, re-started, finished my work & put it into sleep mode. On power, & hooked up to Thunderbolt screen. Got up this morning and it won't boot up. Is there anything I can do myself, or is this a shop problem?

    Sounds like a #1 SMC or #2 PRAM reset is in order.
    Step by Step to fix your Mac

  • Laptop doesn't wake after sleep mode after Windows 10 update

    I usually lower the laptop lid when i want to put it into sleep mode; after the windows 10 update, this stopped working. I tried putting it into sleep mode from the start menue. This causes the screen to become black, but power to remain on ( I can see this from a steady light from the power button whereas sleep would have a flashing power button). The laptop's fan also increases in speed. When I try to wake the laptop, nothing happenes; I have tried to use ctrl+alt+delete, however this also does not work. I am ususally forced to resort to a manual shut down via holding the power button for a few second and restarting the laptop. I have tried updating the display adapters, restarted the laptop, and still no result. Does anyone know why this is happenning and how I can fix it?

    I was having the Exact Same Issue. The reason I decided to go back to windows 8 was because since upgrading to Windows 10, when my computer goes into sleep mode, I cannot wake it up. I have to press and hold the power button to shut it done and restart. Even if I close my laptop, and reopen the lid, it wont start back up and I have to press and hold the power button and shut it down and restart.  After trying to restore my HP Envy Laptop from Windows 10 to Windows 8, it got stuck in a Repair PC Loop and I could not even access the desktop, I tried the restore option to an earlier date and that failed and all the repair options also failed. The last option I had was to do a full PC Refresh, and that one worked. It took about an hour but no data was lost, and only a few of my downloaded apps were removed. An html url was left on the desktop that showed a list of all the apps that were removed. So all I did was download those back and now im back up and running Windows 8. 

  • One day i  was just flipping through my ipod i put it on sleep mode then next time i opened it without me doing anything it gave me an option of ''slide to power off'' i pressed cancel then  it automatically went back to sleep mode it is still happening

    One day i  was just flipping through my ipod i put it on sleep mode then next time i opened it without me doing anything it gave me an option of ''slide to power off'' i pressed cancel then  it automatically went back to sleep mode it is still happening my ipod is jailbroken and i didnt fiddle with the settings.. please help.

    If it is jailbroken, we are not allowed to help you with that here.  You'll need to seek out other sources of help.  The jailbreaking could potentially be part of the problem, for all I know.
    BTW, just a pointer...  punctuation is your friend!  Your post was very difficult to read without any.  Many people will simply stop reading and click the "back" button when encountering something like that, which limits availability of help to you.

  • IMac won't wake from sleep mode after latest update

    Hello, I have a Late 2013 27-inch iMac that has started acting strange, lately. After installing update 10.10.3, my iMac almost will regularly not wake once it enters sleep mode, after being idle for a certain period of time.
    Is anyone else having this problem, and/or have any solutions for this?
    Thank you in advance!

    Step 1
    Take all the applicable steps in this support article. That's the starting point for any further efforts to solve the problem. Please read the whole article carefully and don't skip any of the steps, including the ones under the heading Additional troubleshooting. If you don't understand any of the steps, ask for guidance.
    Also note that if you replaced the internal hard drive with an SSD, or if you're starting up from an external SSD, then that device may be causing the problem. Check the SSD manufacturer's website for a firmware update. The only solution may be to reinstall the original drive or avoid sleep altogether.
    Step 2
    If you're running OS X 10.8.5 or earlier, from the menu bar select
               ▹ System Preferences... ▹ Accessibility
    If the checkbox at the bottom marked
              Enable access for assistive devices
    is checked, uncheck it and test.
    If you're running OS X 10.9 or later, select
               ▹ System Preferences... ▹ Security & Privacy ▹ Privacy ▹ Accessibility
    If any applications are listed on the right and have a checked box next to them, uncheck all the boxes and test. You may first have to click the padlock icon in the lower left corner of the window and authenticate as an administrator to unlock the settings.
    Step 3
    In the Energy Saver pane of System Preferences, uncheck the box marked
              Put hard disks to sleep when possible
    Step 4
    If you don't already have a current backup, back up all data, then reinstall the OS.* You don't need to erase the startup volume, and you won't need the backup unless something goes wrong. If the system was upgraded from an older version of OS X, you may need the Apple ID and password you used.
    If you installed the Java runtime distributed by Apple and still need it, you'll have to reinstall it. The same goes for Xcode. All other data will be preserved.
    *The linked support article refers to OS X 10.10 ("Yosemite"), but the procedure is the same for OS X 10.7 ("Lion") and later.
    Step 5
    This and the next step must be taken as an administrator. If you have only one user account, you are the administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    In the Console window, select
              DIAGNOSTIC AND USAGE INFORMATION ▹ Diagnostic and Usage Messages
    In the search box in the window's toolbar, enter "powerd" (without the quotes.)
    You may see one or more lines like this:
    com.apple.message.signature: Platform Failure
    If you do see that, and you did everything in the preceeding steps, then you're dealing with an internal hardware fault. Make a "Genius" appointment at an Apple Store, or go to another authorized service provider.
    Step 6
    In the Console window, select
              DIAGNOSTIC AND USAGE INFORMATION ▹ System Diagnostic Reports
    (not Diagnostic and Usage Messages) from the log list on the left. If you don't see that heading, select
              View ▹ Show Log List
    from the menu bar.
    There is a disclosure triangle to the left of the list item. If the triangle is pointing to the right, click it so that it points down.
    You may see one or more reports with a name that begins with "Sleep Wake Failure" followed by a date. Select the most recent one. The contents of the report will appear on the right. Use copy and paste to post the entire contents—the text, not a screenshot.
    I know the report is long, maybe several hundred lines. Please post all of it anyway.

  • PRS-T1: Sleep mode after 1 min

    Hi,
    the problem I'm experiencing with my PRS-T1 is that it automatically enters sleep mode after 1-2 minutes of inactivity (rather than after 10 minutes, as stated in the User Guide). It happens even when the battery is, or almost is, fully charged. It is pretty annoying at times as I'm often still reading that page. Is there any solution to this problem? Thanks!
    P.S. I had the latest firmware already preinstalled when I bought my PRS-T1

    Hello and welcome to the User Discussion Forum.
    This is very unusual for the PRS-T1 Wifi reader to enter sleep mode after 1-2 minutes of inactivity. Please contact Sony support directly for service options.
    http://esupport.sony.com/US/p/select-sy ... OR=CONTACT

  • Is it best to turn off your computer or put it in sleep mode.

    Is it best to turn off your computer or put it in sleep mode.
    I have a MAC Book Pro
    2.4 GHz Intel Core 2 Duo

    Well. Apple recommends to put the Mac into sleep mode if you are going to use your Mac after a short period of time, and they only recommend to turn it off when you are not going to use the computer for several days.
    In sleep mode, your Mac consumes only a small battery capacity, so it's worth to put it in sleep mode. Also, it's much faster than turning the computer on every time you want to use the Mac

  • Put HDD to sleep with SSD

    Hello,
    I have a question for SSD users. I have a late 2008 unibody macbook pro. I just installed effortlessly an OCZ vertex 2 120gb ssd. Love the speed! I read around the internet that you should not check put hdds to sleep under energy saver for ssds. Is this true? My question would be the following:
    I also heard that OCZ has some garbage collection algorythm that makes up for Mac's lack of TRIM support. If I put hdds to sleep when possible does it mean that the garbage collection will not work? What is the advantage of NOT putting hdds to sleep with SSD?
    Finally, I am planning to install a second hd instead of my superdrive, a normal hd that is (seagate xt 7200). I suppose that having it means I should put the hdds to sleep when possible, am I right?
    In case I should not put to sleep the ssd, can I select two different settings for the two different drives?
    Sorry if this sounds confusionary, it sounded a lot better in my mind...
    Thanks for any tips!

    I also heard that OCZ has some garbage collection algorythm that makes up for Mac's lack of TRIM support.
    I dont think garbage collection (and over provisioning) makes up for lack of TRIM support, but certainly helps it in that direction.
    If I put hdds to sleep when possible does it mean that the garbage collection will not work? What is the advantage of NOT putting hdds to sleep with SSD?
    I think you are asking - "If I put ssds to sleep when possible does it mean that the garbage collection will not work?", since hdds don't have the garbage collection.
    Well, from (http://www.ocztechnology.com/aboutocz/news/151) and (http://www.enterprisestorageforum.com/technology/features/article.php/3850436) it seems that, according to OCZ's Chang, some of their ssds use idle time garbage collection. If yours came with a spec manual, I would look there.
    The way Chang puts it is:
    +OCZ's goal is to keep SSD performance at peak levels over the drive's lifespan. OCZ, he said, uses two basic garbage collection methods: incorporating the maintenance within firmware, and providing user-initiated tools to accomplish the same task. OCZ provides three different garbage collection methods, said Chang.Some OCZ drives feature idle-time garbage collection in the firmware, including PCI-Express and high-capacity 3.5-inch SSDs, which aim for high-performance endurance. OCZ's mainstream 2.5-inch SSD solutions ship with TRIM support, which is enabled on Windows 7 and various Linux versions.+
    +For users who prefer Windows XP or Vista, OCZ provides a manual garbage collection tool that can be initiated at the user's discretion, said Chang, noting that the company also provides a garbage collection upgrade firmware for XP and Vista systems. "Garbage collection is just one more tool in OCZ's feature sets that helps sustain the revolutionary performance of SSDs over the long term," said Chang.+
    So, if yours uses the idle time, it may need not benefit from a nap, although I can not find anywhere that suggest how long idle time is.
    I find the whole OCZ presentation rather sloppy. I am sure they have good drives, but after reading on OCZ, it makes me want to take a nap.
    Message was edited by: aprouser

  • Mini goes into sleep mode after login on

    I put my mini into sleep mode after logging out. Then, when I log back in, after a few seconds, it goes into sleep mode again. I have to re-awaken it.
    This is not the way the computer should work.
    Is this a configuration issue, any ideas????
    I use Apple's bluetooth wireless keyboard and mouse combination.
    Thanks
    Mac-mini   Mac OS X (10.3.9)  

    It sounds obvious but are you sure your power adapter is ok and the battery is charged. The behaviour sounds a lot like low battery sleep.
    Press the check button on your battery pack - do you get plenty of lights?

  • Imac keeps putting itself into Sleep Mode.

    This morning my Imac has put itself into sleep mode twice within an hour - losing everything I was working on. It just goes black and then loads the log in screen.
    I've never had this issue before, it's not over heating (not sure if that could be a problem) it's not full up, it's not lagging it's just this problem.
    I really cannot afford the time to take my Imac into the store for repair unless ofcourse it's really needed. Can someone help please?
    Thank you,

    Hi Tori,
    Unfortunately I'm unable to help, but I want to add that I had exactly the same problem this morning (Jan 13, 2013)! It was putting itself into sleep mode twice within 5 minutes.
    In contrast to TorkiClarkson, the fan of my iMac was blowing hard, but that happened a lot the last months without falling into sleep mode. Actually I'm a bit afraid I've got a heating problem since my warranty of 1 year has experienced..
    Hope someone has valuable information for TorkiClarkson and me.
    Thanks.

  • I have a dual 1.8 ghz pwer pc g5 and sometimes i put it in sleep mode and come home on my lunch break and the fan is running at full speed and the computer has frozen up...what is going on here?

    and sometimes i put it in sleep mode and come home on my lunch break and the fan is running at full speed and the computer has frozen up...what is going on here? is it a virus or has my computer been hijacked? it cant be good for the computer...anyone ever had this problem..?

    Your problem has been reported many times, but causes are as varied as individuals.
    Can we assume that a hard shutdown allows a normal restart?
    Can I assume that you have used Disk Utility from your OS X install disc to repair the hard drive directory? The freezes and hard shutdowns require that the drive be repaired (not permissions) or soon the machine won't boot at all.
    If the root issue is software related, in Console (the application) under Logs, there should be loggings around the time of sleep and logs that tell you what process went wild and froze the machine.
    Network activity is also a common casue.
    Other info:
    http://support.apple.com/kb/ht1776
    If hardware related, such as an external drive, other USB device (Wacom tablet) or USB PCI card, ejecting, disconnecting, removing, or in the case of the Wacom, updating drivers, are all potential remedies.

  • HT4623 My screen always went in a sleep mode after a few minutes and now it doesn't how do I get hat back?

    MY screen would always go into sleep mode after a little while and it stopped doing that, how do I get that feature back?

    See Settings > General > Auto-Lock
    Note that some Apps will turn off auto-lock when running.

  • Every time I turn the computer off or put it in sleep mode... when I come back my wallpaper is gone. I have to keep going to my pics and getting it back. Does anyone know why this keeps happening??

    Every time I turn the computer off or put it in sleep mode... when I come back my wallpaper is gone. I have to keep going back to my pics and getting it back.
    Does anyone know why this keeps happening??

    Are you choosing it from one of these folders (in my screenshot) or you can also put that picture into the correct folder. The path is:
    HD > Library > Desktop Pictures
    If you add it to the folder manually, please restart your computer.
    And yes, letting it sleep is a good idea, or else the startup disk will spin and the screen may suffer from image persistence if you leave a window or image parked in the same spot too long, so the screensave is a good idea.

  • Powerbook 17" G4 automatically shuts down in sleep mode

    Powerbook 17" G4 automatically shuts down in sleep mode intermittently. When press power button to bring it back up, it takes a very long time to reboot and the date is set to Dec 31, 1969. It comes back up finally, but this is irritating.
    Thanks for any help,

    Hi Reaskt
    Have you tried using Temperture Monitor to monitor your temps? Maybe it is overheating. Also it sounds like your backup battery is dead, that's why the clock reset's it's self. If you still have applecare I would give apple a call a soon I could. To me it looks like you would need a new logic board. I realy hope that you have applecare. Also have you tried an Erase and Install? Have you tried running Disk Utility booted from your install CD?
    Post back when you get more info
    Nic

  • My Mac Ox is not charging , last night I put it on sleep mode and on charge and I woke up and found it closed and because it is not charging I can't open it . Ant suggestion ?

    My Mac Ox is not charging , last night I put it on sleep mode and on charge and I woke up and found it closed and because it is not charging I can't open it . Ant suggestion ?

    Hi...
    Several things to try ...
    Apple Portables: Troubleshooting MagSafe adapters
    Try Resetting your Mac's PRAM and NVRAM
    If nothing above has helped, try Resetting the System Management Controller (SMC)

Maybe you are looking for

  • Application:openTempFile: not working as expected.

    Maybe I understand wrongly but I read in the documentation about how a Cocoa app (not document based) opens files form another application (Finder or another one in my case), that it searches for the following methods in the application delegate and

  • External Hard Drive -- What do you recommend plase

    I use super duper and do not have the backup drive on except when doing a backup. I need a capacity in the 750 to 1 TB size. When I look at Amazon or other ratings they are all over the place. One size is good and another is bad for the same manufact

  • Firefox 16 will not close in mac 10.6.8

    I am using a MacBook (MacBook6,1) Mac OS X v 10.6.8 Firefox 16.0.2 When I close or quit Firefox the windows will disappear however the program will continue. I have to do a "Force Quit" to get it to completely shutdown. This seams to happen more the

  • Z68A-GD65 (G3) issues: monitor stays on, mouse problems

    Hi, First I need to mention that I already updated BIOS to latest version (23.1). The BIOS once froze when I tried to exit without saving changes, but that was before I updated it. The issues are following: 1. Randomly (about 50%-50%), upon shutdown

  • Statement.cancel() isn't working

    Neither statement.cancel() nor the query timeout functionality seem to work. I'm using the MySQL connector-J driver, but the forum over there doesn't have any ideas. The program's fairly simple and it keeps a log of what's going on. Basically, if I e