Home > php教程 > PHP源码 > body text

linux创建swap文件|linux新增交换分区

PHP中文网
Release: 2016-05-22 17:22:29
Original
1106 people have browsed it

php代码

1.新分区扩展swap

假如有一个新的分区/dev/sda3,我们用它来作swap.

# swapon -s                --查看当前swap情况
# mkswap /dev/sda3         --制作swap分区
# swapon /dev/sda3         --启用swap分区
# swapon -s                --查看新的swap情况
# free -m
# vi /etc/fstab
 /dev/sda3   swap   swap  defaults  0  0    --添加开机自动挂载


2.大文件扩展swap

# dd if=/dev/zero of=/var/file bs=1M count=1000       --生成1G的大文件
# mkswap /var/file             --制作swap文件
# swapon /var/file             --启用swap文件
# swapon -s                    --查看新的swap情况
# free -m
# vi /etc/fstab
 /var/file   swap   swap   defaults  0   0       --添加开机自动挂载
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template