Wind Network (ithov.com) original article: In the process of managing Linux, accidentally hand mistakenly, delete the swap partition, and the format, how to restore it? After querying the relevant information, finally found a way, write to share to everyone!
We need to use two commands:
Mkswap
Usage:mkswap [-c] [-ppagesz] [-l-label] [-U-UUID]/dev/http://www.aliyun.com/zixun/aggregation/11696.html ' >name [ Blocks]
Swapon
Usage:
swapon-a [-E] [-v] [-f] enable all swaps From/etc/fstab
Swapon [-P priority] [-V] [F] <special> enable given swap
Swapon-s Display Swap Usage Summary
Swapon-h Display Help
SWAPON-V Display version
The <special> parameter:
{-L label | Label=label} label of device to is used
{-U uuid | UUID=UUID} UUID of device to is used
<device> name of device to is used
<file> name of file to is used
Example:
[Root@localhost/]# Mkswap/dev/sda7
[Root@localhost/]# Swapon/dev/sda7