0

I have instalation of mongo on my PC with arch linux (64 bit machine). Before start I had move mongo database files on new location with plenty (11 Gb) space. But if i run mongod, it fails because of no space left on device. If I run this as root, ti works. Where is my potential problem? Im totaly newbie in mongo.

mongo version

$ mongod --version
db version v3.0.7
git version: nogitversion

mongo conf

$ cat /etc/mongodb.conf 
# See http://www.mongodb.org/display/DOCS/File+Based+Configuration for format details
# Run mongod --help to see a list of options

bind_ip = 127.0.0.1
quiet = true
#dbpath = /var/lib/mongodb
dbpath = /home/data/mongodb
logpath = /var/log/mongodb/mongod.log
logappend = true
$

check free space

$ sudo -u mongodb df -h /home/data/mongodb/
Souborový systém Velikost Užito Volno Uži% Připojeno do
/dev/sda3            208G  187G   11G  95% /home
$ 

check privileges

$ sudo -u mongodb ls -lisa /home/data/mongodb
celkem 12
3547175 4 drwx------ 2 mongodb  daemon 4096 28. lis 21.38 .
3538945 4 drwxr-xr-x 5 postgres root   4096 28. lis 21.14 ..
3544083 4 -rw-r--r-- 1 mongodb  root     69 28. lis 21.17 storage.bson

$ sudo -u mongodb ls /home/data/mongodb/
storage.bson

problem

$ sudo -u mongodb mongod --repair
2015-11-29T16:24:08.722+0100 I STORAGE  [initandlisten] exception in initAndListen: 39 Unable to write process id 4565 to file: /data/db/mongod.lock errno:28 No space left on device, terminating
2015-11-29T16:24:08.722+0100 I CONTROL  [initandlisten] now exiting
2015-11-29T16:24:08.722+0100 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2015-11-29T16:24:08.722+0100 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2015-11-29T16:24:08.722+0100 I NETWORK  [initandlisten] shutdown: going to flush diaglog...
2015-11-29T16:24:08.722+0100 I NETWORK  [initandlisten] shutdown: going to close sockets...
2015-11-29T16:24:08.722+0100 I STORAGE  [initandlisten] shutdown: waiting for fs preallocator...
2015-11-29T16:24:08.722+0100 I STORAGE  [initandlisten] shutdown: closing all files...
2015-11-29T16:24:08.722+0100 I STORAGE  [initandlisten] closeAllFiles() finished
2015-11-29T16:24:08.722+0100 I CONTROL  [initandlisten] dbexit:  rc: 100
$

as root

$sudo mongod --repair
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] MongoDB starting : pid=4610 port=27017 dbpath=/data/db 64-bit host=optiplex
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten]
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] 
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] 
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] 
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] db version v3.0.7
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] git version: nogitversion
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] build info: Linux flo 4.2.3-1-ARCH #1 SMP PREEMPT Sat Oct 3 18:52:50 CEST 2015 x86_64 BOOST_LIB_VERSION=1_59
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] allocator: tcmalloc
2015-11-29T16:25:56.792+0100 I CONTROL  [initandlisten] options: { repair: true }
2015-11-29T16:25:56.793+0100 I STORAGE  [initandlisten] finished checking dbs
2015-11-29T16:25:56.793+0100 I CONTROL  [initandlisten] now exiting
2015-11-29T16:25:56.793+0100 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2015-11-29T16:25:56.793+0100 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2015-11-29T16:25:56.793+0100 I NETWORK  [initandlisten] shutdown: going to flush diaglog...
2015-11-29T16:25:56.793+0100 I NETWORK  [initandlisten] shutdown: going to close sockets...
2015-11-29T16:25:56.793+0100 I STORAGE  [initandlisten] shutdown: waiting for fs preallocator...
2015-11-29T16:25:56.793+0100 I STORAGE  [initandlisten] shutdown: closing all files...
2015-11-29T16:25:56.793+0100 I STORAGE  [initandlisten] closeAllFiles() finished
2015-11-29T16:25:56.793+0100 I STORAGE  [initandlisten] shutdown: removing fs lock...
2015-11-29T16:25:56.793+0100 I CONTROL  [initandlisten] dbexit:  rc: 0

in log i have no new records...

Thanks for your help.

Jelen
  • 613
  • 5
  • 7
  • 1
    `MongoDB starting : pid=4610 port=27017 dbpath=/data/db` and `Unable to write process id 4565 to file: /data/db/mongod.lock`. It seems to be using `/data/db/`, not `/home/data/db/`. Are there symlinks, like `/home/data -> /data`? – Kenney Nov 29 '15 at 15:35
  • Yes, this looks as the problem. Thanks. I had changde dbpath, but mongo is looking for place for lock in bad place. – Jelen Nov 29 '15 at 18:33
  • Yes, that's what it looks like. Perhaps the old path is in `storage.bson`? As a quick fix, you could symlink `/data/` to `/home/data` so you can run the repair. – Kenney Nov 29 '15 at 18:36
  • This works. Thanks. sudo -u mongodb mongod --dbpath /home/data/mongodb/ --repair – Jelen Nov 29 '15 at 18:40
  • As per "no space left on device": 5% of any filesystem are per default reserved for the root user. This is why it works with `root` and not with `mongodb`. Could you please post the output of `df -h` without a path? – Markus W Mahlberg Nov 30 '15 at 00:14
  • This wasn`t my problem, Kenney`s advice helped me. Main problem was in my /etc/mogodb.conf, because i had append on log, but have no privileges to write in this. I I start without config a I forgot set correct dbpath (in root directory, where is default dbpath i had only space for root, this five percents as you said). – Jelen Nov 30 '15 at 12:18

0 Answers0