Linux Device Mount command mount and u disk, removable hard disk, CD-ROM Mount __linux

Source: Internet
Author: User
Tags mkdir

Linux systems do not automatically recognize and load new devices like Windows systems, requiring manual identification and manual loading. Everything in Linux is file. The file is organized by a large file tree, and the root directory of the file tree is:/, progressively expanded from the root. These documents are spread through a number of equipment. The command mount (Mount) connects the file tree in the device to the file tree on the Linux system, which means that the new device can be loaded into the Linux system by this command. Similarly, the Umount command is used to unlock the device file tree.


The standard form of the Mount command is as follows:

       mount   -t  type   device   dir

Where type represents the kind of device file system to mount, device represents the device to mount, and Dir represents the mount point of the device on the system.

Linux commonly used file system types are disk file system, network file system, proprietary/virtual file system.

It should be noted that theLinux system can only mount the device under root rights users


Disk File system includes hard disk, U disk, disc array, CDROM, DVD and so on. Common file systems include AutoFS, Coda, Ext2, Ext3, EXT4, VFAT, ISO9660 (CD-ROM or CD-ROM mirroring), UFS (Unix file System,unix file system), FAT (file allocation Table, file allocation table), FAT16, FAT32, NTFS (New technologyfile System), and so on.


Network File System: A file system that can be accessed remotely, the file system is still a local disk file system on the server side, and the client accesses the data remotely over the network. Common file system formats are: NFS (Network File system, network filesystem), Samba (smb/cifs), AFP (Apple fillingprotocol,apple File Archiving Protocol), and WebDAV.


Proprietary / virtual file System : A file system that does not reside on disk. Common formats are: TMPFS (temporary file system), PROCFS (process filesystem, Progress file System), and LOOPBACKFS (loopback file system, loopback filesystem).

We usually mount the disk files on the Linux system in general. The following is mainly about how to mount U disk, hard disk, CD-ROM and so on to the Linux system.

1, U-Disk Mount

USB flash drives are treated as SCSI devices for Linux systems. First switch to the root permission user. Before inserting a U disk, use the "fdisk-l" command to view the system's list of disks. As shown in the following illustration, the system has a hard drive/dev/sda, size 64.4GB, and the disk size that is allocated when the virtual system is created. The Linux system automatic disk is divided into three partitions/dev/sda1,/dev/sda2,/dev/sda5.




Insert a U disk, again using the "fdisk-l" command, found that the disk list of a more than a hard disk/dev/sdb, capacity size of 2G, and inserted a U disk capacity of the same size. The system also has a/DEV/SDB1 disk partition. This disk partition is the USB drive you want to mount.



Create a new directory as a U disk hanging contact. For example, to mount a U disk to/MNT/USB, you need to use the following command to create a new/mnt/usb.

       mkdir /mnt/usb

The mount command can then be used to mount the USB drive on the/MNT/USB.

       mount /dev/sdb1 /mnt/usb

Enter the command cd/mnt/usb into the directory/mnt/usb, and then enter the LS command can view the contents of the U disk.

U disk after use, in order to avoid damage to the U disk or lost data, you can use the umount command to unlock u disk, similar to Windows under the pop-up U disk operation.

       umount /mnt/usb


2, the mobile hard disk Mount

The mounting of a removable hard disk is similar to the Mount of a U disk. Moving a hard disk in Linux is also treated as a SCSI device. First switch to root rights user, and then use the Fdisk-l command to view the system hard disk and partition situation. The results are as follows:




After inserting the mobile hard disk, enter the Fdisk-l command again, can see the system more a/DEV/SDB disk, the size is 1 T, at the same time this disk is divided into/dev/sdb1,/dev/sdb2,/DEV/SDB3,/dev/sdb4 a total of 4 partitions. This is exactly the same as the inserted removable drive.




We can think of 4 partitions as 4 U disk. New/mnt/hddisk1,/mnt/hddisk2,/MNT/HDDISK3,/mnt/hddisk4 a total of 4 mount points.

        mkdir /mnt/hddisk1

        mkdir /mnt/hddisk2

        mkdir /mnt/hddisk3

        mkdir /mnt/hddisk4

You can also use simplified commands to do this.

        mkdir   /mnt/hddisk1  /mnt/hddisk2   /mnt/hddisk3   /mnt/hddisk4

Then mount the 4 partitions separately using the Mount command.

        mount  /dev/sdb1   /mnt/hddisk1

        mount  /dev/sdb2   /mnt/hddisk2

        mount  /dev/sdb3   /mnt/hddisk3

        mount  /dev/sdb4   /mnt/hddisk4

After the mount is complete, you can go to/mnt/hddisk1,/mnt/hddisk2,/MNT/HDDISK3,/mnt/hddisk4 to see the contents of the hard disk partitions.

Also, if the hard drive is not used, you need to use the Umount command to solve the hook.


3, CD-ROM Mount

The CD-ROM corresponds to the file/dev/cdrom in the Linux system. Before mounting, first switch to root permission user, and then create mount point/mnt/cdrom.

       su root

       mkdir /mnt/cdrom     

The Mount command is then used to mount the disc.

       mount /dev/cdrom   /mnt/cdrom


After the mount succeeds, the Mount: Block device/dev/sr0 write protection is displayed, and will be mounted as read-only.

Then switch to the/mnt/cdrom directory, through the LS command to view the files in the CD.

Again, you can use the Umount command to unlock the disc after you have finished using it. For this example, you can use the following command:

       umount  /dev/cdrom 或者 umount /mnt/cdrom

Note that the CD-ROM is a read-only file, and if you need to extract the files from the disc, you cannot proceed directly to the mount point directory. You can copy the files from the CD to another directory and then unzip it.


Note :

The recent use of the Ubuntu system in virtual machines, has been able to automatically mount U disk, hard disk and CD. Automatic mount point in the/media directory, you can directly to the storage peripherals in the access and operation of the files. If you insert a storage peripheral, there is no automatic mount, you need to modify the settings in the virtual machine. For example, virtual machine version: VMware Workstation player (12.5.2 build-4638234), Ubuntu system version: Ubuntu 12.04 LTS. As shown in the following illustration, click the virtual machine's "Playe (P)"--"removable device (R)"--"Silicon Motion USB Flash Disk"--"Connect (disconnect from host)" (C). Here the host refers to the computer host, which refers to the Windows host. U disk at the same time only with the host or a virtual machine connection, connection with the virtual machine means to disconnect from the host. If you do not want Ubuntu to mount the storage peripherals automatically, the disconnect settings are similar to the above operation. If you fail to mount the storage peripherals manually on the Ubuntu system, consider whether the system is automatically mounted. If the automatic mount can not also do not need to mount manually, if you must manually mount, you need to first remove the automatic mount, and then reseat the peripherals and then try again.





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.