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?

  • irmadlad@lemmy.world
    link
    fedilink
    English
    arrow-up
    13
    ·
    14 hours ago

    I had one back in the day like that. My notes on that event are old so maybe someone can modify or clarify.

    First you’ll have to find the UUID of the external drive. (lsblk -f) Then create a mount file like: sudo nano /etc/systemd/system/mnt-data.mount. In the mnt-data.mount file, insert something like:

    [Unit]
    Description=External HDD Mount
    Requires=dev-disk-by\x2duuid-<YOUR_UUID>.device
    After=dev-disk-by\x2duuid-<YOUR_UUID>.device
    After=local-fs.target
    
    [Mount]
    What=/dev/disk/by-uuid/<YOUR_UUID>
    Where=/mnt/data
    Type=ext4  # Change to ntfs, xfs, etc., depending on your drive format
    Options=rw,noatime,nofail
    

    Enable and reload:

    sudo systemctl daemon-reload
    sudo systemctl enable mnt-data.mount
    sudo systemctl start mnt-data.mount
    

    Verify status:

    systemctl status mnt-data.mount

    Should say ‘active’. Reboot and test. Let me know if that works. Like I said, that was a while ago. If it works, it’s just another reason why you should doccument your server setups. If it doesn’t, well shucks I tried. LOL

      • feannag@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        4
        ·
        6 hours ago

        Wouldn’t that just mount the HDD when the server boots? I think the issue is re-mounting it while the server remains up, hence the systemd service. But maybe I don’t understand fstab fully.

        • happy_wheels@lemmy.blahaj.zone
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 hour ago

          I wanted to provide feedback for THIS part only. :) not for OPs issue. I would have responded to OPs post if that were the case…

    • Lenna 🔞@piefed.caOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      12 hours ago

      My /etc/fstab file currently has the following:

      UUID=412ea77a-96e1-427c-9f75-2aae2fe0dca1 /mnt/wd ext4 defaults 0 2

      If I were to use the mnt-data.mount you’ve suggested, does that mean I need to delete what I already have in /etc/fstab and replace it with what you suggested?