(setq plaintext 'everywhere)



Safely Remove External Hard Drives From The CLI

Table of Contents

1 Introduction

[2023-10-22 Sun]

You might have noticed that after

sudo umount /dev/sdX

a external hard drive is still making noise and appears to be in use by the OS. This is because rotating hard disks require a few extra commands before they can be safely unplugged, udisks is a CLI tool that can be used for this purpose.

2 Udisks

To unmount the external harddrive:

udisksctl unmount -b /dev/sdXn

followed by:

udisksctl power-off -b /dev/sdX

The commands result in a graceful power down of the spinning hard drive; after which it can be safely unplugged.

Note that the last command turns off all the power to the specific port and if you use a usb hub that might cause other devices connected to that hub to lose connection, check the udisksctl man page for more information on this.

3 Sources



If something is not working, please create an issue here.