centos 添加服务自动挂载硬盘

这次用init.d方式

risenarrow
2024-02-16 08:39

1、在etc/rc.d/init.d 下添加脚本 mount_disk.sh



#! /bin/bash
## mount_disk       Bring up/down mount
## chkconfig: 2345 10 90
# description: 111222
##
mount /dev/sdb1 /data1/pan1
mount /dev/sdc1 /data/pan1
mount /dev/sdc5 /data/pan2
mount /dev/sdc6 /data/pan3
mount /dev/sdc7 /data/pan4

2、添加启动

[root@localhost init.d]# chkconfig --add mount_disk.sh 
[root@localhost init.d]# chkconfig mount_disk.sh on