Setup of virtual memory for Linux (Ubuntu)

Source: Internet
Author: User

Setup of virtual memory for Linux (Ubuntu)

Swap space is virtual memory, which is of great use when physical memory is low.

View memory Size: free-m//M indicates the displayed byte unit is m (megabytes)

Let's add the Swap size to the system. Www.2cto.com

1. First use the command free to view the Swap partition size within the system.

Free-m

Total used free shared buffers Cached

MEM:1002 964 38 0 21 410

-/+ buffers/cache:532 470

swap:951 32 929

You can see that Swap is only 951M and does not meet the installation requirements of oracle-xe-client.

2. Create a Swap file.

mkdir Swap

CD Swap www.2cto.com

sudo dd if=/dev/zero of=swapfile bs=1024 count=100000

The following prompt appears, and count in the above command represents the swap file size.

Recorded 100000+0 read-in

Recorded the writing of 100000+0.

102400000 bytes (102 MB) Replicated, 0.74704 sec, 137 mb/sec

Convert generated files to Swap files

sudo mkswap swapfile

Setting up Swapspace version 1, size = 102395 KB

No label, uuid=09fde987-5567-498a-a60b-477e302a988b

3. Activate the Swap file.

sudo swapon swapfile

Review the results of the free-m again.

Total used free shared buffers Cached

Mem:1002 967 34 0 22 410

-/+ buffers/cache:534 467

swap:1053 1021 www.2cto.com

Added successfully.

Extended:

If you need to uninstall this swap file, you can enter the created swap file directory. Execute the following command.

sudo swapoff swapfile

If you need to keep this swap, you can change sudo-s to root

Then write it to the/etc/fstab file.

Swapfilepath swap swap defaults 0 0

Setup of virtual memory for Linux (Ubuntu)

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.