Linux system partitions and mount points

Source: Internet
Author: User
Tags web hosting

First, about the Linux partition situation

Although the hard disk partition table can store up to four partitions, but we actually use only two partitions, one is the primary partition (Primary partion) is an extended partition (extended partition) Two, the primary partition can be used immediately, but no longer partition, The extended partition must be partitioned before it can be used, meaning it must also be partitioned two times. So what is the partition going to be divided into? It is a logical partition (Logical partion), and there is no limit to the number of logical partitions. For a friend who is accustomed to using DOS or Windows, there are several partitions that have several drives, and each partition obtains a letter identifier, which can then be used to specify the files and directories on this partition, and their file structures are independent and very well understood.

But getting started with Red Hat Linux is a bit annoying. Because for Linux users, regardless of a few partitions, to which directory to use, it boils down to only one root directory, a separate and unique file structure. Each partition in Red Hat Linux is part of the entire file system because it uses a processing method called "mount point", which contains a full set of files and directories in the entire file system, and links a partition to a directory. At this point a partition to be loaded will make its storage space available in one directory.


Let's start by looking at how Red Hat Linux drives are identified. For IDE hard drives, the drive identifier is "hdx1", where "HD" indicates the type of device on which the partition is located, which refers to the IDE hard disk. The "X" is the disk number (A is the base disk, B is the base slave, C is the secondary primary, D is the secondary slave), "1" represents the partition, the first four partitions are represented by the numbers 1 to 4, they are the primary or extended partition, and the logical partition starts from 5. Example, Hda3 is represented as the third primary or extended partition on the first IDE hard disk, and HDB2 is represented as the second primary or extended partition on the second IDE hard disk. The SCSI hard disk is identified as "sdx1", the SCSI hard disk is "SD" to indicate the type of device the partition is located, and the rest is the same as the representation of the IDE hard disk, no longer say more. We can see from the above that the Red hat Linux partition is different from other operating system partitions, its partition format is commonly used in EXT3 and swap two kinds, EXT3 for storing system files, swap as Red hat The Swap partition for Linux (equivalent to a virtual memory file in Windows). So now we can see that red Hat Linux requires at least two dedicated partitions (Linux Native (local) and Linux Swap (swap)). Because Red Hat Linux cannot be installed on the dos/windows partition. In general, we will install Red Hat Linux with one or more hard disk partitions of type "Linux Native", but each partition in Red Hat Linux must specify a mount point, which tells Red Hat Linux to start , which directory to use for this directory. For a "Swap" partition, it is generally defined one and it does not necessarily define the load point.


Let's start with a preliminary understanding of "Linux Native" and "Linux Swap". *swap partition is linux temporarily stored data exchange partition, it is mainly to save the main memory temporarily unused data, when needed to redeployment in memory, and the partition used as swap does not specify "Mout point" (load points), since it as a swap partition, We should certainly give it a size that is at least equal to the amount of actual memory on the system, which in general is one to twice times the size of memory. Alternatively you can create and use more than one swap partition, up to 16.

*linux native is a place to store system files, generally with the EXT3 partition type, for red Hat Linux, there is a large choice, you can put the system files in several areas to install (must specify the mount point), can also be installed in the same partition (mount point is "/").


second, about the mount point situation (bold for several commonly used). Catalog Content
/root directory, storing system commands and user data, etc.
/boot boot loader static link file for Linux boot-related programs /home User directory, storing data for ordinary users / tmp temp file / usr is where the Red Hat Linux system holds the software and, if possible, the maximum space should be allocated to it /usr/local the self-installed program is installed here / var constantly changing data, some server services are placed below. /opt Additional application packages

