Latest CentOS Server partitioning Solution

Source: Internet
Author: User
Tags centos server ide hard drive

Latest CentOS Server partitioning Solution

My server is 500 GB. The most important thing is that the/var partition must be large (whether it is a postfix email or a lamp web Server ).
Preferably GB or above. The specific/boot only needs MB.
The following is my Partition Scheme:
Hard Disk 500 GB

Server 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 about 1 GB. If you load an ISO image file, set it to 4 GB.
, Usually not so much)
/Home 2G-10G (about MB for each user. User directory .)
/Usr 3G-10G (space-consuming part. At least MB, usually loose servers
To 4-6 GB)
/Usr/local 3G-15G (self-installation program installed here)
/Var> 2G-the remaining space of the hard disk (minimum 300 M-500 M, generally 2-3G, if the server is used, leave the remaining space
)

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
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> 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)
/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.

Appendix: Debian official installation guide.

Contents
Bin basic command execution File
Static link file of boot loader
Dev Device File
Specific system configurations of the etc host
Home user directory
Lib basic shared library and kernel module
The mount point of the media used to move the media.
Mnt is used to temporarily mount a File System
Virtual directory of proc system information (2.4 and 2.6 kernels)
Root User directory
Sbin Basic System Command Execution File
Virtual directory of sys system information (2.6 kernel)
Tmp temporary file
Usr second-level directory
Changing var data
Data provided by the srv System for service
Opt-added Application Software Package
The root partition/must always physically contain/etc,/bin,/sbin,/lib, And/dev. Otherwise, the system cannot be started. Typical
The size of the root partition is 150-250 MB.
/Usr: contains all user programs (/usr/bin), library files (/usr/lib), documents (/usr/share/doc), and so on. This is a file
The most space-consuming part of the system. You must provide at least 500 MB disk space. The total capacity is based on the number of packages you want to install
And type growth. 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
This directory. The size of this directory depends on the purpose of your computer, but for most people, it will be mainly used for the management of the software package system
Management tools. If you want to perform a full installation at a time, including all the programs provided by Debian, 2 or 3 GB under/var
. If you want to install one by one (that is, install the service programs and tools, then the text processing tool, and then
Is X ,...), You can prepare 300-500 MB. If the hard disk space is very tight and you are not prepared to upgrade the system of the master version, you can
Prepare 30 or 40 MB for it.
/Tmp: the temporary data created by the program is mostly stored in this directory. Usually 40-100 MB should be enough. Some applications-including
File handler, CD/DVD preparation tool, and multimedia software-/tmp may be used to temporarily Save the image file. If you want to use this
And adjust the size of the/tmp directory accordingly.
/Home: each user places his/her private data under the subdirectory of this directory. The size depends on how many users will use the system,
And what files are stored in their directories. According to the planned purpose, 100 MB space should be prepared for each user. However
Adjust as needed. If you plan to save a large number of multimedia files (images, MP3 files, and movies) in the home directory
.
The actual method and actual size of my server have not been put into use yet. So the/var directory does not use that much.
The directory where the WEB page is stored is/var/www.
The directory for storing postfix mails is/var/mail.
# Df-TH
File System Type capacity available in use % mount point
/Dev/hdb2 ext3 11G 315 M 9.4G 4%/
/Dev/hdb10 ext3 10G 157 M 9.3G 2%/opt
/Dev/hdb9 ext3 11G 158 M 9.5G 2%/home
/Dev/hdb8 ext3 11G 158 M 9.5G 2%/tmp
/Dev/hdb7 ext3 11G 2.5G 7.3G 26%/usr
/Dev/hdb6 ext3 16G 3.2G 12G 22%/usr/local
/Dev/hdb5 ext3 417G 340 M 395G 1%/var
/Dev/hdb1 ext2 104 M 7.3 M 91 M 8%/boot
Tmpfs 1.1G 0 1.1G 0%/dev/shm

So the actual method is better than the method I mentioned above!



Linux partition details

What are hard disk partitions and what are used for partitioning?
Partition is the "section" of the hard disk ". Windows partitions have their own drive letters (C:, D:, and so on), which look like an independent hard disk.

The simplest case is to use the entire hard disk as a unique partition. This is basically the case if you have purchased a machine with window pre-installed.

