How to Safely Eject a USB Drive in Ubuntu?
Unmounting and safely removing a USB flash drive in Ubuntu is essential to prevent data corruption and ensure all file transfers are completely finished. While modern operating systems employ write-caching to improve performance, pulling a drive out prematurely can interrupt background processes and damage your files. This guide covers the three most common and reliable methods to safely eject a USB drive in Ubuntu: using the desktop GUI, the Files application, and the Linux command line.
Method 1: Using the Ubuntu Desktop Dock
If you are using the default Ubuntu GNOME desktop environment, the quickest way to remove your drive is directly from the desktop dock.
- Inserted USB drives automatically appear as an icon on the left-hand or bottom launcher dock.
- Right-click on the USB drive icon.
- Select Eject from the context menu.
- Wait for the icon to disappear or for a notification stating “Safe to remove” before physically unplugging the device.
Method 2: Using the Files (Nautilus) Application
If you already have your file manager open, you can safely unmount the drive with a single click.
- Open the Files application.
- Look at the left sidebar under the Devices or Volumes section to locate your USB flash drive.
- Click the Eject icon (a triangle with a line under it) next to the name of your drive.
- If a loading wheel appears, wait for it to finish. Once the drive’s name disappears from the sidebar, it is safe to unplug.
Method 3: Using the Terminal (Command Line)
For users working without a graphical interface or who prefer using the terminal, Ubuntu provides powerful command-line utilities to manage storage devices.
First, you need to identify the identifier of your USB drive. Open
your terminal (Ctrl + Alt + T)
and run the following command:
lsblkThis will list all block devices. Look for your USB drive by matching
its storage size (e.g., sdb, sdc).
Once you have identified the drive partition (for example,
sdb1), use the udisksctl command to unmount
and power down the drive safely:
udisksctl unmount -b /dev/sdb1
udisksctl power-off -b /dev/sdbThe first command unmounts the filesystem, while the second command safely cuts power to the USB device, signaling that it can be physically removed from the computer.