Linux Study Notes: swap Partition

Source: Internet
Author: User

Linux Study Notes: swap Partition

Linux Study Notes: swap Partition

How can we create a swap partition for a newly added hard disk? Follow the following four steps:

(1) use an existing partition, for example, as

(2) The hexadecimal encoding of the partition type, that is, the hexadecimal encoding of.

(3) format

(4) Enable A as A swap Partition

Okay. For example, we have used fdisk to create an MBR partition for a hard disk, as shown below:

 

You can use "fdisk-l" to view the result.

Next I want to use/dev/sdc5 as the swap partition. How can this problem be solved? Strictly follow the above four steps.

Use the fdisk tool to enter the hard disk and modify its hexadecimal encoding. As follows:

 

Then enter the command t, as shown below:

 

Let's select the serial number, sdc5. If you don't need to check it again, you can also know the serial number 5. Type 5, as shown below:

 

If you do not know what hexadecimal encoding is, type L and check it. Here I will cut a picture, as shown below:

 

It is the hexadecimal encoding that I can see after typing L. We can see that the 82 is the hexadecimal encoding of swap.

Enter 82 directly. As follows:

 

Okay. After the hexadecimal encoding is modified, is the modification successful? Enter p to view the information, as shown below:

 

Observe that the Id of/dev/sdc5 is changed to 82.

Save and exit the fdisk tool.

You can format it as follows.

Note: the format of swap is different from that of common partition. Use the mkswap command. As follows:

 

Formatted successfully !! Enable it as a swap partition! Remember the command as follows:

 

Of course, if you do not regret it after it is enabled, cancel it and run the following command:

Swapoff/dev/sdc5

This article permanently updates the link address:

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.