Usage of the mount command in Ubuntu

Source: Internet
Author: User
Mount, that is, mount. If you want your computer to mount Windows partitions by yourself, that is, you can click those Windows drive letters in the file manager, and the system will help you automatically mount the partitions, however, the name after mounting is too long and complicated, and it is not convenient for terminal operations. So manually mount it. For more details about mount mounting, please check it out and directly enter the manmount command on your terminal. The following describes how to mount the mount. There are many Command Options, here are only a few. 1. Check out moun

Mount, that is, mount. If you want your computer to mount Windows partitions by yourself, that is, you can click those Windows drive letters in the file manager, and the system will help you automatically mount the partitions, however, the name after mounting is too long and complicated, and it is not convenient for terminal operations. So manually mount it. For more details about mount mounting, please go and have a look and enter commands directly on your terminal.

Man mount

Okay. Here we will talk about how to mount it. There are many options for the mount command. Here we will only talk about a few.

1. Check the usage of mount.

Mount-a [-t |-O]...: mount all stuff from/etc/fstab
Mount device: mount device at the known place
Mount directory: mount known device here
Mount-t type dev dir: ordinary mount command

Generally, the last option is commonly used. You can omit the-t option, Because Ubuntu will help you determine the filesystem type, that is, the file system type. The windows partition to be mounted, it is generally fat and ntfs.

Let's add several Command Options in the last usage.

-T indicates the file system type of the partition to be mounted (note that it is not a file type). For windows partitions, fat is commonly used (if another system is Windows XP, and you didn't use software such as the partition magician to convert your partition), and ntfs (if you are using Windows 7 ).

Dev is not an option, it is a command parameter, dev is the abbreviation of device, here write the hardware you want to mount, how to express the http://www.linuxidc.com, please see later.

Dir is the mount point. Write where you want to mount the hardware.

2. Of course we need to know our hardware. Here we only talk about hard disks, and other hardware can also be mounted. You can use the fdisk command to view the disk status, or to be precise, you can view the partition status. Note: This Command requires the root permission.

Sudo fdisk-l

You should see information like me

Disk/dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders, total 156301488 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: 0x624aa2e0

Device Boot Start End Blocks Id System
/Dev/sda1 16128 24595514 12289693 + 7 HPFS/NTFS/exFAT
/Dev/sda2 24595515 147797999 61601242 + f W95 Ext 'd (LBA)
/Dev/sda5 24595578 83891429 29647926 7 HPFS/NTFS/exFAT
/Dev/sda6 83892224 87812020 1959898 + 82 Linux swap/Solaris
/Dev/sda7 87799808 147818584 30009388 + 83 Linux

Here, sdax (x represents the number of partitions) is my SCSI hard disk. If your hard disk is an IDE interface, it should be hdx (here x is also a number ). Linux and Windows are different. He uses sd to represent the SCSI hard disk, hd to represent the IDE hard disk, and a, B, c, and d to represent the first hard disk, number indicates the Partition Number on the hard disk. Note that the number of logical partitions starts from 5, and 1 to 4 is left to the primary partition. That is to say, Linux requires that each hard disk has a maximum of four primary partitions, in Windows, there is only one primary partition (in fact, it is the disk where the system is located, usually a C disk ).

3. After checking the partition information, we can mount the partition as needed. For example, if you want to mount sda1, it corresponds to the primary partition in Windows, that is, drive C. I should use this command.

Sudo mkdir/mnt/driver_c # create a/driver_c mount point in the/mnt directory

Sudo mount/dev/sda1/mnt/driver_c

Okay. In this way, the drive C under Windows is mounted to the/mnt/driver_c directory. Of course, you can mount the partition to any directory, this is just a habit of mounting this/mnt directory.

For another example, I want to mount the D Drive in Windows to/mnt/driver_d. As mentioned above, in Windows, only the drive C contains partitions, and the others are logical partitions. Here, disk D is the second logical partition, which should be sda5. Therefore, use the following command to mount the D disk.

Sudo mkdir/mnt/driver_cd # create a/driver_d mount point in the/mnt directory

Sudo mount/dev/sda5/mnt/driver_d

4. Of course, when you are not allowed to access those partitions, unmount them at last to avoid Operation errors. The command for uninstalling is very simple. umount dev, simply add the device to be uninstalled after umount. For example, I Want To unmount the C disk we just mounted. I should enter this command

Sudo umont/dev/sda1

If you want to detach the D disk we just mounted, use this command.

Sudo umount/dev/sda5

Okay: I have finished talking about the usage of mount. My skills are limited. If any error occurs, please kindly advise.

Related Article

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.