If you want to install more operating systems on your machine, more partitions are required. You cannot install linux in this separate partition. If you want to install Windows ME and Windows at the same time, you need two partitions. The reason is that the unused operating system uses different file systems in principle. If several operating systems support the same file system, they are usually installed in different disk partitions to avoid having the same system directory under a partition.

In Linux, there are different situations where there are more partitions, for example, the root partition "/" and the swap partition "swap ".

Note: When installing Linux, you should not consider how much space is available in windows partition, because Linux cannot be used in windows partition. Create a new partition outside Windows partition.
Partition type
There are three hard disk partitions: Primary partition, extended partition, and logical partition.

A hard disk can have up to four primary partitions. You can create another extended partition to replace one of the four primary partitions. Then, you can create more logical partitions under the extended partition.

Extended partitions are only the "containers" of logical partitions ". In fact, only primary and logical partitions are used for data storage.
Tip: the built-in partition program fdisk in Windows 9x/ME can only define one primary partition. That is to say, in Windows 9x/ME, you can only define up to one primary partition, one extended partition, and more logical partitions under the extended partition. If you want to use more primary partitions, you must partition them in Linux.
Partitioning and formatting
Each operating system has its own FDISK in Windows9x/M, which is used to change the hard disk partition. It has a very convenient graphic interface tool in Windows NT/2000/XP, the location is slightly different in different Windows versions (for example, control panel, management tools, computer management, and disk management in 2000 ). In Linux, FDISK can be used for partitioning, or a graphic interface program with the same functions.

Each primary partition and logical partition are stored with additional information that identifies the file system. The operating system (Windows or Linux, etc.) can easily identify and confirm which partition should be used through this information. Unrecognized operating system partitions are ignored.

Of course, no file system can be generated by partitioning. After partitioning, the disk space on the hard disk is reserved and cannot be used directly. After that, the partition must be formatted. In Windows, you can use the File menu or FOMATE program in the resource manager. in Linux, mke2fs is used in most cases.

Tip: Linux supports different file systems. Ext2 is the most widely used one. Ext2 is built with the mke2fs program we mentioned above. Linux also supports the reiserfs file system.

Note: any changes to the disk partition or size will result in loss of previous data. Data must be backed up before partitioning.
Partition name in Dos/Windows
In Windows, the partitions used by the operating system are represented by the drive letter. A: And B: reserved for the soft drive. The primary and logical partitions on other disks are arranged in sequence from C. (The extended partition does not have any drive letters and cannot be seen. I cannot see Linux partitions in indowsx)

If a machine has many hard disks, optical drives, and hard drives, the naming of disk partitions will be messy. In this case, the primary and logical partitions on the first hard disk will first get the name drive letter, then the second and third disks. For example, if you have three hard disks, each of which has a primary partition and two logical partitions, the first disk is named C:, F :, g:, the second is D:, H:, I:, and the third is E:, J:, K :.

In WindowsNT/2000/XP, you can change the names automatically named by these systems. For example, you can name an optical drive X, so that the name of the new partition will not change.

Partitions In unfamiliar file systems will not be named, and cannot be seen in most programs (such as resource manager. , These partitions can only be displayed under the disk partition tool (FDISK Under Windows9x/ME, Computer Management under Win2000-command interpreter.
Partition name in Linux
The partition name in Linux is clearer and more detailed than that in Windows, but the resulting name is not easy to remember. Unlike drive letters in Windows, Linux usually uses device-name ). General hard disks (such as IDE hard disks) are named by/dev/hdxy. X indicates the hard disk (a is the first hard disk, B is the second hard disk, and so on), and y is the Partition Number (starting from 0, 1, 2, 3, and so on ). The SCSI hard disk is named by/dev/sdxy. The optical drive (IDE or SCSI) will be named like the hard disk.

Tip: IDE (Integrated Circuit device) and SCSI (Small Computer System Interface) are currently two of the most popular computer hard drives, optical drives or soft drives. SCSI is faster than IDE, but it is more expensive. SCSI can be used on file servers and database servers. Linux supports these two systems (of course, you can have both IDE and SCSI devices on one machine)

The internal connection between the IDE hard drive and the optical drive device will be used to differentiate the device. /Dev/hda indicates the first device (master) of the First IDE channel, And/dev/hdb indicates the second device (slave) of the First IDE channel ). According to this principle,/dev/hdc and/dev/hdd are the master and slave devices of the second IDE channel. The two devices named "/dev/had" and "/dev/hdc" are theoretically the same. In this case, "/dev/hdb" is not used. (In this case, the device is connected to the first and second IDE channels as the master)

