请问在16.04版本下字符终端环境下如何实现u盘自动挂载?

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
回复
bob-janpos
帖子: 6
注册时间: 2017-12-19 17:40
系统: ubuntu16.04

请问在16.04版本下字符终端环境下如何实现u盘自动挂载?

#1

帖子 bob-janpos » 2018-01-30 9:56

这个问题折腾好几天了,我在网上找了好多资料,论坛里的方法也都试过了。主要有 usbmount,pmount,在udev /etc/udev/rules.d里面加规则都没用。
这些方法是不是都不适用与16.04版本?请问有什么办法吗?
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 请问在16.04版本下字符终端环境下如何实现u盘自动挂载?

#2

帖子 poloshiao » 2018-01-30 12:14

u盘自动挂载
你是希望開機就自動掛載
還是開機後插入時自動掛載
bob-janpos
帖子: 6
注册时间: 2017-12-19 17:40
系统: ubuntu16.04

Re: 请问在16.04版本下字符终端环境下如何实现u盘自动挂载?

#3

帖子 bob-janpos » 2018-01-30 14:14

poloshiao 写了:
u盘自动挂载
你是希望開機就自動掛載
還是開機後插入時自動掛載

我想要开机后的,u盘插上自动挂载,拔掉自动卸载
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 请问在16.04版本下字符终端环境下如何实现u盘自动挂载?

#4

帖子 poloshiao » 2018-01-30 16:13

主要有 usbmount,pmount,在udev /etc/udev/rules.d里面加规则都没用。
1. https://help.ubuntu.com/community/Mount ... _Server.29
Auto-mounting (Ubuntu Server)
By default, disk drives do not auto-mount in Ubuntu Server Edition. If you are looking for a lightweight solution that does not depend on HAL/DBUS, you can install "usbmount".

2. https://unix.stackexchange.com/a/134906
I use the usbmount package to automount USB drives on my Ubuntu server install.
usbmount will automount hfsplus, vfat, and ext (2, 3, and 4) file systems.
I tried this myself, only to find that it doesn't support NTFS well (or really, at all), so I formatted my disk as VFAT and all is well now.

3. https://packages.ubuntu.com/search?suit ... chon=names
套件 usbmount
拔掉自动卸载
4. 要拔出以前 要先卸載該掛載分割區, 彈出該 U 盤, 再拔出, 比較安全.
4-1. 先卸載已被掛載的全部分割區
sudo umount /dev/sdcx
/dev/sdcx 指該 USB 已被掛載的全部分割區
4-2. 有時 可能需要使用 eject 指令
sudo eject /dev/sdcx
4-3. 進一步參閱
https://unix.stackexchange.com/question ... ct-command
Eject USB drives / eject command
bob-janpos
帖子: 6
注册时间: 2017-12-19 17:40
系统: ubuntu16.04

Re: 请问在16.04版本下字符终端环境下如何实现u盘自动挂载?

#5

帖子 bob-janpos » 2018-01-31 10:51

poloshiao,
感谢您的回复,我认真的看了您给的网站,多次尝试任然无法解决。
我现在手动加载是能够加载到的。但是在字符终端自动加载总是失败(在桌面环境下,是默认自动加载的,能够正常使用),
另外在字符终端环境下,每次插入U盘会提示

代码: 全选

scsi host3: runtime PM trying to activate child device host3 but parent (2-1:1.0) is not active
不知道是否有这方面的问题?
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 请问在16.04版本下字符终端环境下如何实现u盘自动挂载?

#6

帖子 poloshiao » 2018-01-31 16:17

scsi host3: runtime PM trying to activate child device host3 but parent (2-1:1.0) is not active
不知道是否有这方面的问题?
可能是 kernel 的 Bug 但是 還沒看到徹底解決方案

1. 參見
1-1. http://lkml.iu.edu/hypermail/linux/kern ... 03827.html
This should be fixed by
https://patchwork.kernel.org/patch/9250679/
which I will push to Linus soon.
1-2. http://lkml.iu.edu/hypermail/linux/kern ... 03815.html
使用 runtime PM trying to activate child device host 搜尋
1-3. https://patchwork.kernel.org/patch/9250679/
BUG: sleeping function called from invalid context on next-20160726
1-4. https://lkml.org/lkml/2016/7/30/31
使用 runtime PM trying to activate child device host 搜尋
1-5. https://lists.ubuntu.com/archives/ubunt ... 16942.html
使用 runtime PM trying to activate child device host 搜尋
1-6. https://groups.google.com/forum/#!msg/A ... BdeWtFDgAJ
使用 runtime PM trying to activate child device host 搜尋
最後 有看到暫時解決方案
回复