Find the answer to your Linux question:
Results 1 to 9 of 9
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    prevent drive power off on reboot


    I'm using a Thinkpad T440p with Samsung 840 Pro SSD. I set an ATA password that is requested every time the drive turns off. So when I boot any OS from cold it asks for the password, but if I reboot Windows it doesn't, because the drive doesn't get turned off and therefore does not forget the password. The same behavior happens when I reboot using Ctrl+Alt+Del from DOS or early in the Linux boot process.

    Unfortunately when I reboot Linux after completely starting up (so that a reboot actually isn't instant, but Linux gets time to shut down properly), the hard drive seems to forget the password. The computer just turns off at the point where it would say that the password is still there.

    Presumably at some point in the reboot process Linux turns off the hard drive. Does anyone know when that happens? It would be great to be able to quickly switch between Windows and Linux.

    Sorry if this is the wrong forum, but it seemed like the only one it might fit in.

  2. #2
    Linux Guru
    Join Date
    Dec 2013
    Location
    Victoria, B.C. Canada
    Posts
    2,103

  3. #3
    Good idea, unfortunately setting the power setting doesn't seem to be implemented for SSDs, which makes sense, since they never have to spin down.

    Code:
    sudo hdparm -B 255 /dev/sda
    /dev/sda:
     setting Advanced Power Management level to disabled
     HDIO_DRIVE_CMD failed: Input/output error
     APM_level	= not supported
    
    sudo hdparm -B 254 /dev/sda
    /dev/sda:
     setting Advanced Power Management level to 0xfe (254)
     HDIO_DRIVE_CMD failed: Input/output error
     APM_level	= not supported
    Also power isn't really cut in that case and I doubt a regular disk drive would forget the ATA password when you spin it down, as that would make any power management pretty useless.

    The kernel must send some signal to the SSD causing it to forget the password or power off or something like that, otherwise I would have the same problem when I do a hard reboot with Ctrl+Alt+Del from DOS.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer docbop's Avatar
    Join Date
    Nov 2009
    Location
    Woodshed, CA
    Posts
    949
    Just thinking out loud but could it be the difference in speed of a spinny disk and a SSD. A spinny disk there are going to be delays for head movement and the OS storing data for reboot/shutdown. With a SSD near instantious writes and no physical parking heads or similar tasks. So SSD is doing in a second what the spinny disk takes seconds to do, to a CPU that is a huge difference.
    A lion does not lose sleep, over the opinion of sheep.

  6. #5
    Thanks for your thoughts, and you're probably right. But I fail to see the relevance. What does this have to do with the ATA password?

  7. #6
    Linux Engineer docbop's Avatar
    Join Date
    Nov 2009
    Location
    Woodshed, CA
    Posts
    949
    Quote Originally Posted by ernstlenzer View Post
    Thanks for your thoughts, and you're probably right. But I fail to see the relevance. What does this have to do with the ATA password?
    Yea'll I though at too later, but it had me thinking about Windows internal and the shutdown process is long. I used to do Windows systems programming and doubt its changed that much, but it is storing a lot on shutdown, especially if a lot files on the Windows desktop. Windows desktop isn't like Linux or Mac is not a directory its registry based. So if there are files on the desktop Windows has to put copies away. That's why Windows boxes with lots of files, not shortcuts but files are slow to shutdown and startup.

    Sorry about the previous post I would of deleted but had already left the house when I realized it was wrong path.
    A lion does not lose sleep, over the opinion of sheep.

  8. #7
    Oh now I get what you meant. But I guess you're right that it's not the issue here. I don't think it's timeout related, since the SSD should only forget the password if you turn off the power.

    But then I don't think it's possible for OSs to turn off power to a SATA device, I guess it's more likely to be a special ATA command Linux sends to the drive to say goodbye.

  9. #8
    Linux Engineer docbop's Avatar
    Join Date
    Nov 2009
    Location
    Woodshed, CA
    Posts
    949
    Quote Originally Posted by ernstlenzer View Post
    Oh now I get what you meant. But I guess you're right that it's not the issue here. I don't think it's timeout related, since the SSD should only forget the password if you turn off the power.

    But then I don't think it's possible for OSs to turn off power to a SATA device, I guess it's more likely to be a special ATA command Linux sends to the drive to say goodbye.
    Drives have API's for Green Support to spin down a drive to save energy and as a SysAdmin hate the stuff causes all sorts of issues for server and services. But for a desktop user then can be handy to save energy and reduce heat on spinny disk drive. SSD's probably still have support API to handle hibernating computers.

    You're going to have to dig into the system architecture and how devices are signaled for reboot or shutdown, the dig in to how the drive interface handles those signals. It will be a education.
    A lion does not lose sleep, over the opinion of sheep.

  10. #9
    Yeah that's what I thought. I don't mind doing it because it would be interesting. But do you have any clues where I could start looking for stuff like that? I googled all kinds of things trying to figure out what Linux does to SATA when turning off, but there isn't anything that explains in detail what happens.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •