When Linux does not have multiple partitions, swap adds a scenario

Source: Internet
Author: User

Test environment: VMware 11

Test system: Red Hat Enterprise Linux 7

When there is not much space in our system to create a swap partition, one solution:

1[Email protected] ~]#DD if=/dev/zero of=/var/swapspace bs=1g count=1#创建交换分区文件, specify size 1G and save to/the Var directory2Recorded a 1 +0the read- in3Recorded a 1 +0the Writing41073741824 bytes (1.1GB) has been replicated,40.9398Seconds26.2MB/seconds #显示文件创建成功5[Email protected] ~]#ls-lh/var/swapspace #查看创建的swap文件6-rw-r--r--.1Root root1.0G February1  One: in/var/Swapspace7[Email protected] ~]# Mkswap/var/swapspace-L myswap #创建交换分区并设置卷标 myswap8Setting Swap space version1, size =1048572KiB9Label=myswap, uuid=6d756da7-e942-4fc6-b3b8-86f56be7f286 #显示设置成功并打印出相关信息Ten[Email protected] ~]# Free-h #查看修改前swap状态 OneTotal used Freeshared buffers Cached A mem:990m 148M 842M 644K 0B 26M --/+ buffers/cache:121m 869M -Swap:2.0G 74M1. 9G the[Email protected] ~]# swapon/var/swapspace #开户swap -[Email protected] ~]# Free-h #再次查看swap分区 -Total used Freeshared buffers Cached - mem:990m 150M 839M 712K 0B 27M +-/+ buffers/cache:123m 867M -Swap:3.0G 74M2. 9G +[Email protected] ~]#

When Linux does not have multiple partitions, swap adds a scenario

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.