What is the relationship between mount points and partitions under Linux?

Source: Internet
Author: User

Linux uses a combination of letters and numbers to refer to a disk partition. This may be confusing, especially if you previously used the "C drive" method to refer to hard disks and their partitions. In the Dos/windows world, partitions are named in the following ways:
Each partition is checked to determine if it can be read by dos/windows.
If the partition type is compatible, it is assigned to a "drive letter". The drive letter starts with "C" and then goes alphabetically based on the number of partitions to label.
The drive letter can be used to refer to that partition, or it can be used to refer to the file system included with the partition.
Red Hat Linux uses a more flexible naming scheme. It conveys more information than the naming scheme used by other operating systems. The naming scheme is file-based and the file name is in the following format:
/dev/xxyn
Here's how to parse a partition naming scheme:
/dev/
This string is the directory name where all the device files reside. Because the partitions are on the hard disk, and the hard disk is the device, these files represent all the possible partitions on the/dev/.
Xx
The first two letters of the partition name indicate the type of device on which the partition resides. This is typically an HD (IDE disk) or SD (SCSI disk).
Y
This letter indicates the device where the partition resides. For example,/dev/hda (the first IDE disk) or/dev/sdb (a second SCSI disk)
N
The last number represents the partition. The first four partitions (primary or extended) are arranged in numbers from 1 to 4. The logical partition starts at 5. For example,/dev/hda3 is the third primary partition or extended partition on the first IDE hard disk, and/DEV/SDB6 is the second logical partition on the second SCSI hard disk.
There is no place in the naming scheme that indicates the type of partition; Unlike dos/windows, all partitions can be identified under Red Hat Linux. Of course, this is not to say that Red Hat Linux has access to data on each type of partition, but in many cases it is possible to access data on partitions that are dedicated to another operating system.
Keep in mind the above information; it will help you to understand many steps more easily when setting up the partitions required for Red Hat Linux.
Linux disk partitions and other OS
If Red Hat Linux will coexist with OS/2 on your machine, you must use the OS/2 partition software to create your partition-otherwise, the OS/2 may not recognize the disk partition. In the installation, do not create any new partitions, but use Linux parted to set the correct partition type for your Linux partition.
If you want to be able to read and write Windows NT, 2000, or XP partitions from Red Hat Linux, do not set the file system type of the Windows partition to NTFS. If the type of Windows partition is NTFS, it cannot be read in Red Hat Linux, and if the type of Windows partition is VFAT, it can be read in Red Hat Linux.
If you have multiple Windows partitions, they do not have to use the same file system type. If you have more than one partition in Windows, you can set one of them to VFAT and store the files you want to share between windows and Red Hat Linux.
At this point in the red Hat Linux installation Preparation, you should start thinking about the number and size of partitions that your new operating system will use. "How many partitions" has always been a controversial issue in the Linux community, and it can be said that the available partitioning layout is as much as the number of people arguing about the problem before it is finalized.
In view of the above, you should create at least the following partitions: Swap,/boot, and/(root) partitions, unless there is another reason.
Linux partitions and mount points
One area of confusion for many new users of Linux is how partitions are used and accessed by the Linux operating system. It is relatively simple in dos/windows. Each partition has a "drive letter" and you use the appropriate drive letter to refer to the files and directories on the corresponding partition.
This is different from how Linux handles partitioning and disk storage problems. The main difference is that each partition in Linux is part of the storage area necessary to support a set of files and directories. It is implemented by mounting (mounting), which is the process of associating a partition to a directory. The mount partition enables the storage area starting at this specified directory (known as mount point) to be used.
For example, if the partition/dev/hda5 is mounted on/usr, this means that all files and directories under/usr are physically located on/dev/hda5. So the file/usr/share/doc/faq/txt/linux-faq is stored on the/DEV/HDA5, and the file/etc/x11/gdm/sessions/gnome is not.
Continuing with the above example, one or more directories below/usr may also be the mount points of other partitions. For example, a partition (suppose,/DEV/HDA7) can be mounted under/usr/local, which means that/usr/local/man/whatis will be on/DEV/HDA7 instead of/DEV/HDA5.
Perhaps you notice that in Windows, the drive letter is used both to represent the hardware (the partition on the hard disk) and to represent the path in the system. In Linux, hardware is the hardware, path is the path, will not be confused together, simple and direct!
In Linux, partitions are represented in this way
/dev/hda
/dev/hda1
/dev/hda2
/dev/hda5
/dev/sdb1
Take/dev/hda5 as an example:
Because in Linux, each device is represented by a file under the/dev/folder, so/dev/hda5,/dev/represents the Dev directory under the root directory, we look at the remainder of the HDA5.
The first two-bit letters HD indicates that this is an IDE hard disk, and if it is SD, it represents a SATA hard drive, or peripherals such as flash memory.
The third-digit letter A indicates that this is the first device on the type interface. Similarly, B, C, D ... Represents the No. 234 on the type of interface respectively ... A device. For example, HDC represents the primary hard disk on the second IDE interface (one master device and one slave device per IDE interface).
The number 5 in the fourth digit does not mean that this is the 5th partition in the hard disk, but the first logical partition. Because in Linux, in order to avoid unnecessary confusion, the order of partitions cannot be changed, and the partition identity is determined by their location on the hard disk. The system also reserves the identity for all possible primary partitions, so 1-4 must not be a logical partition, 5 is the first logical partition, and so on.
Software
There is no concept of a registry in Linux. To install the software, in theory, just copy all the relevant files and run the main program on it.
Traditionally, a software is usually copied to a folder such as Bin, etc, Lib, share, etc. in the same directory.
Bin
Executable file, the executable file of the program is usually in this directory. By setting the search path in the environment variable, you can execute it directly without locating its path.
etc
Configuration files, most of the system program configuration files are saved in/etc directory, easy to centrally modify.
Lib
library files, which are centralized for easy sharing with different programs. Save some disk space by saving the library files separately compared to different software.
Share
Other resources, examples, and text required to run the program. This part of the file is proprietary, does not need to be shared, and the directory structure is relatively complex, mixed together in a chaotic, so separate storage.
There are also software that takes up a separate directory and all of the resources are in this directory. Similar to the green software under Windows, this is not recommended for Linux systems.
When executed, the system cannot find the executable file (search all paths, the resource overhead is too large, is unrealistic), need to locate its location, like this/home/user/bin/executable file, not convenient.
Many system software needs to be run cooperatively, the configuration files are saved separately, it is very troublesome to locate them.
If the library files that the program uses, like the graphics library files, are stored separately, the wasted disk space can be very serious.
There are some large-scale software, or important applications that you can install in a single folder.

What is the relationship between mount points and partitions under Linux?

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.