权限被拒绝:为什么无法在/dev/sda4上启动mongodb?

权限被拒绝:为什么无法在/dev/sda4上启动mongodb?

我的 sda 上的块设备属性信息。

sudo blkid
/dev/sda1: UUID="7E91-CA50" TYPE="vfat" PARTLABEL="win10" PARTUUID="b30fb21a-0b23-41fb-bed5-ad42ce287770"
/dev/sda2: UUID="6512f5f3-d574-49dd-a5ba-572795df8792" TYPE="ext4" PARTLABEL="debian" PARTUUID="eeca8d16-53cb-4b3e-9cb1-c335d34f8c22"
/dev/sda3: UUID="6434a352-35e0-46d9-b0a2-da724c91639f" TYPE="ext4" PARTLABEL="centos" PARTUUID="12f64023-b42e-48ce-a0d2-edb13625db9b"
/dev/sda4: UUID="0cba040e-d9da-4285-b70e-b2a9b5290a1c" TYPE="ext4" PARTLABEL="arch" PARTUUID="99e49e99-fdf2-4636-95b4-13dccde7dbca"
/dev/sda5: UUID="6a55c9fc-a1c6-4285-8763-093b9a715e4c" TYPE="swap" PARTLABEL="swap" PARTUUID="c4634793-b5e4-4c3a-abc8-a07dd0bd21fd"

我想将 /mongodb 挂载到 uuid 为 的 /dev/sda4 上 0cba040e-d9da-4285-b70e-b2a9b5290a1c
在我的 /etc/fstab 上添加以下行:

UUID=0cba040e-d9da-4285-b70e-b2a9b5290a1c  /mongodb        ext4    rw,auto     0 1

重启后到 ls /mongodb。

debian@wifi:~$ ls -alR   /mongodb
/mongodb:
total 28
drwxr-xr-x  4 debian debian  4096 Aug 31 19:57 .
drwxr-xr-x 24 root   root    4096 Aug 31 09:27 ..
drwxr-xr-x  2 debian debian  4096 Aug 31 19:57 log
drwx------  2 root   root   16384 Aug 31 09:25 lost+found

/mongodb/log:
total 8
drwxr-xr-x 2 debian debian 4096 Aug 31 19:57 .
drwxr-xr-x 4 debian debian 4096 Aug 31 19:57 ..
-rw-r--r-- 1 debian debian    0 Aug 31 19:57 mongodb.log
ls: cannot open directory /mongodb/lost+found: Permission denied

df -h /mongodb
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda4        46G   52M   44G   1% /mongodb
debian@wifi:~$ tree  /mongodb
/mongodb
├── log
│   └── mongodb.log
└── lost+found [error opening dir]

2 directories, 1 file
debian@wifi:~$ sudo service mongo  start
Failed to start mongo.service: Unit mongo.service failed to load: No such file or directory.
debian@wifi:~$ sudo service mongodb   start
debian@wifi:~$ sudo service mongodb   status
● mongodb.service - An object/document-oriented database
   Loaded: loaded (/lib/systemd/system/mongodb.service; enabled)
   Active: failed (Result: exit-code) since Thu 2017-08-31 19:59:46 EDT; 2s ago
     Docs: man:mongod(1)
  Process: 1873 ExecStart=/usr/bin/mongod --config /etc/mongodb.conf (code=exited, status=1/FAILURE)
 Main PID: 1873 (code=exited, status=1/FAILURE)

Aug 31 19:59:46 wifi mongod[1873]: all output going to: /mongodb/log/mongodb.log
Aug 31 19:59:46 wifi mongod[1873]: can't open [/mongodb/log/mongodb.log] for log file: errno:13 Permission denied
Aug 31 19:59:46 wifi mongod[1873]: Bad logpath value: "/mongodb/log/mongodb.log"; terminating.
Aug 31 19:59:46 wifi systemd[1]: mongodb.service: main process exited, code=exited, status=1/FAILURE
Aug 31 19:59:46 wifi systemd[1]: Unit mongodb.service entered failed state.

为什么无法启动mongodb?

答案1

看来已经是骑马的人了; lost+found 是当您因 FS 问题启动 fsck 时找到的检索文件的 EXT4 目录

所以,简单来说,您已经安装了 FS。尝试发帖:

df -h /mongodb

相关内容