目录
[root@liping ~]# dd if=/dev/zero of=/opt/swap_file bs=1G count=1
记录了1+0 的读入
记录了1+0 的写出
1073741824字节(1.1 GB)已复制,10.8215 秒,99.2 MB/秒
// if :指定源 一般写/dev/zero
// of :指定目标
// bs :定义块大小
// count :数量
[root@liping ~]# mkswap -f /opt/swap_file
正在设置交换空间版本 1,大小 = 1048572 KiB
无标签,UUID=4a22b2c8-8c6d-4ff3-99b6-2f7cf7444840
[root@liping ~]# free -m
total used free shared buff/cache available
Mem: 3774 155 2386 8 1232 3346
Swap: 2047 0 2047
[root@liping ~]# swapon /opt/swap_file
swapon: /opt/swap_file:不安全的权限 0644,建议使用 0600。
[root@liping ~]# free -m
total used free shared buff/cache available
Mem: 3774 156 2386 8 1232 3345
Swap: 3071 0 3071
[root@liping ~]# swapoff /opt/swap_file
[root@liping ~]# free -m
total used free shared buff/cache available
Mem: 3774 155 2386 8 1232 3346
Swap: 2047 0 2047
[root@liping ~]# swapon /opt/swap_file
swapon: /opt/swap_file:不安全的权限 0644,建议使用 0600。
[root@liping ~]# free -m
total used free shared buff/cache available
Mem: 3774 157 2381 8 1236 3344
Swap: 3071 0 3071
[root@liping ~]# fdisk /dev/sdc
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
命令(输入 m 获取帮助):n
分区号 (3-128,默认 3):
第一个扇区 (34-41943006,默认 2050048):
Last sector, +sectors or +size{K,M,G,T,P} (2050048-41943006,默认 41943006):+1G
已创建分区 3
命令(输入 m 获取帮助):t
分区号 (1-3,默认 3):
分区类型(输入 L 列出所有类型):82
分区 3 的类型未更改:Linux filesystem
命令(输入 m 获取帮助):w
[root@liping ~]# partprobe /dev/sdc
[root@liping ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─rhel-root 253:0 0 17G 0 lvm /
└─rhel-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 20G 0 disk
├─sdb1 8:17 0 100M 0 part /opt/sdb
└─sdb2 8:18 0 1K 0 part
sdc 8:32 0 20G 0 disk
├─sdc1 8:33 0 500M 0 part
├─sdc2 8:34 0 500M 0 part
└─sdc3 8:35 0 1G 0 part
sdd 8:48 0 20G 0 disk
sr0 11:0 1 3.8G 0 rom
[root@liping ~]# mkswap /dev/sdc3
正在设置交换空间版本 1,大小 = 1048572 KiB
无标签,UUID=14a7cf3e-b007-44c3-98c4-24ce4413bcd9
[root@liping ~]# free -m
total used free shared buff/cache available
Mem: 3774 156 2378 8 1239 3344
Swap: 3071 0 3071
[root@liping ~]# swapon /dev/sdc3
[root@liping ~]# free -m
total used free shared buff/cache available
Mem: 3774 157 2377 8 1239 3344
Swap: 4095 0 4095
[root@liping ~]# swapoff /dev/sdc3
[root@liping ~]# free -m
total used free shared buff/cache available
Mem: 3774 157 2377 8 1239 3344
Swap: 3071 0 3071
[root@liping ~]# free -m
total used free shared buff/cache available
Mem: 3774 157 2375 8 1241 3344
Swap: 3071 0 3071
[root@liping ~]# swapon /dev/sdc3
[root@liping ~]# free -m
total used free shared buff/cache available
Mem: 3774 157 2375 8 1241 3344
Swap: 4095 0 4095
rsyslog服务的配置文件:/etc/rsyslog.conf
配置文件格式定义为: facility.priority action
facility可以理解为日志的来源或设备,目前常用的facility有以下几种:
auth #认证相关的
authpriv #权限、授权相关的
cron #任务计划相关的
daemon #守护进程相关的
kern #内核相关的
lpr #打印机关的
mail #邮件相关的
mark #标记相关的
news #新闻相关的
security #安全相关的,与auth类似
syslog #syslog自己的
user #用户相关的
uucp #unix to unix cp相关的
local0到local7 #用户自定义使用
[root@liping ~]# vim /etc/rsyslog.conf
[root@liping ~]# systemctl restart rsyslog
[root@localhost ~]# vim /etc/rsyslog.conf
[root@localhost ~]# systemctl restart rsyslog
原文:https://www.cnblogs.com/liping0826/p/11669469.html