Both fixed and removable data drives can be locked by using the Manage-bde command-line tool and the -lock command.
Note
Ensure all data is saved to the drive before locking it. Once locked, the drive will become inaccessible.
The syntax of this command is:
manage-bde.exe -lock
Outside of using this command, data drives will be locked on shutdown and restart of the operating system. A removable data drive will also be locked automatically when the drive is removed from the computer.