Detailed explanation of the most reasonable way to partition the hard disk when installing Ubuntu Linux system

Detailed explanation of the most reasonable way to partition the hard disk when installing Ubuntu Linux system

No matter you are installing Windows or Linux operating system, hard disk partitioning is the most difficult part of the whole system installation process. Some Ubuntu Linux installation tutorials on the Internet usually partition automatically, which brings great inconvenience to beginners. Here I will talk about the most reasonable method of hard disk partitioning when installing Ubuntu Linux system based on my years of experience in installing systems.

Before talking about hard disk partitioning, let me first popularize the relevant classification of hard disks. Hard disks are generally divided into three types: IDE hard disks, SCSI hard disks and SATA hard disks. In the Linux system, the hard disk with IDE interface is called hd, and the hard disks with SCSI and SATA interfaces are called sd. Among them, IDE hard disks have been basically eliminated. The most common hard disk on the market now is the hard disk with SATA interface. The first hard disk is called sda, the second hard disk is called sdb..., and so on.

A hard disk can have up to 4 primary partitions. Partitions other than the primary partitions are called extended partitions. A hard disk may not have extended partitions, but it must have primary partitions. There must be an active partition in the primary partition to start the Windows system. Several logical partitions can be created in the extended partition. Therefore, the most reasonable partitioning method should be to divide it into a maximum of three primary partitions and one extended partition. This way, limited primary partitions can be effectively utilized, and then logical partitions can be created in the extended partition.

In the Linux system, each hard disk has a total of up to 16 partitions. The four primary partitions on the hard disk are marked as sda1, sda2, sda3 and sda4, and the logical partitions are marked from sda5 to sda16.

Ubuntu Linux can use partitions as mount points and load directories. The most commonly used hard disk sizes (500G-1000G) are recommended for allocating directories as shown in the following table:

Table of contents Recommended size Format describe
/ 150G-200G ext4 Root Directory
swap Twice the physical memory swap Swap space: Swap partition is equivalent to "virtual memory" in Windows. If the memory is low (1-4G), it is twice the physical memory. If it is high (8-16G), it is either equal to the physical memory, or the physical memory + 2G.
/boot About 1G ext4 The partition format of the starting position of the space is ext4 /boot
Recommendation: should be larger than 400MB or 1GB. The Linux kernel and files required to boot the system program, such as the vmlinuz initrd.img file, are located in this directory. In general, the GRUB or LILO system boot manager is also located in this directory; the boot manager is located in the file storage location, such as kernels, initrd, and grub.
/tmp Around 5G ext4 Temporary system files, generally not saved when the system is restarted. (Needed to build a server?)
/home As big as possible ext4 User working directory; personal configuration files, such as personal environment variables, etc.; all accounts are assigned a working directory.

Another situation is that there is no separate machine configuration, and you can only install a virtual machine on your own computer. In this case, the allocated hard disk generally does not exceed 100G and the memory is only about 2-4G. You can refer to this configuration method:

Table of contents Recommended size Format describe
/ 10G-20G ext4 Root Directory
swap <2048M swap Swap Space
/boot About 200M ext4 The Linux kernel and files needed to boot the system program, such as the vmlinuz initrd.img file, are all located in this directory. In general, the GRUB or LILO system boot manager is also located in this directory; the boot manager is located in the file storage location, such as kernels, initrd, and grub.
/tmp Around 5G ext4 Temporary system files, generally not saved when the system is restarted. (Needed to build a server?)
/home As big as possible ext4 User working directory; personal configuration files, such as personal environment variables, etc.; all accounts are assigned a working directory.

Next, I will use Ubuntu Linux 12.04.3 as an example to explain to you how to manually partition the hard disk.

There are two options to choose from in the partition interface shown in Figure 1. The simplest option is to "erase the entire hard disk and install Ubuntu". Click the "Continue" button and the installation wizard will automatically select a reasonable partition method based on the original partition information.

Figure 1: Ubuntu Linux Partition Wizard

If you want complete control over the partitioning process, use the Other option. Click the "Continue" button and the installation wizard will bring the user to the manual partitioning interface, as shown in Figure 2.

Figure 2: Manual partitioning mode

Here you can see the partition information of the current hard disk. Since I am using a virtual machine for demonstration, I can only see an unused hard disk with a capacity of 20GB.

Step 1: Select the free disk space, click the "Add" button, and the "Create New Partition" dialog box will pop up. The type of the new partition is primary partition, the mount point is /boot, and the capacity of the new partition is 128MB. Finally, click the "OK" button, as shown in the figure below.

Figure 3: Create a boot partition

This mount point contains the operating system kernel and the files used in the system startup process. Next, create a new swap partition.

Step 2: Select the free disk space and click the "Add" button. The "Create New Partition" dialog box will pop up. The type of the new partition is logical partition. Select "Swap space" for "Used for". The capacity of the new partition is 1024M. Finally, click the "OK" button, as shown in the figure below.

Figure 4: Creating a swap partition

The swap partition is equivalent to the "virtual memory" in Windows. If the physical memory is less than or equal to 512MB, it is recommended to allocate a swap partition with a size that is twice the size of the physical memory. If the physical memory is greater than 512MB, it is recommended to allocate a swap partition with a size equal to the size of the physical memory. If your memory is large enough, you do not need to create a swap partition.

Use the same method to create mount points such as /var, /tmp, /home, etc. The final partition result is shown in the figure below.

Figure 5: Final hard disk partition result

This concludes this article on the most reasonable way to partition the hard disk when installing the Ubuntu Linux system. For more information about installing Ubuntu Linux hard disk partitions, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Ubuntu is set to automatically mount all hard disk partitions at startup

<<:  Practical TypeScript tips you may not know

>>:  Example analysis of the usage of the new json field type in mysql5.7

Recommend

Web developers are concerned about the coexistence of IE7 and IE8

I installed IE8 today. When I went to the Microso...

Detailed tutorial on installing and configuring MySql5.7 on Ubuntu 20.04

Table of contents 1. Ubuntu source change 2. Inst...

How to draw a mind map in a mini program

Table of contents What is a mind map? How to draw...

Detailed explanation of js event delegation

1. Each function is an object and occupies memory...

Two ways to connect WeChat mini program to Tencent Maps

I've been writing a WeChat applet recently an...

Detailed tutorial on installing Docker and docker-compose suite on Windows

Table of contents Introduction Download and insta...

XHTML tags have a closing tag

<br />Original link: http://www.dudo.org/art...

How to set the memory size of Docker tomcat

When installing Tomcat in Docker, Tomcat may over...

How to solve the problem that Seata cannot use MySQL 8 version

Possible reasons: The main reason why Seata does ...

How to install JDK8 on Windows

1. Download: http://www.oracle.com/technetwork/ja...

CocosCreator Getting Started Tutorial: Network Communication

Network Communication Overview When developing an...

Detailed explanation of Linux text processing tools

1. Count the number of users whose default shell ...

Detailed explanation of the four transaction isolation levels in MySQL

The test environment of this experiment: Windows ...