首页 > 数字化转型 > ERP > SA299学习笔记 第四章 管理交换配置(4)
添加交换空间
使用swap –a命令
当系统需要的交换空间超过了当前可用的交换空间,可以用下面的步骤来添加附加的交换空间:
1,编辑/etc/vfstab文件来添加描述交换分区的信息
# vi /etc/vfstab
2,添加一行条目:
/dev/dsk/c1t0d0s3 - - swap - no -
3,用swap -a命令来添加额外的交换区域
# swap -a /dev/dsk/c1t0d0s3
添加交换文件
使用swap –a命令
增加一个交换文件,可以用下面的步骤来实现:
1,在/export/data目录中创建名为swapfile的文件:
# mkfile 20m /export/data/swapfile
这里需要注意的是这里建立文件使用的是mkfile这个命令。
NAME mkfile - create a file SYNOPSIS mkfile [-nv] size [g | k | b | m] filename... DESCRIPTION mkfile creates one or more files that are suitable for use as NFS-mounted swap areas, or as local swap areas. When a root user executes mkfile(), the sticky bit is set and the file is padded with zeros by default. When non-root users execute mkfile(), they must manually set the sticky bit using chmod(1). The default size is in bytes, but it can be flagged as gigabytes, kilobytes, blocks, or megabytes, with the g, k, b, or m suffixes, respectively. |
2,将这个文件添加到系统的交换空间中:
# swap -a /export/data/swapfile
3,列出系统交换空间中的详细信息(查看刚才的添加操作是否成功):
# swap -l
4,显示更改过的系统交换空间变动摘要:
# swap -s
5,在/etc/vfstab文件中添加一行条目:
# vi /etc/vfstab
/export/data/swapfile - - swap - no -(添加的内容)
删除交换空间
使用命令swap –d,这个命令可以将/etc/vfstab文件中相应信息也一并删除
swap –d /dev/dsk/c1t0d0s3
删除交换文件
1,删除交换文件:swap -d /export/data/swapfile
2,删除文件,释放占据的交换空间:rm /export/data/swapfile
3,编辑/etc/vfstab文件来移除相应的内容
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/222350/viewspace-925960/ ,如需转载,请注明出处,否则将追究法律责任。