我需要将目录从另一个 HDD 挂载到我当前的主目录。我可以通过以下命令来做到这一点,它可以正常工作:
sudo mount --bind /media/username/HDD3TB/'Мои документы'/Фото /home/username/Pictures/HDD_Photo
但我希望它在系统初始化期间自动挂载。我尝试将以下条目添加到 /etc/fstab:
/media/username/HDD3TB/'Мои документы'/Фото /home/username/Pictures/HDD_Photo none bind 0 0
但是这种方式行不通,而且会导致系统初始化时出错。
在 journalctl 中,我发现了以下错误消息:
kernel: ACPI Error: [\_SB_.PCI0.XHC_.RHUB.HS11] Namespace lookup failure, AE_NOT_FOUND (20170831/dswload-210)
kernel: ACPI Exception: AE_NOT_FOUND, During name lookup/catalog (20170831/psobject-253)
kernel: ACPI Exception: AE_NOT_FOUND, (SSDT:xh_rvp08) while loading table (20170831/tbxfload-228)
kernel: ACPI Error: 1 table load failures, 5 successful (20170831/tbxfload-246)
kernel: clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635855245 ns
和
-- The start-up result is RESULT.
июн 30 20:03:24 elementaryOS systemd-remount-fs[448]: mount: /etc/fstab: parse error at line 19 -- ignored
июн 30 20:03:24 elementaryOS systemd[1]: Started Remount Root and Kernel File Systems.
-- Subject: Unit systemd-remount-fs.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit systemd-remount-fs.service has finished starting up.
...
-- The start-up result is RESULT.
июн 30 20:03:32 elementaryOS systemd-fsck[1055]: fsck: /etc/fstab: parse error at line 19 -- ignored
июн 30 20:03:32 elementaryOS systemd[1]: Started File System Check Daemon to report status.
-- Subject: Unit systemd-fsckd.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
...
-- Unit systemd-fsck@dev-disk-by\x2duuid-4e02e814\x2d86be\x2d4995\x2d9989\x2dbe965304d5ea.service has begun starting up.
июн 30 20:03:32 elementaryOS systemd-fsck[1078]: fsck: /etc/fstab: parse error at line 19 -- ignored
июн 30 20:03:32 elementaryOS systemd[1]: Found device ST1000DM003-9YN162 1.
-- Subject: Unit dev-disk-by\x2duuid-c6e31fc0\x2d90ae\x2d48c3\x2dba37\x2db124bffc57f3.device has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit dev-disk-by\x2duuid-c6e31fc0\x2d90ae\x2d48c3\x2dba37\x2db124bffc57f3.device has finished starting up.
我可以在路径中使用空格和西里尔符号吗?或者也许我应该使用另一种方式来自动挂载这个目录?
您不需要使用
/etc/fstab/
,您可以创建以下systemd
服务来挂载文件。我改编了:用户写的这个答案: @detuur以适应这种特殊情况。
使用创建一个新文件:
sudo vim /etc/systemd/system/boot-shadow-mount.service
然后复制并粘贴以下内容,然后保存文件并退出vim
接下来,运行以下命令来更正文件中的“用户名”:
然后,运行以下命令以“启用”新服务,以便在您引导系统时该服务将自动启动:
重新启动时,该文件应自动挂载。
请发布任何错误。谢谢!
附加来源:blog.iwakd.de/systemd-fstab-and-bind-mounts-with-options