How to Stop Ubuntu from Automatically Unmounting USB Drives

The Missing Drive

In certain desktop environments or server configurations, Ubuntu employs strict power management rules for external peripherals. If you connect a USB flash drive or an external hard drive and do not actively read from or write to it for a specified period, the system may automatically put the drive into a low-power suspend state, which can sometimes result in the drive unmounting itself from the file system. When you return to your computer an hour later and attempt to save a file, the drive is gone from your file manager, forcing you to physically unplug and replug the USB cable to force Ubuntu to recognize it again.

Disabling USB Autosuspend

To ensure your external USB drives remain permanently mounted and instantly accessible regardless of how long they sit idle, you must disable the USB autosuspend feature within the GRUB bootloader configuration.

Open your terminal (Ctrl+Alt+T). You need to edit the main bootloader file with administrator privileges. Type sudo nano /etc/default/grub and press Enter. Inside the nano editor, look for the line that begins with GRUB_CMDLINE_LINUX_DEFAULT. This line contains various boot parameters inside quotation marks (such as “quiet splash”). Use your arrow keys to navigate inside these quotation marks, add a space after the existing parameters, and type exactly: usbcore.autosuspend=-1. The final line should look something like this: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.autosuspend=-1". Press Ctrl+O to save the changes, then Ctrl+X to exit nano. Finally, apply the new configuration by typing sudo update-grub. Reboot your machine. The Linux kernel will now provide continuous power to all USB ports, ensuring your external drives never drop offline.

Get the best tech tips delivered straight to your inbox.

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