Linux environments Create swap partitions

Source: Internet
Author: User

Recently in the ready to run on the mobile side of the deep learning training model, on the RK3399 board installed scipy times wrong. Online check, because of insufficient memory, make a swap partition is done. So how do you swap partitions? Talk not much, directly open the.

--------------------------------------------------------------------------------------------------------------- ----------------------

To create a swap file with the fallocate command

fallocateA program is the best way to immediately create a pre-allocated file size.

The following command will create a 1GB size /swapfile .

sudo fallocate-l 1g/swapfile

Check to see if the file you created is the correct size.

ls -lh/swapfile11. 0G June  7:/swapfile

Set the file's permissions so that 600 only the root user can access the file.

sudo chmod  /swapfile

Convert this file to a swap file by running the following command.

sudo mkswap/11024x768 MiB (1073737728  bytes) No label, UUID= cda50e0e-41f3-49c7-af61-b8cb4a33a464

Make the swap file effective by running the following command.

sudo swapon/swapfile

Add the newly created interchange file to fstab the file, so that changes to the swap partition space can take effect even after a restart.

vi /etc/fstab/swapfile  swap  swap  defaults  00

Check the newly created interchange file.

$ swapon--showname      TYPE       SIZE   used PRIO/dev/sda5 partition    657.8M   - 1 file      1024M     0B   -2

Now I can see a new 1GB /swapfile1 file. Restart the system for the new swap file to take effect.

Excerpt part of:

Compiled from: http://www.2daygeek.com/add-extend-increase-swap-space-memory-file-partition-linux/ 2daygeek
Original: LCTT https://linux.cn/article-8699-1.html Translator: Cinlen Chan

--------------------------------------------------------------------------------------------------------------- ----------------------

Focus: Above just describes how to create a swap partition, on the RK3399 board, I actually created a 4G swap partition!!!

Look at my situation.

 Free-H

Linux environments Create swap partitions

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.