写一个shell脚本,分别挂载dev/sda1 dev/sda2 dev/sda3 ,并且设置开机自启
时间: 2023-12-23 09:02:31 浏览: 94
ubuntu中编写shell脚本开机自动启动(推荐)
#!/bin/bash
# 挂载/dev/sda1,/dev/sda2,/dev/sda3到/mnt/sda1,/mnt/sda2,/mnt/sda3
mount /dev/sda1 /mnt/sda1
mount /dev/sda2 /mnt/sda2
mount /dev/sda3 /mnt/sda3
# 设置开机自启动
echo "/dev/sda1 /mnt/sda1 ext4 defaults 0 0" >> /etc/fstab
echo "/dev/sda2 /mnt/sda2 ext4 defaults 0 0" >> /etc/fstab
echo "/dev/sda3 /mnt/sda3 ext4 defaults 0 0" >> /etc/fstab
echo "挂载完成,已设置开机自启动"
阅读全文