ubuntu中/dev/zero是块设备吗
时间: 2023-10-01 20:09:34 浏览: 50
是的,/dev/zero是一个块设备。它是一个特殊的设备文件,可以用于生成一个无限的流数据,其中所有字节都是零。它通常用于初始化内存或磁盘空间,也可以用于测试和调试目的。在Linux系统中,块设备是指可以被分成固定大小块(通常是512字节)的设备,例如硬盘、U盘等。而/dev/zero就是一个虚拟的块设备。
相关问题
ubuntu mysql8.0.32 /etc/mysql/my.cnf 文件内容
以下是在Ubuntu系统上安装MySQL 8.0.32后的默认 /etc/mysql/my.cnf 文件内容:
```
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
#skip-external-locking
skip-name-resolve
skip-host-cache
skip-ssl
sql-mode = ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
log-error = /var/log/mysql/error.log
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Recommended in standard MySQL setup
# sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#
# * Character sets
#
# MySQL/MariaDB default is Latin1, but in Ubuntu UTF-8 is default
#
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates you can use for example the GUI tool "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
[mysql]
#
# * Basic Settings
#
socket = /var/run/mysqld/mysqld.sock
prompt = \u@\h [\d]>\_
[mysqldump]
#
# * Basic Settings
#
socket = /var/run/mysqld/mysqld.sock
quick
quote-names
max_allowed_packet = 16M
[isamchk]
key_buffer = 16M
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
```
注意,这只是默认的配置文件,实际上你可以根据需要进行修改。
ubuntu18.04设置交换空间
在Ubuntu 18.04上设置交换空间有两种方案,一种是修改原有文件大小,另一种是设置新的交换分区。具体步骤如下:
方案一:修改原有文件大小方式
1. 进入系统根目录:cd /
2. 执行命令:sudo dd if=/dev/zero of=/swap bs=1M count=16384 //每段块1M 共16384块,即16G
3. 执行命令:sudo mkswap /swap // 激活swap空间
4. 执行命令:sudo swapon /swap
5. 使用free -m命令,验证是否设置成功。
方案二:设置新的交换分区
1. 进入系统根目录:cd /
2. 创建一个新的交换分区文件:sudo dd if=/dev/zero of=/swap bs=1M count=16384
3. 创建swap文件系统:sudo mkswap -f swap
4. 开启新的swap:sudo swapon swap
5. 关闭并删除原有的swap文件:sudo swapoff swapfile && sudo rm /swapfile
6. 将/etc/fstab中的swapfile改为swap
7. 使用free -m命令,验证是否设置成功。
永久生效的方法是在/etc/fstab中添加一行:/home/gsc/swapfile/swap none swap defaults 0 0
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)