I’m running a Ubuntu server on my old laptop with an external HDD connected to it. The external HDD is powered independently from the laptop, as it is plugged into the wall.

During a power outage, my laptop remains operational due to its battery, but the HDD shuts down. When power is restored, my laptop does not automatically remount the HDD, and I have to reboot the system manually to access it.

Does anyone know how I can resolve this issue?

Edit: Not sure if this added context changes anything, but this is the HDD I’m using. It’s a 3.5" HDD that gets its power directly from the wall.

  • Natanael
    link
    fedilink
    English
    521 days ago

    I recommend a UPS, even a small one is fine for this. Spinning disks don’t like frequent starts and stops, especially not unplanned powerless ones.

    At least you should be running a journaling file system or something similar which tolerates power loss decently (you’ll still see data corruption, but the file system won’t die). If you run software that doesn’t tolerate power loss well, then you absolutely need an UPS

    • @SpikesOtherDog@ani.social
      link
      fedilink
      English
      121 days ago

      Find a used one for sale. Bonus points if it has any kind of management. Replace the battery. If at all possible, have it unmount the drive at a certain percentage.

    • Lenna 🔞OP
      link
      fedilink
      English
      121 days ago

      This is my HDD. Aren’t these guys able to handle power losses since people usually plug them in to backup stuff, and then pull the plug once they’re done?

      And does ext4 count as a journaling file system?

      • @chris@l.roofo.cc
        link
        fedilink
        English
        121 days ago

        It’s not good to power off a mounted drive. At least for the file system. I don’t know about the drive itself.

      • Natanael
        link
        fedilink
        English
        1
        edit-2
        21 days ago

        It counts as long as barriers are on

        https://archive.kernel.org/oldwiki/ext4.wiki.kernel.org/index.php/Ext4_Howto.html#Barriers_on_by_default

        External drives expect you to ensure writes complete first. If you don’t then smart software with copy-on-write and consistency checks can survive power loss (at the cost of losing recent changes). Other software which assumes a reliable drive can get wrecked.

        Lots of file systems can not handle random power losses because they don’t force continous integrity of the disk file system, that’s why FAT formatted drives so often get corrupted