我安装了ceph,在客户端要使用ceph块存储,每次必须要单独rbd map 一下,于是想到了 在rc.local文件中加上这句:
vim /etc/rc.local
rbd map rbd/img_oradata
mount -a
但重起操作系统后,没有执行,后来手工执行
. /etc/rc.local
发现又可以.
于是再次看这个文件,发现了该文件有一段内容:
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
#这个文件是为兼容性而添加的
#在开机过程中强烈建议创建自己的systemd服务或udev规则来运行脚本,而不是使用此文件
#和以前版本相比,此脚本将不会在在其它服务后运行
#记住,必须运行“chmod +x/etc/rc.d/rc.local”命令来确保启动过程中执行此脚本 .
因此我们应该给/etc/rc.d/rc.local加执行权限
试试把权限加上。
开机后,确实该文件中代码已经执行!
[root@ceph-oracle u01]# df -h
Filesystem Size Used Avail Use% Mounted on
...
/dev/rbd0 40G 33M 40G 1% /u01
...
|