How to add swap to the Ubuntu boot entry

Source: Internet
Author: User

Swap is an exchange partition under the Ubuntu system, its function and function is somewhat similar to our Windows system virtual memory, the user opens this function to let the Ubuntu system run more convenient, the swap operation mode divides into the manual operation and the automatic running two kinds of forms, Some users will find it troublesome to run manually, but some users do not know how to add swap to the startup of Ubuntu, below see Small series for you to provide the Operation method Bar!

1. Add Swap

Add 2G swap partition, just modify count=2k

sudo dd if=/dev/zero of=/swap.disk bs=1m count=2k

sudo mkswap-f/swap.disk

sudo swapon/swap.disk

Or

sudo dd if=/dev/zero of=/swap.disk bs=1m count=2k && sudo mkswap-f/swap.disk && sudo swapon/swap.disk

2. Join start

sudo vi/etc/rc.local

Add before exit 0:

#sudo DD If=/dev/zero of=/swap.disk bs=1m count=2k && sudo mkswap-f/swap.disk && sudo swapon/swap.disk

sudo mkswap-f/swap.disk && sudo swapon/swap.disk

Exit 0

By using this method, users can add swap to the Ubuntu boot entry, so that you do not have to manually mount the swap partition every time you turn on the system

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.