/bin Basic Command Execution file
/dev Device files
/etc host-specific system configuration
/lib Basic shared libraries and kernel modules
/media mount point for moving media
/MNT for temporary mounting of file systems or other hardware devices (such as optical drives, floppy drives)
A virtual directory of/proc System Information (2.4 and 2.6 cores), which is generated in memory by the system itself.
/root Root User's Directory
/sbin Basic System Command execution file
/sys virtual directory for System Information (2.6 cores)
The/srv    system provides a data/usr/x1186         X-windows directory for the service, Store some x-windows configuration files/usr/include      system header files, storing some C-language header files/usr/src            Linux kernel source code, Linux system installed kernel source code are saved in this/usr/bin           some additions to the/bin directory/usr/sbin        some additions to the/sbin directory/lost+ Found this directory is empty in most cases. But if you are working suddenly with a power outage, or you are not shutting down normally, some files will not be available when you restart the machine, and for these files, the system places them in this directory, as if providing a temporary shelter for homeless people. /boot: You must always physically include/etc,/bin,/sbin,/lib, and/dev, or you will not be able to start the system. A typical root partition requires 150–250MB size space. /home: Each user will place his private data in a subdirectory of this directory. The size depends on how many users will use the system, and what files are placed in their directory. Depending on the purpose of the plan, 100MB space should be prepared for each user, but should be adjusted to your needs. If you plan to save a lot of multimedia files (Pictures, MP3, movies) in your home directory, you should prepare more space.

/tmp: The temporary data created by the program is mostly stored in this directory. Usually 40–100 MB should be sufficient. Some applications-including archive handlers, D/dvd authoring tools, and multimedia software-may temporarily save image files using/tmp. If you want to use these programs, you should adjust the size of the/tmp directory accordingly. This is necessary for multi-user systems or Web servers. This allows the other parts of the file system to be secure even if the program is running with a large number of temporary files, or if the user is doing something wrong with the system. Because this part of the filesystem still has read and write operations, it usually has problems faster than the rest of the system.

/usr: contains all user programs (/usr/bin), library files (/usr/lib), Documents (/usr/share/doc), and so on. This is the most space-consuming part of the file system. You need to provide at least 500MB of disk space. The total capacity will grow depending on the number and type of packages you want to install. A loose workstation or server installation should require 4–6GB. /var: all mutable data, such as newsgroup articles, e-mails, websites, databases, cache of package systems, etc., will be put into this directory. The size of this directory depends on the purpose of your computer, but for most people, it will be used primarily as a management tool for package systems. If you make a server, space should be as large as possible. My server's actual division and actual use of the size, has not actually put into use. So the/var directory doesn't use that much. The general Web hosting Web page directory is/var/www,postfix mail storage directory is:/var/mail,var/log, is the system logging partition,/var/spool: Store some mail, news, print queue and so on. /OPT: Storage of optional installed software. There are several mount points described above, in general we need at least two partitions (of course, as long as a partition can), need a swap partition, and a "/" partition, but some of the common, important mount points to other partitions, so easy to manage. General one/partition, one/usr partition, one/home partition, one/var/log partition. Of course, there are no rules, it is entirely in accordance with the needs of the set. We can use Disk Druid, which is provided by Red Hat Linux, to complete the partitioning and mount point settings.


Iii. Some reference zoning schemesScenarios for server partitioning:
Actual size of partition type partition
/1g-2g (Minimum 150–250MB)
/boot 32m-100m (boot partition up to 100M or so)
/OPT 100m-1g (Additional application)
/tmp 40m-1000m (maximum can be set to about 1G, if the load ISO image file is set to about 4G, generally not so much)
/Home 2g-10g (about 100M per user, specific custom. User directory. )
/usr 3g-10g (the most space-consuming part.) At least about 500M, generally loose server to be divided into 4-6g)
/usr/local 3g-15g (self-installed program installed here)
/var >2g--hard disk remaining space (minimum 300m-500m, General 2-3g, server, the rest of the space is divided into it)
Swap partition 2G (memory is 1G)

Desktop partitioning scheme
/1G
/boot 32M
/opt 100M
/tmp 50M
/Home 1g-10g
/usr 3g-6g
/usr/local 3g-5g
/var 500M or more
Swap partition 2G (memory is 1G)

The most economical partitioning scheme (server not recommended):
File directory min. General post-Installation size CentOS5.2
/150m-250m 500m-2g (378M)
/boot 32m-100m 64M (13M)
/opt 30m-100m 50M (19M)
/tmp 40-100m 50M (37M)
/home 100m-5g 1G (483M)
/usr >500m 4-6g 2.5G (2.0G)
/usr/local 500M 2-5g 2G (1.2G)
/var 300-500m 2-3G 500M (296M) Swap partition 2G (memory is 1G)
/var directory, if it is a server, you will have to divide the rest of the space after the other partition to/var
is divided into the largest partition. HTTP Server directory/var/www,postfix server/var/mail.
It is usually in the/var directory.

Linux system partitions and mount points

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.