How to eject SATA device properly in Linux? I know eject command can do it for usb device:
Does it work same way for SATA devices? Will it sync caches, and properly power down SATA device?
The solution is to spin down the drive via software before turning it off and unplugging it. The best way to do this is with a utility called scsiadd. This program can add and remove drives to Linux’s SCSI subsystem. Additionally, with fairly modern kernels, removing a device will issue a stop command, which is exactly what we’re looking for.
which should print something like:
Identify the drive you want to remove and then issue:
substituting the corresponding values from the scsiadd -p output. For example, if I wanted to remove “WDC WD10EACS-00Z”, I would run:
If everything works, scsiadd should print:
You can double-check the end of dmesg. You should see:
At this point, the drive is removed from Linux’s SCSI subsystem and it should not be spinning. It’s safe to unplug and turn off.
mount command can help you, see man mount
So, you need to 'eject' that device, just check which device it is, you can do it with:
So if you want to 'eject' /dev/sda1 just use:
Ofcourse if device is in use/busy it won't let you do it, like sda1 is where my OS is :D