Centos uses files to implement the swap function: SWAPFILE implementation

Source: Internet
Author: User
Create a swap file mkdir/var/swap # if the sub-swap partition of the installer is not too large. create a folder to store swap partition files, decide on your own chmod700/var/swap # Modify the switch partition folder permission to introduce some usage tips of the dd command hard disk copy: ddif =/dev/sdaof =/dev/sdb # copy a file of the specified size from sda to sdb: ddif =/dev/zeroof =/var/swap/fil

If the sub-swap partition of the installation host is not too large

Create a swap file

Mkdir/var/swap # Create a folder to store swap partition files, and decide chmod700/var/swap # modify swap partition folder permissions

Describes how to use the dd command.

Dd command Hard Disk Copy: ddif =/dev/sdaof =/dev/sdb # Copy sda and sdb to create a specified size file: ddif =/dev/zeroof =/var/swap/file. swapbs = 1024 k count = 64 # bs indicates that the data file size 1024k is 1 MB, so it is set to 1024 k. However, unix does not support this syntax or requires byte Computing # count is the number of databases 64 64 M

Here we need dd to create a file using swap

Ddif =/dev/zeroof =/var/swap/file. swap bs = 1024 k count = 64 # Create a 64 M file

Next we need mkswap

Mkswap/var/swap/file. swap # Create a swap file vim/etc/fstab # write the Mount table/var/swap/file. swap defauls 0 # enable this swap partition swapon/var/swap/file at startup. swap # enable swapoff/var/swap/file. swap # Disable df-h to observe the changes


This article is from the blog "someone says my technology House", please be sure to keep this source http://1992mrwang.blog.51cto.com/3265935/1270592

Related Article

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.