You are not logged in.

#1 2023-09-24 05:53:47

archery_64
Member
Registered: 2022-11-18
Posts: 3

Hdd head parking when shutting down

Hello.

I installed Arch Linux on an external hard drive and I can't figure out how to safely unmount it, since I am booting into it. Usually, for external hdd that I use only for copying/pasting data, I use combination of umount and udisksctl to unmount and eject it. Now, I can't use it since the external drive in question is the one that I am booting, meaning that it is still being used, and powering it off will end with a head parking sound. I also got an error about bad drive sector which, I think, is linked to the repeated head parking during power off.

I have followed this solution but it doesn't fix my problem. I think that it is because they aren't booting from the external drive and a lot of similar problems with solutions that I found doesn't address the situation of booting directly from external drive. Is there a way to safely unmount my drive during power off?

Additional info:

File foo.shutdown in /usr/lib/systemd/system-shutdown

#!/usr/bin/zsh

hdparm -Y /dev/sdb

smartctl -a /dev/sdb/ output
pastebin

Offline

#2 2023-09-24 07:35:20

willemw
Member
Registered: 2013-02-19
Posts: 116

Re: Hdd head parking when shutting down

Here is an idea. Don't know how feasible it is.

Create a systemd service that depends on or is a dependency of the sytemd mount unit for your root partition (see "systemctl status -- -.mount"). Put the udiskctl command in the systemd service to eject the drive and have it run that command when that mount unit stops.

Last edited by willemw (2023-09-26 05:53:10)

Offline

#3 2023-09-24 07:40:39

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Hdd head parking when shutting down

You'll end with the emergency retracts because usb is shut down while the root partition is still in use.
Idling it won't help.

Can you "systemctl halt" instead of poweroff?
jbD97.png

Offline

#4 2023-09-26 05:29:46

archery_64
Member
Registered: 2022-11-18
Posts: 3

Re: Hdd head parking when shutting down

willemw wrote:

Here is an idea. Don't know how feasible it is.

Create a systemd service that depends on or is a dependency of the sytemd mount unit for you root partition (see "systemctl status -- -.mount"). Put the udiskctl command in the systemd service to eject the drive and have it run that command when that mount unit stops.

Thanks for your input. Since it seems more involved, I'll keep that in mind and do it when I get deeper with systemd.

Offline

#5 2023-09-26 05:31:17

archery_64
Member
Registered: 2022-11-18
Posts: 3

Re: Hdd head parking when shutting down

seth wrote:

You'll end with the emergency retracts because usb is shut down while the root partition is still in use.
Idling it won't help.

Can you "systemctl halt" instead of poweroff?
https://i.stack.imgur.com/jbD97.png

I tried systemctl halt and it works in the sense that my external drive doesn't do head parking, but, still, it isn't power off.

Last edited by archery_64 (2023-09-26 05:31:37)

Offline

#6 2023-09-26 05:56:29

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Re: Hdd head parking when shutting down

No, you'll have to push the power button and manually turn off the system - or do you mean that the USB drive is still spinning by the end of this?
The head should™ rest at some point.

Offline

#7 2023-09-26 13:58:03

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,612

Re: Hdd head parking when shutting down

Just thinking out load without figuring out how to implement this just yet ---

What about creating a file system image that has a very basic root partition and loading it to a RAM disk.  Then chroot into it, dismount the external drive, and shut down from inside the chroot?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB