Updated: 12/16/2018 by Computer Hope
When you are finished using a USB flash drive that is connected to your computer, you should not pull it out of the USB port. Instead, you should eject it, using the eject option provided by your OS (operating system).
Note: The steps on this page can also be used to safely eject other devices connected to a computer via USB, including smartphones.
When you eject a flash drive, you’re telling the operating system that the drive is about to be disconnected. The operating system will complete any read or write operations on the drive, and unmount it from the computer.
If you do not eject a USB flash drive before disconnecting it, there is a chance that data on the drive will be corrupted, because the operating system was not expecting it to be disconnected. For this reason, it’s best to always eject your USB drive before physically disconnecting it from your USB port.
The Windows, macOS X, and Linux operating systems each provide a safe method to eject a flash drive.
Eject a USB drive in Windows
Using the notification area
- In the Notification Area of the taskbar, click the up arrow to view the items in the systray. Then, right-click the Eject Media icon.
- A menu lists the removable media you can eject. Click the name of your USB flash drive. In this example, the open to eject the USB flash drive is named “Eject Cruzer Glide.”
After clicking the eject option, wait for a message stating it is safe to remove the hardware before pulling the flash drive out of your computer.
Using File Explorer
- Open File Explorer by pressing Win+E.
- On the left, click This PC.
- On the right, right-click your USB flash drive.
- Select Eject.
Eject a USB drive in macOS
With ⌘+E keyboard shortcut
- Locate the USB flash drive on your desktop. Click it once to select it.
- On your keyboard, press ⌘+E to eject the flash drive.
- Open the Finder utility. On the left, locate your USB flash drive under Devices.
- Click the eject icon (⏏) to the right of the flash drive.
- Locate the USB flash drive on your desktop.
- Drag-and-drop the USB flash drive into the trash bin icon. When you start dragging a removable disk, such as your USB flash drive, the Trash turns into an eject icon (⏏). When you drop the disk on the eject icon, the disk is ejected. No data is deleted by using the Trash icon this way.
You can now safely remove the USB flash drive from your computer.
Eject a USB drive in Linux
In a Linux operating system, you can eject a USB flash drive in your file manager, or in the command line shell.
File manager example: Nautilus
In this example, we’ll eject a USB flash drive using Nautilus, the default file manager in Ubuntu. Nautilus is a lot like the Windows File Explorer. (Your file manager may be different if you’re using another Linux OS.)
Open a new Nautilus window by clicking the shortcut on your dock. It looks like a file cabinet, labeled Files.
Or, click Activities (on the left side of your taskbar). In the search box, type Files, or Nautilus. In the search results, click the Files icon.
Or, open a terminal (Ctrl+Alt+T), type nautilus, and press Enter.
In the Nautilus file manager window, you’ll find your USB flash drive listed on the left. Click the eject icon (⏏) next to the disk name.
Your disk is removed from the list, and a notification informs you that it’s safe to remove the USB flash drive.
Ejecting from the Linux shell.
In every Linux operating system, the administrator can eject a mounted USB flash drive with the eject command, specifying the device name of the USB flash drive.
For example, if your USB flash drive is mounted as the device name /dev/sdc, and your user is a sudoer (you have administrator rights), you can eject it with the command:
sudo eject /dev/sdc
Here, the sudo command means “run the following command as administrator.” When you press Enter, you are prompted for your password.
When the command runs, all pending I/O operations for the specified device are forced to complete immediately, as if you’d run the sync command. Then, the device is unmounted, as if you’d run umount.
If eject is successful, the command will display no output. You can safely disconnect your USB flash drive.
Determining your flash drive’s device name
If you’re not sure of the device name for your USB flash drive, you can list it with parted.
The device name of your USB flash drive is /dev/sdx, where x is a lowercase letter a–z.
List your mounted devices by running parted -l as root, or with sudo:
sudo parted -l
In this example, disk /dev/sdb is our USB flash drive, so the eject command would be:
sudo eject /dev/sdb