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

Detailed introduction of disk Partition under linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains the "detailed introduction of disk partitions under linux". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the detailed introduction of disk partitions under linux".

Disk management under Centos

1. Description of disk partition format

Linux partition is different from windows,linux hard disk device name (IDE hard disk is hdx (x is slave Amurd) because IDE hard disk is up to four, SCSI,SATA,USB hard disk is sdx (x is Amerz), hard disk has up to 4 primary partitions, needless to say everyone knows … .. So the primary partition starts from sdb1 to sdb4, and the logical partition starts with sdb5. (logical partition always starts with sdb5. ) the device name can be viewed using fdisk-l

two。 Zoning detailed explanation

Log in to the system using the ssh remote connection tool and use the fdisk-l command to view the disk status

Here you can see two hard drives hda and hdb, the first hard disk hda is installed with the system. The hdb hard drive is not partitioned.

This example will partition the 10G hard disk, partition plan: divided into a primary partition, size 3G, file format ext3. Three logical partitions, the sizes of which are 2G ~ (th), 2G, and 3G, respectively. The actual number and size of zones can be determined by the situation.

The following is the detailed steps of the partition, because each step is screenshot and description, the content is slightly complex, in fact very simple.

Enter fdisk / dev/hdb and enter to partition the hard drive. The figure below is as follows

Enter n enter to create a new partition, and then enter p enter to create a new primary partition, as shown in the figure

You are required to select a partition number between 1 and 4, and enter 1 enter

First cylinder (1-20805, default 1): here is the cylinder that sets the beginning of the partition. Enter directly and select the default. Enter the following figure

Last cylinder or + size or + sizeM or + sizeK (1-20805, default 20805): here, set the partition ending cylinder. + 3G means starting from the starting cylinder and ending backward 3G. Also set the partition size to 3G. Enter + 3G and enter enter, as shown in the following figure.

You can enter p here to check whether the partition is successful, and enter p to enter, as shown in the following figure: shows that the partition is successful

Next, we will divide the extended partition and press n to enter.

Enter e here to create an extended partition, and enter e to enter

Enter the partition number 2 and enter

Press enter directly here to select the default

Here, enter directly and select the default, which means that all the disks after the first primary partition will be divided into this logical partition.

You can enter the command p here to view the current partition status, as shown in the following figure

Start dividing the logical partitions under the extended partition hdb2 here! Follow the picture above and enter the command n enter

Enter l here to choose to create a logical partition, and enter l enter

Enter is used directly here, indicating that the default is selected.

Enter + 2G here, indicating that the partition size is 2G, and enter + 2G enter

Here, two more logical spaces are divided according to the plan, enter n enter, then enter l enter to select the logical partition, and then enter directly to select the default starting cylinder, and enter + 2G enter to set the partition size

Next, assign all the disk size of the extended partition to the last logical partition, enter n enter, then enter l to select the logical partition, then enter directly to select the default starting cylinder, and finally enter directly without setting the disk size

Enter p again to view the current partition status

The space divided is the same as we planned. Finally, enter w to save and exit.

Use the fdisk-l command again to see that the disk hdb has been partitioned successfully.

The disk has been partitioned successfully. Now it is time to format the partition.

Use the command mkfs-t ext3 / dev/hdb1

Mkfs-t ext3 / dev/hdb5

Mkfs-t ext3 / dev/hdb6

Mkfs-t ext3 / dev/hdb7

Format the disk separately, and format it to ext3 file type

Since then, the partitioning process is complete!

Attached: parameter interpretation of fdisk and mkfs,mkswap commands

The Fdisk command explains:

M: get help

N: create a new partition

P: show partition table

D: delete partition

B: set the volume label

W: write to partition table

T: change the partition file system type

V: check the partition

L: displays the file system code supported by fdisk

Q: exit

Establishment of the file system:

Mkfs parameter partition

-t file system type specifies the type of file system that is established

Note: mkfs-t ext3 = mkfs.ext3

-c check for bad channels before establishing a file system

-l file name: read a bad channel from a file

-v displays details

Mkswap partitions create swap partitions on partitions

Example: the command to create a swap partition on hdb7 is as follows:

Mkswap/etc/hdb7

Thank you for your reading. The above is the content of "detailed introduction of disk partitions under linux". After the study of this article, I believe you have a deeper understanding of the detailed introduction of disk partitions under linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Servers

Wechat

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

12
Report