How to mount a USB flash disk in Linux
How to mount a USB flash disk in Linux
There is no doubt that this is a very simple problem, but it is also a problem for beginners. So let's take a look at how to mount a USB flash disk in linux (taking Ubuntu14.04 as an example)
The directory structure in this article is:
1. Mainstream Linux Systems Support automatic mounting. Where can we view
2. What does mounting a USB flash drive mean? All devices are connected to files.
3. How to mount the USB flash disk depends on the format of the USB flash disk.
1. Mainstream Linux Systems Support automatic mounting.
After the USB flash drive is inserted, the system starts to automatically execute the mounting task. I have made several comments on the Internet about how to implement it. I will not discuss it for the time being. In the end, the USB flash drive is mounted to./media/* wangzx (userName) */U disk name /.
2. What does mounting the USB flash drive mean?
In Linux, all devices are regarded as files, that is, "All devices are files ". When inserting a USB flash drive, we can find the USB flash drive device in the/dev/directory. However, this device cannot be used before it is mounted, mounting is to use (that is, to open) the USB flash drive device. Where to mount it means that we can open it like opening a file. Of course, it is still different from general files, "property" is "device "! This is the function of mounting the USB flash drive.
We can use the fdisk Linux Command to view information about the hard disk device. Here, the hard disk is generally sda, and the USB flash disk is generally sdb. I don't know how this works. It may be based on the connection interface-the hard disk is generally the stata interface, and the USB flash disk or mobile hard disk is generally the USB interface, therefore, we can consider sdb for external devices.
Command: sudo fdisk-l/dev restart? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> vc2RiPC9wPgo8cD48aW1nIHNyYz0 =" http://www.2cto.com/uploadfile/Collfiles/20141114/201411140919208.jpg "alt =" \ ">
This command clearly displays information about the storage device represented by sdb sda. The previous sudo is executed with the root permission. I have considered using the root permission, but it seems that the Ubuntu mechanism generally does not allow logon with the root identity (by security name, of course, you can bypass the settings)
[Note]About creating a Ubuntu root identity
Create a root identity in Unbutn: After sudo passwd root is created, enter the password, and then switch to the root identity through su root.
System entry (or the location of the root node in the tree file directory I think ). We can create a folder under the directory we want to mount, for example, mkdir/mnt/usb. Then we will consider mounting the usb flash drive device to this directory.
(B) How to mount the disk is related to the file system format of the USB flash disk (but most of the USB flash disk formats are usually fat32)
Fat16 format
Mount-t msdos/dev/sdb4/mnt/usb/
Fat32 format
Mount-t vfat/dev/sdb4/mnt/usb/
Ext2 format
Mount-t ext2/dev/sdb4 mnt/usb
Now we can open the usb folder to access the usb flash drive, cd/mnt/usb ...... This is what we want. In fact, we can also choose to mount it to other locations without any problem: mount-t vfat/dev/sdb4/home/wangzx/usb, in this way, we can also develop the usb folder under wangzx to open the usb flash drive cd/home/wangzx/usb.