You are not logged in.
I’ve been searching for a way to safely remove a hard drive without causing it to have a screeching sound through the terminal, which seems to happen with most drives I’ve tested with ‘umount’, which also doesn’t seem to power down the disk. Using general search terms only brings up umount and udisks which is no longer supported.
Is there any way to safely spin down the disk and power it down through the terminal?
What required utilities do I need to install for this after a base Arch install?
Last edited by Anon_a (2020-07-06 18:10:25)
Offline
umount should be sufficient. You may want to run sync do be extra sure. Old Unix Greybeards will run sync twice.
To spin it down try hdparam after unmounting by putting the drive to sleep (the -y option)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Online
Is there any other way to power down the disk after unmounting it, like in GNOME with udisksctl power-off or is it the same as setting the disk to idle? I'd like to avoid having to use hdparm, but if the sound I'm hearing is normal then I think umount should be sufficient.
I was also wondering if I could install udisks2 without the full GNOME desktop and use that instead of hdparm to power off or idle the disk. Any other possible methods to achieve the same effect would also be helpful, since the sound is really bothering me.
Offline
Why do you think udisks is tied to any particular desktop environment?
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
I thought it did because I always saw it mentioned along with GNOME, but now that I take a look at the freedesktop.org website, I might be wrong, but then why doesn't anyone mention udisks2 when working with hard drives without GNOME, is there something I'm misunderstanding about working with hard drives in Linux?
The dependency list for udisks2 also requires gtk3 for gtk-doc, am I missing something?
Last edited by Anon_a (2020-07-06 17:53:51)
Offline
I can't talk for anyone else, but the Arch wiki page about udisks doesn't mention GNOME beyond stating that DEs may include wrapper scripts.
I think what you're missing is that there's no need for each DE to have their own unique ways to mount hard drives -- the kernel and hardware don't care what DE you're running (if any).
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
So to make sure I understand everything correctly, umount is the only command I need to remove a hard drive safely without any possibility of damaging it, even if I unplug it without having it spinned down or powered-off?
I can also install udisks2 without having to install most of the GNOME desktop and use udisksctl to power-off the disk.
Offline
Yes. If the disk was mounted with udisks you could also unmount it with udiskctl but there will not be a functional difference between unmounting it with umount or with udisksctl.
Offline
Modern drives will unload and park the heads upon removal of power. That is the sound you are hearing.
Running sync first won't hurt.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Online
I've seen these documented over the years - please research them to make sure they are all still relevant.
# man sync
sync
# https://www.kernel.org/doc/Documentation/sysctl/vm.txt
# echo 3 > /proc/sys/vm/drop_caches
# man blockdev
# blockdev --flushbufs /dev/sdX
# man hdparm
# hdparm -F /dev/sdX
# Not sure if this still works on newer kernels:
# echo 1 > /sys/block/sdX/device/delete
Offline