Ubuntu Add swap

Source: Internet
Author: User
Tags file permissions

Ubuntu default swap is not enough.


remark:
1) Ubuntu version: 14.04
2) Linux users: Root

Typically, a swap partition in a Linux system can be specified in two ways: one, a swap partition when the disk is partitioned, and a swap file in the file system as a swap partition. This article mainly introduces the second way. The steps are as follows:

1. Create a file
fallocate-l 8g/swapfile
Description: 8G indicates the swap file size,/swapfile is the swap file path and name, can be arbitrarily specified.

2. Modify File Permissions
chmod 600/swapfile

3. Initialize the swapfile as a swap file
Mkswap/swapfile

4. Enable swap files
Swapon/swapfile

5. At this point, the Linux system has used Swapfile as a swap file, but after the reboot is not automatically suspended in the file you just created, so you need to manually modify the/etc/fstab configuration file:
Gedit/etc/fstab
Add the following content to the file:
/swapfile None swap SW 0 0

6. Complete, test under:
swapon-s

Tips:
If you need to unmount a swap partition file, you can use the command: Swapoff/swapfile

"Reference":
http://www.linuxidc.com/Linux/2014-08/105223.htm

This article from "Do not forget Beginner's mind Oracle" blog, declined reprint!

Ubuntu Add swap

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.