Linux系统教程:如何调整swap大小?_服务器_操作系统教程-查字典教程网
Linux系统教程:如何调整swap大小?
Linux系统教程:如何调整swap大小?
发布时间:2016-02-19 来源:查字典编辑
摘要:这里小编要跟大家介绍的是Linux系统中调整swap大小的方法。欢迎大家阅读。3、创建一个swap文件复制内容到剪贴板########ddi...

这里小编要跟大家介绍的是Linux系统中调整swap大小的方法。欢迎大家阅读。

3、创建一个swap文件

复制内容到剪贴板

########

dd if=/dev/zero of=/tmp/swap bs=1MB count=1024

########

以下仅供参考:不用看

Creating a swap file

First of, make sure the file system the disk you wish to swap on is properly mounted. For the purposes of this tutorial we will assume the disk is mounted as /mnt and we want to use the file /mnt/myswap.swp for swapping.

使用下面的命令创建一个1G的swap文件

复制内容到剪贴板

Use the following command to create a 1024MB file that we will use for swapping

########

dd if=/dev/zero of=/mnt/myswap.swp bs=1024MB count=1

########


4、制作一个swap文件,如果觉得繁琐,可以将mkswap文件挂载到tmp目录下,例如:

复制内容到剪贴板

########

mkswap /tmp/swap

########

以下仅供参考:不用看

Preparing the swap file

Before we enable the swap file we must first set it up. The following command accomplishes just that:

########

mkswap /mnt/myswap.swp

########

5、使用swapon 启动/tmp/swap

复制内容到剪贴板

########

swapon /tmp/swap

########

使用一个swap分区,如果已经有一个swap分区,该步骤可以省略

以下仅供参考:不用看

Using a swap partition

Setting up a swap partition is a bit more difficult, as the partition must be first created then formatted using the linux-swap file system. Once that is done, assuming the swap partition is at/dev/scsi/host0/bus0/target0/lun0/part5 (common for v24 USB drives with mutiple partitions), the only command that needs be issued is:

 

7、如果只想增加swap大小,请忽略以下的操作,重要!!如果不使用刚才增加的1G的swap文件,使用下面的swapoff命令,可以关闭,这样swap文件就缩小了1G

使用swapoff关闭swap文件

复制内容到剪贴板

########

swapoff /tmp/swap

########

注意事项:如果只想增加swap大小,请忽略第7步的所有操作。


相关介绍:Linux

严格来讲,Linux这个词本身只表示Linux内核,但人们已经习惯了用Linux来形容整个基于Linux内核,并且使用GNU 工程各种工具和数据库的操作系统。

Linux拥有以下特性:类似于Unix的基本思想,支持完全免费与自由传播,完全兼容POSIX1.0标准,支持多用户、多任务、有着良好的界面、支持多种平台。Linux 能运行主要的UNIX工具软件、应用程序和网络协议。它支持32位和64位硬件。Linux继承了Unix以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。

Linux有着许多不同的版本,但它们都使用了Linux内核。Linux可安装在各种计算机硬件设备中,比如手机、平板电脑、路由器、视频游戏控制台、台式计算机、大型机和超级计算机。

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新服务器_操作系统教程学习
    热门服务器_操作系统教程学习
    电脑子分类