this post was submitted on 19 May 2026
35 points (94.9% liked)

Selfhosted

60024 readers
924 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam.

  3. Posts here are to be centered around self-hosting. Please ensure it is clear in your post how it relates to self-hosting.

  4. Don't duplicate the full text of your blog or git here. Just post the link for folks to click.

  5. Submission headline should match the article title.

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 3 years ago
MODERATORS
 

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.

you are viewing a single comment's thread
view the rest of the comments
[–] irmadlad@lemmy.world 17 points 1 month ago (3 children)

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

[–] happy_wheels@lemmy.blahaj.zone 9 points 1 month ago (2 children)

This but put the entries in /etc/fstab instead.

[–] feannag@sh.itjust.works 6 points 1 month ago (2 children)

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 1 points 1 month 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....

[–] klankin@piefed.ca 1 points 1 month ago

I think you can use the service to remount using the fstab entries/options. (Like "mount /dev/disk/by-uuid/XXX" and it'll automatically apply the options and mountpoint)

Arguably cleaner depending on your setup

[–] irmadlad@lemmy.world 2 points 1 month ago

I'll make an addenda to my notes. Thanks.

[–] IpsumLauren@lemmy.world 3 points 1 month ago

TIL about systemd mounts, thanks!

[–] Lenna@piefed.ca 2 points 1 month 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?