You are not logged in.

#1 2021-01-17 20:17:33

NaNaN
Member
Registered: 2021-01-04
Posts: 65

Unmounting external HDD automatically

I think this is probably not the right forum to post in, but I don't see a post new topic button in system administration.

Can someone tell me if an external hard drive listed in fstab will automatically be unmounted after a shutdown or a reboot command? Or do I have to unmount them manually?

Offline

#2 2021-01-17 20:28:21

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,510
Website

Re: Unmounting external HDD automatically

Unmounted?  Well, yes, but that's kind of meaningless: if the computer is powered off, the drive is obviously not mounted.  Are you actually concerned about the heads being properly parked?  If tha'ts the case, then still yes, assuming a clean shutdown and assuming an unmount command is sufficient to park the heads.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2021-01-17 20:28:24

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,351

Re: Unmounting external HDD automatically

Yes. You can verify this easily by looking at the journal of the shutdown for example.

Not an Arch discussion, moving to Newbie Corner.

Last edited by V1del (2021-01-17 20:28:58)

Offline

#4 2021-01-17 20:51:49

ayekat
Member
Registered: 2011-01-17
Posts: 1,634

Re: Unmounting external HDD automatically

Filesystems are automatically unmounted on shutdown (at least the ones mounted using the mount/umount interface and/or FUSE). If you use anything else to run a filesystem on an external device, that will need to be handled individually (though I believe you would know if you did that).

Trilby wrote:

[…] assuming an unmount command is sufficient to park the heads.

The act of unmounting a file system and the act of spinning down a disk are not directly related AFAIK. If you unmount a filesystem on an external disk, the disk will continue to keep spinning.

If you want to be really safe about that, you probably need to issue some hdparm command for putting a disk in standby mode (spinning it down in many cases). But given that this is about shutting down a system, this will happen automatically already, though I'm not sure which component (kernel, firmware, …) handles it. "Assuming a clean shutdown" is probably enough. smile

---

NaNaN wrote:

I don't see a post new topic button in system administration.

https://bbs.archlinux.org/viewtopic.php?id=218234

The sticky that was not read wrote:

Unfortunately, almost no-one bothered to read the sticky and so many of the posts here were obviously guided by the thought, "well, this is about administering my system, so I'll put it here..."

Last edited by ayekat (2021-01-17 20:53:36)


pkgshackscfgblag

Offline

#5 2021-01-17 21:00:35

NaNaN
Member
Registered: 2021-01-04
Posts: 65

Re: Unmounting external HDD automatically

Thanks everyone.

Ayecat, thank you for the detail. I didn't know there was a different command to stop, or park the heads.

V1del said that I could check through journal of the shutdown. If I wanted to read what he's talking about more in detail, where would I look? journald man page, or systemd?

Also, thanks for pointing out the Sysadmin forum was closed. If I had gone into the sticky thread looking for a reason, I'm sure it wouldn't have been there. It's just Murphy's Law. wink

Offline

#6 2021-01-17 21:01:00

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,510
Website

Re: Unmounting external HDD automatically

ayekat wrote:

The act of unmounting a file system and the act of spinning down a disk are not directly related AFAIK.

This is why I asked about the goal.  An entry in fstab will do just the same as a manual unmount command, nothing less, but yes nothing more either.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2021-01-17 21:09:28

NaNaN
Member
Registered: 2021-01-04
Posts: 65

Re: Unmounting external HDD automatically

Trilby wrote:
ayekat wrote:

The act of unmounting a file system and the act of spinning down a disk are not directly related AFAIK.

This is why I asked about the goal.  An entry in fstab will do just the same as a manual unmount command, nothing less, but yes nothing more either.

So, if there is NO fstab entry for a particular drive that I manually mounted, and I issue a 'shutdown now' command, does that mean the drive will not automatically be unmounted?

Is there a script you can point me to that is invoked after a shutdown command was issued? I'd like to see for myself what it's doing.

Thanks

Offline

#8 2021-01-17 21:15:30

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,510
Website

Re: Unmounting external HDD automatically

That does not logically follow.  I believe systemd will (attemt to) unmount all devices regardless but if you manually mount a device, you should manually unmount it. If you want to learn about shutdown processes, read about systemd:
https://wiki.archlinux.org/index.php/Systemd

But really, if just not having it mounted is the issue, then it's all for naught anyways: there is no persistent state in the device of being mounted, when a system is powered off a device cannot possibly still be mounted.  If the issue is parking heads, then mounting/unmounting is a red-herring.

Last edited by Trilby (2021-01-17 21:17:58)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2021-01-17 21:17:47

NaNaN
Member
Registered: 2021-01-04
Posts: 65

Re: Unmounting external HDD automatically

Trilby wrote:

That does not logically follow.  I believe systemd will (attemt to) unmount all devices regardless but if you manually mount a device, you should manually unmount it. If you want to learn about shutdown processes, read about systemd:
https://wiki.archlinux.org/index.php/Systemd

Thanks Trilby, that's what I needed, a push in the right direction. I'm coming from a BSD background so things are different here. I'm going to have to familiarize myself with Linux a little more. Thank you.

Offline

#10 2021-01-17 21:37:36

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,351

Re: Unmounting external HDD automatically

Afaik it will simply try to unmount everything that has an entry in /etc/mtab . It doesn't matter whether that's initially from an fstab or a manual mount.

As for how the journal/systemd works, as linked you do well familiarizing yourself with what it does and how it works, in particular https://wiki.archlinux.org/index.php/Sy … ing_output for finding out but earlier than current boot.

If your question is sufficiently answered, please mark as [SOLVED] by editing the title in your first post.

Offline

Board footer

Powered by FluxBB