Do you know how to mount a USB drive in Linux system? In most cases, Linux systems will mount the USB drive automatically. But sometimes, you need to mount USB drive Linux manually. In this post, MiniTool Partition Wizard shows you how to do that and gives you clues on how to make Linux mount USB drive automatically.
Why Need to Mount USB Drive Linux?
If you need to use computers frequently, a USB drive is necessary. If you use a Windows computer, when you plug a USB drive into the computer, the computer will automatically recognize the drive.
Like Windows, most Linux distributions are also configured to automatically recognize and mount USB devices as soon as they are inserted into the USB ports. Ubuntu, for example, automatically mounts a USB device to the /media/USERNAME/ directory.
However, you can still find some older distributions that require external USB devices to be manually mounted before they can be used. Or some Linux server distros require you to mount USB drive manually. In addition, if the automatic mounting function goes wrong, you also need to mount the USB drive manually.
Only when the drive is mounted, can Linux display it. Then, you can access the files in the USB drive.
Formatting USB Drive Linux
Before you mount USB drive Linux, you should format the USB drive to a proper file system. As we all know, some USB drives are preformatted in FAT32, exFAT, or NTFS file system. These file systems are well supported in Windows systems.
However, in Linux systems, FAT32 and exFAT file systems are still supported well but the compatibility with NTFS file system may be not so good.
NTFS file system is a special file system developed by Microsoft. It has become the standard file system of the Windows NT family since Windows NT 3.1. If you want to use NTFS file system in Linux, you should install ntfs-3g package. But even through the package is installed, the NTFS performance in Linux is still not excellent.
Therefore, before mounting the USB drive in Linux, most Linux users would like to format the USB drive to FAT, exFAT, EXT, or other file systems supported by Linux system.
To format the USB drive for Linux, there are 3 ways for you. Please keep reading to get them.
This post introduces Linux file system and Linux directory structure. It can help you understand Linux better.
1. Format the USB Drive Under Linux System
If your computer has only the Linux system installed, this method is very useful to you. Please follow the guide below:
Step 1: Insert the USB drive into the Linux computer and open the command line terminal window with hotkey "ctrl + alt + T".
Step 2: Make sure you have installed a tool named "dosfstools". If not, please install it with command. Please note that the command varies depending on what OS and package manager you use (it may be "apt-get install dosfstools", "pacman -S dosfstools", "yum install dosfstools -y", etc.).
Step 3: After the dosfstools package is installed, type command "fdisk -l" to display drive information. From various drives, find out the USB drive and note down its Device information. For example, in the following picture, the USB drive is /dev/sdb1.
Step 4: Format the partition with mkfs command. If you want format it to FAT32, use command "mkfs.vfat -F 32 /dev/sdb1". If you want to format it to exFAT or EXT4, use command "mkfs.exfat /dev/sdb1" or "mkfs.ext4 /dev/sdb1".
Some people may wonder which file system to choose. In my mind, exFAT and EXT4 are better than FAT32, because FAT32 cannot store a single file which is larger than 4GB and it cannot create a FAT32 partition that is larger than 8 TB (Windows only recognizes 2TB).
As for exFAT vs EXT4, they have their own advantages and disadvantages. For example, exFAT has better compatibility, but in Linux, EXT4 has better performance.
Here is the full guide of NTFS vs FAT32 vs exFAT. Check out this post to know the differences.
2. Format the USB Drive Under Windows System
As the mainstream OS is still Windows, many people would like to dual boot Windows and Linux systems. If you adopt this dual-boot mode, too, you can format the USB drive under the Windows system.
To format the USB drive for Linux, I recommend you to use MiniTool Partition Wizard, a professional disk management program. This software allows you to format the USB drive to FAT, exFAT, or EXT4 for free. Here is the guide:
Step 1: Download MiniTool Partition Wizard Free Edition and launch this software. Go to its main interface, right-click the partition on USB flash drive, and choose Format from the context menu.
Step 2: In the Format Partition window, choose FAT32, exFAT or Ext4 file system, and then click OK button.
Step 3: Click Apply button to carry out the pending operations.
Of course, if you just want to format the USB drive to FAT32 or exFAT file system, you can also use Windows built-in tools. For example, you can format it in File Explorer, or you can format it in Disk Management.
- If you want to format it in File Explorer, you just need to open File Explorer, highlight This PC, right-click the USB flash drive, and choose .. option.
- If you want to format it in Disk Management, you need to press Windows key + R, type "msc" in the Run box, press Enter key to open Disk Management, right-click on the USB flash drive partition, click Format... option, and then follow the on-screen wizard to format the drive.
After formatting the USB drive to a proper file system, you need to shut down Windows system and boot the Linux system to make Linux mount USB drive.
How to Mount a USB Drive in Linux
To mount a USB drive in Linux, you can use command lines to mount the USB drive temporarily or permanently. You can also write scripts to make Linux mount USB drive automatically. It depends on your choice.
Mount/Unmount USB Drive Manually
To mount USB drive Linux, you can refer to the following steps:
Step 1: Insert the USB drive and Linux system will detect the drive. Then, you should open the command line terminal window, type command "fdisk -l", and note down the Device information of the USB drive (in this post, the USB drive is /dev/sdb1).
Step 2: Determine the mount point on which the USB drive is mounted. The mount point can be an existing one. But you can also create a new mount point with mkdir command, for example, "mkdir /media/usb-drive".
Step 3: Make Linux mount USB drive on the newly-created mount point with command "mount /dev/sdb1 /media/usb-drive/". However, this command is temporary. If the computer reboots, you should remount the USB drive. To mount the USB drive permanently, you can use the following commands:
- blkid /dev/sdb1. This command will tell you UUID (Universally Unique Identifier) of the USB drive. Note down UUID for future use.
- vi /etc/fstab. This command allows you to modify /etc/fstab file (static file system information). The /etc/fstab file provides information about the Linux file system. It defines how storage devices and partitions are initialized and how they are connected to the entire system.
- In the /etc/fstab config file, add line: "UUID=11263962-9715-473f-9421-0b604e895aaa /media/usb-drive ext4 defaults 0 2". In this command line, you should change UUID, USB mount point, and file system type accordingly.
After your work is completed, you may want to remove the USB drive. Then, you should unmount the USB drive before ejecting the drive. Here is the command: umount /media/usb-drive.
This post shows you how to install Kali Linux on VirtualBox, VMware, USB, and Windows 10.
Mount/Unmount USB Drive Automatically
If you want to make Linux mount and unmount the USB drive automatically (without changing Linux distro), you can use UDEV to complete that. It's what automatically configures the proper devices and device symlinks (eg /dev/disk/by-label/<LABEL>), both at boot time and for devices added while the system is running.
Using UDEV to make Linux mount and unmount the USB drive automatically is slightly complicated, because it requires you to write some scripts. But if you want to configure that indeed, you can refer to the answer from superuser forum to write your own scripts.
Here is post showing you how to mount a USB drive in Linux. It offers you three ways to mount the USB drive. With these methods, you can mount it temporarily, permanently, or automatically.Click to tweet
Is this post useful to you? Do you have other methods to mount USB drive Linux? Do you have any doubts about the above Linux mount USB drive process? Please leave a comment below for sharing and discussion. In addition, if you have difficulty in formatting the USB drive, please contact us via [email protected]. We will get back to you as soon as possible.
Mount USB Drive Linux FAQ
- Type command "fdisk -l" and note down the Device information of the USB drive.
- Type command "mkdir /media/usb-drive" to create a mount point named usb-drive. Of course, you can skip this step, if you want to mount the USB drive under an existing empty directory.
- Type command "mount /dev/sdb1 /media/usb-drive/" to mount the USB drive /dev/sdb1 under the directory usb-drive.
To access your external hard drive on Linux, you need to mount the drive first. Most Linux distros will mount the USB drive automatically, but some distros may need you to mount it manually.
After that, you can view contents in the USB drive via a file manager or via command like "cd /mnt". The command "cd" is the abbreviation of Change Directory, which is a command used to switch the working directory.