How to Stop Ubuntu from Automatically Unmounting USB Drives

The Premature Ejection

Ubuntu is designed with robust power-saving algorithms, particularly on laptops. To conserve battery, the system actively monitors peripheral devices. If you connect a USB flash drive or an external hard drive and do not read or write data to it for a specific period, Ubuntu’s power management daemon (TLP or the standard kernel power manager) might determine the drive is idle and automatically unmount or suspend it. This is highly problematic if you have a slow-running backup script executing in the background, or if you simply left a document open from the drive; when you return, the drive appears disconnected, causing data errors or failed transfers.

Maintaining the Mount

To ensure your external drives remain continuously accessible and stop Ubuntu from automatically unmounting or suspending USB devices, you must disable USB autosuspend in the system parameters.

Open your terminal (Ctrl+Alt+T). You need to modify the GRUB bootloader configuration to permanently disable the kernel’s USB autosuspend feature. Type sudo nano /etc/default/grub and press Enter (provide your password). Look for the line starting with GRUB_CMDLINE_LINUX_DEFAULT. Inside the quotation marks at the end of that line, add a space and then type usbcore.autosuspend=-1. For example, the line might now look like this: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.autosuspend=-1". Press Ctrl+O then Enter to save, and Ctrl+X to exit the text editor. Finally, you must apply the new configuration by typing sudo update-grub and pressing Enter. Reboot your computer for the change to take effect permanently.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.