gnome-session-manager 仅挂载一个分区

gnome-session-manager 仅挂载一个分区

在我的双操作系统机器(Ubuntu 14.04 和 Windows 8.1)上,我想在启动时自动挂载两个分区。为此,我按照以下步骤操作按用户挂载https://help.ubuntu.com/community/AutomaticallyMountPartitions

一切正常,除非我添加其他分区作为单独的条目安装,如图所示。 两个挂载入口

重启后,启动应用程序偏好设置已经消失。所以看起来我一次只能自动挂载一个分区,至少如果我想使用的话gnome-session-manager

这是有意为之还是一个错误?

我也尝试将两个命令放在一个条目中(/usr/bin/udisks --mount /dev/disk/by-uuid/C4C23530C2352856 /usr/bin/udisks --mount /dev/disk/by-uuid/2A4C62C34C628981),但只有最后一个分区被挂载。

(注:我现在确实挂载了我的分区fstab,但我仍然想知道为什么启动应用程序偏好设置只能处理一个 mount 命令。

答案1

经过长时间的讨论,@Fabby 和我一致认为这个行为是一个 bug。因此我提交了一个 bug 报告:https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/1408129

答案2

为了让所有用户都能使用坐骑

键入以下命令:

mkdir /media/MountName1
mkdir /media/MountName2

MountName您要赋予挂载点的名称在哪里)

将以下行添加到 fstab 末尾:

file system mount point   type  options       dump  pass
/dev/disk/by-uuid/C4C23530C2352856  /media/MountName1 ext4    errors=remount-ro 0       2
/dev/disk/by-uuid/2A4C62C34C628981  /media/MountName2 ext4    errors=remount-ro 0       2

让 1 位用户可以使用这些坐骑

进入终端Ctrl++AltT

键入sudo gedit /usr/local/bin/MountOneUser并按下Enter

复制粘贴以下文本:

#!/bin/bash
# This script automounts a mountpoint as requested in http://askubuntu.com/questions/562268
# Copyright (c) http://askubuntu.com/users/344926/fabby 2014

# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. See the GNU General Public License for more details.
# You DID NOT receive a copy of the GNU General Public License along with this program as the license is bigger then this program.
# Therefore, see http://www.gnu.org/licenses/ for more details.

/usr/bin/udisks --mount /dev/disk/by-uuid/C4C23530C2352856 
sleep 1
/usr/bin/udisks --mount /dev/disk/by-uuid/2A4C62C34C628981

保存文件并退出 Gnome 编辑器。

在终端窗口中输入:

sudo chmod +x /usr/local/bin/MountOneUser

打开启动应用程序,添加以下命令:MountOneUser并输入“名称”和“注释”,无论什么内容都会在将来提醒您这是什么。

退出重新登录。

你的错误 问题是您试图在一行中运行 2 个命令,而不是用“&”或“&&”分隔它们。一开始编写脚本的工作量有点大,但如果您需要稍后添加更多挂载,那么这会比在一行中输入一个非常长的命令更容易启动应用程序

相关内容