How to add a swap partition file in Linux

Source: Internet
Author: User
If the Linux installation is not divided into swap partitions, you can:

1. Divide a partition and use it as swap. Then add a row in/etc/fstab,

/Dev/sda9 swap defaults 0 0

This is assumed to be sda9.

2. If there is no space
1) create a large enough file
Dd If =/dev/Zero of =/swapfile BS = 1024 COUNT = 262144
(The value of count is equal to 1024 x the size of the file you want, And 262144 is 256 MB)

2) Change this file to a swap file.
Mkswap/swapfile

3) enable this swap file
Swapon/swapfile

4) automatically load the swap file every time you start the system. Add a line to the/etc/fstab file.
/Swapfile swap defaults 0 0


Note: The last line must be blank when modifying fstab. Otherwise, the system will prompt warning.



Note: I am not liable for any of the above content from the Internet.
ArticleFrom: http://blog.csdn.net/DL88250/archive/2007/11/14/1883531.aspx

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.