- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to mount usb drive in a linux system
Do you know “how to use USB memory sticks with Linux”, If you are not sure then this article describes “how to mount USB drive on a Linux system with command line interface”
Universal serial bus, or USB (also known as Flash drive), is an electronic communications protocol that is commonly used in computer accessories and other small devices. If you have an up-to-date Linux system and a modern Desktop environment, your device should show up on your desktop, with no need to open a console. There are few important factors which are involved in learning how to mount USB drive with Linux machine.
Following are the step by step instructions to understand further –
Step 1: Plug-in USB drive to your PC
Step 2 – Detecting USB Drive
After you plug in your USB device to your Linux system USB port, It will add new block device into /dev/ directory. To verify it, use the following command –
$ sudo fdisk -l
The sample output should be like this –
Disk /dev/sdb: 15.7 GB, 15664676864 bytes 255 heads, 63 sectors/track, 1904 cylinders, total 30595072 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdb1 * 32 30595071 15297520 c W95 FAT32 (LBA)
We can observe from the above result that, device boot, blocks, id and system format are displayed.
Step 3 – Creating Mount Point
To mount the USB, use the following command –
$ mount /dev/sdb1 /mnt
To create a directory in the mounted device, use the following commands –
$ cd /mnt /mnt$ mkdir john
The above command creates a directory called john in USB device.
Step 4 – Delete a Directory in USB
To delete a directory in USB, use the following command –
/mnt$ rmdir john
Step 5 – Formatting the USB
You should unmount the device first to format the USB device, then use the following command to unmount the device –
$ sudo umount /dev/sdb1
Now use either of the commands as per file system based on your requirement. To format a USB drive, users generally prefer VFAT or NTFS file systems because they can be easily mounted on Windows operating systems and Linux systems.
Format vs Fat FileSystem
To format USB with vFat File System, use the following command –
$ sudo mkfs.vfat /dev/sdb1
Format NTFS FileSystem
To format a USB Flash Drive with NTFS file system, use the following command –
$ sudo mkfs.ntfs /dev/sdb1
Format EXT4 FileSystem
To format a USB with EXT4 file system, use the following command –
$ sudo mkfs.ext4 /dev/sdb1
Congratulations! Now, you know “How to Mount USB Drive in a Linux System?”. We’ll learn more about these types of commands in our next Linux post. Keep reading!
- Related Articles
- How to Keep Data on a USB Flash Drive Secure
- How to Add a New Disk Drive to a Linux Machine
- How to eject the USB device from the system using PowerShell?
- How to check if the USB device is connected to the system using PowerShell?
- Difference between Individual Electric Drive and Group Drive System
- How to Create a New Ext4 File System in Linux?
- How to flushes file system buffers in the Linux operating system?
- How to Add Cron Jobs to A Specific User in a Linux System
- How to Change or Set System Locales in Linux
- How to converts tabs to spaces in the Linux system?
- How to set src to the img tag in html from the system drive?
- How to Create a File in the Linux/Unix system using terminal?
- How to format contents of a text file in the Linux system?
- Learn How to Manage System Firewall using Iptables in Linux
- How to merge lines of files in the Linux system?