Linux Mounting Flashdrive Twice

GeekThis happily runs on Vultr. Get $300 of free hosting credits to try out their cloud compute, kubernetes engine, or managed databases. Try Vultr today to claim your free $300.

I have once again started using Linux while working away from my main office. And it seems that every time I start using Linux after a break, I come across an issue that I have to resolve. I shouldn’t really complain though since it does give me something to write about. This time was a fairly odd issue with a very simple fix. Whenever I would plug in my flash drive or external media (such as a hard drive), my operating system would mount normally and show the Desktop icon, but the flashdrive appeared twice under “Devices.” For me, I see the “Devices” when looking at folders on the side pane.

My first idea was to format the flash drive and change the label on it using GParted. This didn’t work and only made the issue more odd. Now when I plugged in my flash drive it would appear once as the new label and once using the old label. At this point I was really confused.

I then recalled that there is a file that handles auto mounting of media located at /etc/fstab. This file identities a device using the UUID of the device or the device location in /dev/. Opening up this file I could see that my flashdrive was in the list of items to be auto mounted, which conflicts with the default mounting from my linux installation. This resulted in the flash drive being mounted twice and under different labels, since the /etc/fstab file contains the location of where I want the flash drive to mount to, which is the old label.

To fix the problem, follow the steps below. Beware that making an incorrect change in the fstab file can cause serious problems such as having your computer no longer boot properly.

  1. Open up terminal using the keyboard shortcut (ctrl + alt + t) or by finding it in the Menu.
  2. Edit the fstab file as an evaluated user by using the sudo command. You can use gedit, nano, vim, or anything else to edit the file. Run sudo nano /etc/fstab.
  3. While in the fstab file, find the media device you no longer want to auto mount and place a # in front of the line. In the case it’s the incorrect device, you can easily revert changes by deleting the # in the future. You can usually identify the device because the first part of the line will contain the device name, such as “/dev/disk/Lexar-USB-Flash-Drive” or you can look at each line and identify the line by the mounting location.
  4. Save the file and plug in your external media device and check to see if it mounts only once.

Hopefully this solves the problem for a lot of the readers out there. If you have any other suggestions please leave a comment explaining what you did to solve the problem. I was using Linux Mint with the Cinnamon window manager when fixing this problem but this should work with nearly all Linux distros. For additional information on the fstab file, check out the documentation at Ubuntu Community

Related Posts

Using Olimex with AVRDUDE in Linux

This post covers how to get the olimex avr-isp-mk2 programmer to run with AVRDUDE and Linux, along with how to modify Udev permissions.

Backup Evolution using the Terminal

Learn how to backup all of your Evolution data through the terminal by using a simple command. There is no longer a need to open Evolution to perform backups.

Todoist App for Linux

Learn how to add a Todoist app to your Linux computer by using the Chrome App.

LUbuntu Keyboard Shortcuts (Openbox)

Learn how to edit keyboard shortcuts inside of Openbox and LUbuntu.