Linux system partition and mount point (zz)

Source: Internet
Author: User

Finally, I installed a Linux dual-system on XP, and I don't have to play it on a virtual machine anymore. The Ubuntu version is used.

This article introduces basic knowledge about Linux File Systems, mount points, and disk partitions.



This article from the "he strong technical exchange blog" blog, please be sure to keep this source http://newthink.blog.51cto.com/872263/223795

I. LINUX partition information

Although the hard disk partition table can store up to four partitions, it is generally divided into two partitions in actual use. One is the primary partition (primary partion) and the other is the extended partition (extended partition, the primary partition can be used immediately but cannot be partitioned. Extended partitions must be used after being partitioned, that is, they must be partitioned twice. So what will be further divided by the expanded partition? It is a logical partition, and there is no limit on the number of logical partitions. For friends who are used to using DOS or windows, there are several drives in Several partitions, and each partition will get a letter identifier, then you can use this letter to specify the files and directories in the partition. Their file structures are independent and easy to understand.

But is it annoying to get started with Red Hat Linux. For Linux users, no matter how many partitions are allocated to which directory to use, it has only one root directory and an independent and unique file structure. In Red Hat Linux, each partition is used to form a part of the entire file system, because it adopts a processing method called "mount point, its entire file system contains a complete set of files and directories and associates a partition with a directory. In this case, a partition to be loaded will make its storage space available in a directory.

Next, let's take a look at how Red Hat Linux drives are identified. For an IDE hard disk, the drive identifier is "hdx1", where "HD" indicates the type of the device where the partition is located. Here it refers to the IDE hard disk. "X" indicates the disk number (A is the basic disk, B is the basic slave disk, C is the auxiliary master disk, and D is the auxiliary slave disk). "1" indicates the partition, the first four partitions are represented by numbers 1 to 4. They are primary partitions or extended partitions. They are logical partitions starting from 5. For example, hda3 indicates the third primary or extended partition on the first IDE hard disk, and hdb2 indicates the second primary or extended partition on the second IDE hard disk. For a SCSI hard disk, it is identified as "sdx1", and the SCSI hard disk uses "SD" to indicate the type of the device where the partition is located. The other methods are the same as those of the IDE hard disk. We can see from the above that the partitions in Red Hat Linux are different from those in other operating systems. The common partition formats are ext3 and swap. ext3 is used to store system files, swap serves as the swap partition for Red Hat Linux (equivalent to a virtual memory file in Windows ). Now we can know that Red Hat Linux requires at least two dedicated partitions (Linux native (local) and Linux swap (switch )). Red Hat Linux cannot be installed in the DOS/Windows partition. In general, we install one or more hard disk partitions of the "Linux native" type in Red Hat Linux, however, in Red Hat Linux, a "mount point" must be specified for each partition, telling Red Hat Linux which directory should be used at startup. A "Swap" partition is generally defined and does not need to define a load point.

Next we will first have a preliminary understanding of "Linux native" and "Linux swap. * The swap partition is the swap partition for Linux to temporarily store data, which is mainly used to store the data temporarily not used in the primary memory and re-transfer it into the memory as needed, you do not need to specify the "mout point" (loading point) for the partition used as the swap. Since it is used as the swap partition, we should specify the size for it, it must at least be equal to the actual amount of memory on the system. Generally, it is one to two times the size of memory. In addition, you can create and use more than 16 swap partitions.

* Linux native stores system files and generally uses the ext3 partition type. For Red Hat Linux, there is a lot of room for choice, system files can be installed in several zones (the mount point must be described), or in the same partition (the mount point is "/").

Ii. Details about Mount Points (bold is usually used ).Contents
/Root directory to store system commands and user data
/Boot loader static link file to store programs related to Linux Startup/Home user directory, which stores data of common users/Tmp temporary file/Usr is the place where the software is stored in Red Hat Linux. If possible, allocate the maximum space to it./Usr/local self-installed program installed here/Var constantly changing data, some services of the server are placed below./OPT Additional Application Software Package

/Bin basic command execution File
/Dev Device File
/Etc host-specific system configuration
/Lib basic shared library and kernel module
/Media: mount point for mobile media
/Mnt is used to temporarily mount a file system or other hardware devices (such as optical drive and soft drive)
/Proc system information virtual directory (2.4 and 2.6 kernel), which is generated by the system itself in the memory.
/Root Root User directory
/Sbin Basic System Command Execution File
/Sys virtual directory of system information (2.6 kernel)
The/srv system provides service data/usr/x1186 X-Windows Directory, which stores some X-Windows configuration files/usr/include system header files, store some C-Language header files/usr/src Linux kernel source code, the kernel source code installed in Linux is stored in the/usr/bin supplement to the/bin directory/usr/sbin supplement to the/sbin directory/lost + found directory in most in this case, they are all empty. However, if you have a sudden power failure at work or do not shut down properly, When you restart the machine, some files will not be found where they should be stored. For these files, the system places them in this directory, like providing a temporary shelter for homeless people. /Boot: it must always physically contain/etc,/bin,/sbin,/lib, And/dev. Otherwise, you cannot start the system. A typical root partition requires a size of 150-250 MB. /Home: each user places his/her private data under the subdirectory of this directory. The size depends on how many users use the system and what files are stored in their directories. According to the usage, 100 MB space should be prepared for each user, but it should be adjusted as needed. If you plan to save a large number of multimedia files (images, MP3 files, and movies) in the 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 enough. Some applications-including archive handlers, D/DVD preparation tools, and multimedia software-may use/tmp to temporarily Save image files. To use these programs, adjust the size of the/tmp directory accordingly. This is necessary for multi-user systems or network servers. In this way, even if a large number of temporary files are generated during the running of the program, or the user has performed wrong operations on the system, other parts of the file system are still safe. Because this part of the file system is still subject to read/write operations, it usually occurs faster than other parts.

/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 must provide at least 500 mb disk space. The total capacity increases based on the number and type of software packages to be installed. Loose workstation or Server Installation should require 4-6 GB. /Var: all variable data, such as the cache of newsgroup articles, emails, websites, databases, and software package systems, will be put into this directory. The size of this directory depends on your computer's purpose, but for most people, it will be mainly used as a management tool for the software package system. If the server is used, the space should be as large as possible. The actual method and actual size of my server have not been put into use. So the/var directory does not use that much. Generally, the directory for storing web pages on the web is/var/www. The directory for storing mails with Postfix is/var/mail and var/log, which is the system log record partition, /var/spool: stores emails, news, and print queues. /OPT: stores optional installed software. We have introduced several mount points above. Generally, we need at least two partitions (of course only one partition), one swap partition and one "/" partition, however, some common and important mount points are assigned to other partitions, which facilitates management. Generally, one/partition, one/usr partition, one/home partition, and one/var/log partition. Of course, there is no rule. It is determined based on the needs. We can use disk druid, a hard disk management tool provided by Red Hat Linux, to complete partition and mount point settings.

Iii. Some reference partition SolutionsServer partition solution:
Partition size
/1G-2g (minimum 150-250 MB)
/Boot 32 m-100 m (BOOT partition, up to m)
/OPT 100 m-1g (Additional Application)
/Tmp 40 m-1000 m (the maximum value can be set to around 1 GB. If you load an ISO image file, set it to around 4 GB. Generally, this is not necessary)
/Home 2G-10g (about MB for each user. User directory .)
/Usr 3G-10g (space-consuming part. At least MB, usually 4-6 GB for loose servers)
/Usr/local 3G-15g (self-installation program installed here)
/Var & gt; 2g -- the remaining space of the hard disk (at least 300 m-500 m, generally 2-3G. If the server is used, allocate the remaining space to it)
Swap partition 2 GB (memory: 1 GB)

Desktop partitioning Solution
/1g
/Boot 32 m
/OPT 100 m
/Tmp 50 m
/Home 1G-10g
/Usr 3G-6g
/Usr/local 3G-5g
/Var MB or above
Swap partition 2 GB (memory: 1 GB)

The most economical partition solution (not recommended for servers ):
The file directory should be at least the size after installation centos5.2
/150 m-250 m 500 m-2g (378 m)
/Boot 32 m-100 m 64 m (13 m)
/OPT 30 m-100 M 50 m (19 m)
/Tmp 40-100 M 50 m (37 m)
/Home 100 MB-5G 1g (483 m)
/Usr & gt; 500 M 4-6g 2.5g (2.0g)
/Usr/local 500 m 2-5G 2G (1.2G)
/Var 300-500 m 2-3G 500 m (296 m) Swap partition 2G (memory is 1G)
/Var directory. If it is a server, all the space after the other partitions are allocated to/var.
It is divided into the largest partition. HTTP Server Directory/var/WWW, Postfix server/var/mail.
Usually in the/var directory. 4. The following are the partitions and mount points for the 80 GB hard disk as the server: (this example is the virtual 80 GB hard disk in vm6.0, And the partition and mount point settings when Red Hat Linux9.0 is installed)1. Idle 80 gb scsi hard drive. 2. Split the disk into a 1 GB partition. The mount point is :/. 3. Another swap partition is 1-2 times the memory. 4. a m partition. The mount point is/boot. 5. Divide the partition into 1024 m and the mount point is/OPT. 6. a m partition. The mount point is/tmp. 7. A 10 Gb partition with the mount point:/home. 8. A 20 GB partition. The mount point is/usr/local. 9. "Use all available space" is divided into one zone and the mount point is/var. 10. After the partition is complete.

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.