`

add a swap file

 
阅读更多

To add a swap file:

 

  1. Determine the size of the new swap file and multiple by 1024 to determine the block size. For example, the block size of a 1024 swap file is 2G.

  2. At a shell prompt as root, type the following command with count being equal to the desired block size:

    dd if=/dev/zero of=/swapfile bs=1024 count=2M
    
    
  3. Setup the swap file with the command:

    mkswap /swapfile
    
    
  4. To enable the swap file immediately but not automatically at boot time:

    swapon /swapfile
    
    
  5. To enable it at boot time, edit /etc/fstab to include:

    none /swapfile swap defaults 0 0
    
    

    The next time the system boots, it will enable the new swap file.

  6. After adding the new swap file and enabling it, make sure it is enabled by viewing the output of the command cat /proc/swaps or free.

分享到:
评论

相关推荐

    阿里云服务器环境配置(挂载数据盘、swap分区、FTP服务器、JDK、Tomcat7)

    "add_swap.zip"可能是一个自动化脚本,用于快速创建和启用swap分区。"auto_fdisk.zip"可能是用来自动划分磁盘分区的工具,简化了数据盘挂载的初始步骤。 综上所述,配置阿里云服务器涉及多方面的技术操作,从硬件...

    swapjs:SWAP 实用程序库

    SWAPJSSWAP utility libraries SWAP. Freelancer's online tax manager....source, we add one test directory named All tests file didn't needed compiled byCommit Standard [feat]: 新增/修改功能 (feat

    Lerner -- Python Workout. 50 Essential Exercises -- 2020.pdf

    - **Objective:** Swap the first and last characters of a given string. - **Key Concepts:** - Slicing strings. - Concatenating strings. 10. **Summing Anything** - **Objective:** Create a function...

    BURNINTEST--硬件检测工具

    - When BurnInTest crashes, it will not generate a "minidump" file. Minidumps will need to be sent to Microsoft as per the normal process. However, a log entry will be added to the normal BurnIn...

    VB编程资源大全(英文源码 控件)

    <END><br>10 , Scroller.zip This is a Control Container, it's like a frame control but it lets you scroll the content up and down...<END><br>11 , TrayArea.zip This control lets you add your icon ...

    ImageMagick图片批量处理

    -adjoin join images into a single multi-image file -affine matrix affine transform matrix -alpha option activate, deactivate, reset, or set the alpha channel -antialias remove pixel-aliasing -...

    函数解析-C语言代码

    这里`int add`表示函数名为`add`,返回类型为整型(int),`int a, int b`是参数列表,函数体是`return a + b;`。 2. **参数传递**: 在C语言中,函数参数可以按值传递或按引用传递。按值传递意味着函数接收的是...

    linux.chm文档

    rar a file1.rar file1 file2 dir1 同时压缩 'file1', 'file2' 以及目录 'dir1' rar x file1.rar 解压rar包 unrar x file1.rar 解压rar包 tar -cvf archive.tar file1 创建一个非压缩的 tarball tar -cvf ...

    centos 静默安装oracle 111G

    dd if=/dev/zero of=/home/swapfile bs=1M count=2048 ``` 这里创建了一个大约2G大小的交换文件。 - **格式化交换文件**: ```bash mkswap /home/swapfile ``` - **启用交换文件**: ```bash swapon /home...

    c语言实验报告c语言实验报告

    3. 添加源文件:将源程序文件“file1.c”,“file2.c”和“filemain.c”添加到项目中,通过“Project(工程)”->“Add to Project”->“Files”完成此步骤。 4. 编译和连接:通过选择“Build(编译)”->“Build ...

    2008大一C语言考试答案

    因此,表达式`3 * ADD(a + b)`展开为`3 * (a + b + a + b)`,即`3 * (2 + 1 + 2 + 1)`,结果为12。故正确答案是C(12)。 #### 20. 文件操作函数 - **题目**:对于文件操作函数`charch; ch = fgetc(fp);`,以下哪个...

    c语言程序设计经典一百例

    printf("Before swap: a=%d, b=%d\n", a, b); swap(&a, &b); printf("After swap: a=%d, b=%d\n", a, b); return 0; } ``` 4. **动态内存管理** - 实例6:动态分配数组并释放内存。 ```c #include #...

    Fortran语言教程和经典案例

    FUNCTION add(a, b) RESULT(result) INTEGER :: result INTEGER, INTENT(IN) :: a, b result = a + b END FUNCTION add ``` #### 七、模块(MODULES) - **模块定义**:在Fortran 90及以上版本中引入了模块...

    linux磁盘阵列,配额,虚拟内存

    # mdadm --grow /dev/md0 --raid-devices=4 /dev/sda12 --backup-file=/mnt/alex.bu # 扩展RAID设备,同时指定备份文件 # mdadm --create /dev/md0 -l 10 -n 4 /dev/sda[] # 创建新的RAID 10设备 ``` #### 二、...

    Ajax in action 英文版配书源码.rar

    <br>We'll be releasing further versions of this zip file as we add more back-end implementations, and improve the documentation. Your feedback is welcome. <br>Regards, <br>Dave Crane ...

    详细的Fortran基础教程.docx Fortran中的数组是非常强大的数据结构

    SUBROUTINE swap(a, b) REAL, INTENT(INOUT) :: a, b REAL :: temp temp = a a = b b = temp END SUBROUTINE swap ``` 5. **输入与输出** - **读取数据 (`READ`)**:从标准输入或其他文件读取数据。 ```...

    DevExpress VCL 13.1.4(v2013vol1.4) 源码-例子-帮助-part2

    S172107 - Add the capability to disable multi-threaded operations at the level of custom data sources (TcxCustomDataSource descendants) Resolved Issues ExpressBars Suite Q476901 - Documentation - The...

    DevExpress VCL 13.1.4(v2013vol1.4) 源码-例子-帮助-part1

    S172107 - Add the capability to disable multi-threaded operations at the level of custom data sources (TcxCustomDataSource descendants) Resolved Issues ExpressBars Suite Q476901 - Documentation - The...

    支持64位的ramdisk虚拟磁盘软件

    请使用addswap程序创建页面文件。 如: addswap r:\pagefile.sys 16 32 创建一个页面文件,最小16M,最大32M 10. TEMP 临时目录 驱动程序格式化时已经创建好了TEMP目录。需要的话要把TEMP和TMP环境变量 设到子...

    C&C++编程规范(超级实用)

    void swap(int& a, int& b); ``` **6.2 返回值的规则** 返回值应该有意义,并且尽可能使用`bool`类型表示成功或失败。 示例: ```cpp bool divide(int dividend, int divisor, int& quotient); ``` **6.3 函数...

Global site tag (gtag.js) - Google Analytics