The SCSI hard drive or optical drive device depends on the device ID. The missing ID number is not considered. For example, the IDs of the three SCSI devices are 0, 2, 5, and the device names are/dev/sda,/dev/sdb, And/dev/sdc. If you add another device with ID 3, the device will be named "/dev/sdc". The device with ID 5 will be called "/dev/sdd.

The partition number does not depend on the name of the IDE or SCSI device. Numbers 1 to 4 are reserved for the primary partition or extended partition. It is used to name the logical partition from 5. For this reason, there are often number vulnerabilities. (For example, 1, 2, 5, 6, where 3 and 4 are number vulnerabilities.) For example, the primary partition of the first hard disk is hda1, and the extended partition is hda2, A logical partition under the extended partition is hda5.

Here are some examples to help you understand

/Dev/hda indicates the entire IDE Hard Disk
/Dev/hda1 indicates the first primary partition of the first IDE hard disk.
/Dev/hda2 indicates the extended partition of the first IDE hard disk.
/Dev/hda5 indicates the first logical partition of the first IDE hard disk.
/Dev/hda8 indicates the fourth logical partition of the first IDE hard disk.
/Dev/hdb indicates the second IDE Hard Disk
/Dev/hdb1 indicates the first primary partition of the second IDE hard disk.
/Dev/sda indicates the first SCSI hard disk
/Dev/sda1 indicates the first primary partition of the first SCSI hard disk.
/Dev/sdd3 indicates the third primary partition of the fourth SCSI hard disk.

Linux web Server partitioning Solution

We can see that everyone is very concerned about the partitioning scheme of WEB servers in LINUX. I haven't written any original articles for a long time, and I am working overtime today. below is the text: the biggest application field of Linux servers is WEB servers, many friends first think about how to partition the LINUX Server when installing the LINUX server for the first time. A proper partition can save you a lot of trouble, especially when hardware is rarely added to a personal server, whether the original partitioning scheme is reasonable directly determines whether you can maintain your server with peace of mind in the future. Because your hardware configuration is different, the specific partitioning scheme is also different, the following example is for reference only. Different hardware configurations are divided into partitions based on the description, there are also some articles for adding new partitions or adding new hard disks for LINUX servers. Please go to the Linux Alliance website to query these articles.

There are still many factors to consider for partitioning. For example, if your server has several hard disks and you need to install software, we mainly talk about WEB servers and SWAP partitions, it is recommended that I use two times of memory as a swap partition, but because the current memory capacity is obviously large, it is unnecessary to divide too much separately. For example, if my memory is 2 GB, it is enough to plan 2 gb swap partitions. Of course, I also like to use 1 GB of SWAP memory. In addition, there are several directories on the WEB server that need to be separately partitioned: /var/tmp/usr/home, where/var and/temb partitions frequently change data. The former has many system logs, note that some versions of LINUX put WEB directories here. The latter has a large number of temporary files and fragments for some large websites, some large sites and multi-disk servers can also be configured with separate hard disks. the/home directory does not need to be mentioned. Most Release versions require that the directory be as big as possible. Others prefer to partition/boot separately and install most of the software in the/usr directory, therefore, consider the size of Software Installation for partitioning. the following is my single hard disk partitioning solution for your reference only:

/(128 MB)
/Boot (100 MB)
Swap 2G (2g ram)
/Tmp (2G)
/Var (2G)
/Usr (10G)
/Home (all remaining space)

The above average solution is basically able to meet the needs of my site, according to your actual configuration pay attention to the above Several partitions for reasonable adjustment, you are welcome to leave a message about your server partition solution.


Linux partition solution:

Create three partitions 1./boot partitions to store the kernel and boot program space allocation: 100 M type: ext32,/swap partition virtual memory space allocation: 2 times the physical memory 3./The root partition stores all the file space: at least 3G types: ext3 (/equivalent to c: \> in Windows)

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.