美文网首页
树莓派3b使用systemd自动装载usb硬盘分区

树莓派3b使用systemd自动装载usb硬盘分区

作者: 坚慧 | 来源:发表于2017-02-10 14:14 被阅读234次

树莓派3b上外接了一块硬盘,加上resilio-sync来做同步,备份文件。
vim /etc/systemd/system/opt-sync.mount,文件名是目录+.mount

[Unit]
Description=My flashdrive script trigger
#Requires=.mount
#After=media-YourMediaLabel.mount
After=usb_modeswitch@.service
#[Service]
#ExecStart=/home/you/bin/triggerScript.sh
[Mount]
#What=UUID=ea8d7bf8-384d-412b-b9eb-b92f702fc360
What=/dev/sda2
Where=/opt/sync
#Options=nofail
Type=ext4

[Install]
WantedBy=multi-user.target

开机自动挂载systemctl enable opt-sync.mount

编辑sync的systemd配置文件,确保在挂载了usb硬盘后启动
vi /lib/systemd/system/resilio-sync.service

[Unit]
Description=Resilio Sync service
Documentation=http://help.getsync.com/
#opt-sync.mount是后增加的,确保在挂载了usb硬盘后,resilio-sync才启动
After=network.target network-online.target opt-sync.mount

相关文章

网友评论

      本文标题:树莓派3b使用systemd自动装载usb硬盘分区

      本文链接:https://www.haomeiwen.com/subject/wdvgittx.html