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: