Get the App
SLTechnology News&Howtos  ›  Servers  › 

Use the mkswap command of linux to establish and set up a SWAP swap partition

Shulou Source: shulou.com Published: 2022-06-02 20:09:29 11月12日 Update

Editor to share with you the use of linux mkswap command to establish and set up SWAP exchange partition, I hope you will learn a lot after reading this article, let's discuss it together!

The mkswap command is used to create a swap partition on a file or device. After the establishment, use the sawpon command to start using the exchange. The last optional parameter specifies the size of the swap area, but this parameter is set for backward compatibility and is not necessary to use. The entire file or device is generally used as the swap area.

Syntax format: mkswap [parameters]

Common parameters:

Before setting up the exchange area, check if there are any damaged blocks.-f set up the exchange area on the SPARC computer. Add this parameter-v0 to establish the old exchange area, which is the default value-v1 to create a new exchange area.

Reference example

Add a swap partition, assuming it exists and set / dev/sdb3 as the swap partition:

[root@linuxcool ~] # mkswap / dev/sdb2 [root@linuxcool ~] # swapon / dev/sdb2

Create a 512m swap file with dd and set the file as the swap partition:

[root@linuxcool ~] # dd if=/dev/zero of=/swapfile1 bs=1024 count=524288 [root@linuxcool ~] # mkswap / swapfile1 [root@linuxcool ~] # swapon / swapfile1 after reading this article, I believe you have some understanding of using linux's mkswap command to establish and set up a SWAP exchange partition. Want to know more about it. Welcome to follow the industry information channel. Thank you for reading!

Tags: Parameters commands documents articles equipment new necessary blocks size finished examples commonly used more formats computers knowledge industry grammar information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple vpn Shulou Tech Info Shulou Technology Docker