Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Method of Linux Partition

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Today, the editor will share with you the relevant knowledge about the method of Linux partition. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

1 is divided into two districts

In fact, most of the time we only need to divide into two zones: / and swap partitions, daily use will not have any impact, and even swapping partitions is not necessary for today's computers, we can only assign one root partition. Linux only needs one / root partition to function properly.

(2) Partition is commonly used. Take installing linux with 100G space as an example. For the meaning of each directory, please refer to the appendix at the end of the article.

Boot partition mount point / boot partition format within ext4 2G

Swap partition non-mount point partition format swap partition (swap) the maximum size of swap partition (swap partition) is not recommended to exceed the real memory size, unless the memory is less than 2G and your memory is greater than 4G, it is recommended that 2G is recommended. It is not necessary for some people to recommend that it is equivalent to memory.

Home directory mount point / partition format ext4 size is about 20-40G

Home directory mount point / home partition format ext4 all remaining space

3 DIY

For more advanced partitions, we need to understand the use of our own computers.

The overall directory of linux is a tree structure. According to Appendix 1 at the end of the article, we will know that the contents of each directory under / partition are different, so their content will change at different rates.

With this in mind, imagine a scenario where if we allocate only one / partition and the content increases rapidly, such as the / home directory of the personal desktop system, the / var directory of the server may quickly occupy most of the storage capacity, so that the computer will not boot when the storage capacity is exhausted.

In order to avoid such a situation, we can partition the computer, and then 'mount' the partition to the specified directory in the root partition, limit the size of the directory, and protect some important directories, such as / boot, so that even if a directory expands quickly, it will only occupy our assigned size and will not affect the normal operation of the computer. So in the second method, we separate / boot and / home separately to avoid / partition content expansion affecting system startup, at the same time, assign / home partition can crash in the computer system, reinstall the system to avoid the loss of personal files, directly mount the partition, personal data will not be lost.

But sometimes, when we want to install linux for the server, / home should not allocate so much space, because for PC desktop systems, we may need to install a lot of software, files, videos, music, etc., which will cause the / home directory to become very bloated, while other directories are relatively small. However, for the server, the more storage space may be concentrated in the / var directory, such as log files, such as the root directory of the web server, generally in the / var directory. At this time, we should allocate more space to the / var directory to ensure the normal operation of the server. Of course, if your server directory structure is self-organized, you should analyze how your computer should choose partitions according to the situation of your own computer.

Appendix I. the function of various catalogs under linux

[cc]-swap virtual memory file similar to windows

-/ root directory, it is best to have only the directory under the root directory. Put the files in the directory, not in the root directory.

+-/ boot includes the kernel of the operating system and the files needed for the startup process

+-/ root Super Admin's home directory

+-/ home home directory, used to store user files

+-/ etc most of the configuration files are placed here by default

In the +-/ dev linux system, all hardware is placed in this directory in the form of files

+-/ lost+found sudden power outage or abnormal shutdown to store temporary files

Some programs that can only be run by +-/ sbin administrators

+-/ opt stores the directory of third-party software

+-/ proc stores process-related information for easy access to process information, pseudo file system, and all contents are stored in memory

+-/ mnt usually we put the manually mounted partition here (for example, add a new hard disk, which can be mounted here)

The partition automatically mounted by the +-/ media system is put here.

+-/ lib is used to store library files

+-/ usr

+-/ usr/lib with / lib

+-/ usr/sbin with / sbin

+-- / usr/local/bin system Utility

+-/ usr/local/sbin with / sbin

+-/ usr/local/lib is the same as / lib [/ cc]

These are all the contents of this article entitled "the method of Linux Partition". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report