On elementary OS Loki, if I mount my external hard disk and eject the hard disk, the external hard disk continues spinning. And if I shutdown the computer it takes a long time. Is this a bug?
After you eject a drive it is safe to disconnect the USB cable and/or cut the power (if the drive uses a power adapter). If you unmount it, just make sure that if it has multiple partitions, all if them are unmounted.
Ejecting or unmounting an external hard drive does not always make it spin down or power down; that behavior is up to the controller inside the hard disk which interfaces between USB and SATA. Ejecting simply tells the drive to finish any pending read/write operations and then ceases all communication.