mongo crashed and now not starting - linux

My mongo was working fine. Today when I tried to open, it gives
ubuntu#DELL-PC:/usr/bin$ mongo
MongoDB shell version: 3.2.8
connecting to: test
2016-08-11T13:24:25.600+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2016-08-11T13:24:25.600+0530 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:229:14
#(connect):1:6
exception: connect failed
I moved to /usr/db and tried to open mongod from there using sudo ./mongod
ubuntu#DELL-PC:/usr/bin$ sudo ./mongod
2016-08-11T13:26:34.693+0530 I CONTROL [initandlisten] MongoDB starting : pid=9371 port=27017 dbpath=/data/db 64-bit host=DELL-PC
2016-08-11T13:26:34.693+0530 I CONTROL [initandlisten] db version v3.2.8
2016-08-11T13:26:34.693+0530 I CONTROL [initandlisten] git version: ed70e33130c977bda0024c125b56d159573dbaf0
2016-08-11T13:26:34.693+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g-fips 1 Mar 2016
2016-08-11T13:26:34.693+0530 I CONTROL [initandlisten] allocator: tcmalloc
2016-08-11T13:26:34.693+0530 I CONTROL [initandlisten] modules: none
2016-08-11T13:26:34.693+0530 I CONTROL [initandlisten] build environment:
2016-08-11T13:26:34.693+0530 I CONTROL [initandlisten] distmod: ubuntu1404
2016-08-11T13:26:34.693+0530 I CONTROL [initandlisten] distarch: x86_64
2016-08-11T13:26:34.693+0530 I CONTROL [initandlisten] target_arch: x86_64
2016-08-11T13:26:34.693+0530 I CONTROL [initandlisten] options: {}
2016-08-11T13:26:34.719+0530 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
2016-08-11T13:26:34.719+0530 I CONTROL [initandlisten] dbexit: rc: 100
I check I have free hard disk space.
ubuntu#DELL-PC:/usr/bin$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 2.4G 0 2.4G 0% /dev
tmpfs 486M 7.5M 478M 2% /run
/dev/sda1 97G 81G 12G 88% /
tmpfs 2.4G 52M 2.4G 3% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 2.4G 0 2.4G 0% /sys/fs/cgroup
cgmfs 100K 0 100K 0% /run/cgmanager/fs
tmpfs 486M 72K 485M 1% /run/user/1000
Can someone please suggest what can be the issue here?
What is the location of mongotable which I created earlier. i.e. location of data/db
How can I search it in terminal?
Your help much appreciated.

Quite possibly your configuration was updated by you hosting provider. It looks like your default configuration is pointing to the wrong dbpath. You'll need to update your config file to use the correct path. See https://docs.mongodb.com/manual/reference/configuration-options/
You can also test by just launching mongod using --dbpath.

If you don't tell mongo what is your database directory, it assumes that it's /data/db. Not /usr/db.
So, with ./mongod --dbpath /usr/db it should start..

Related

Problem with MongoDB connection of server

I've a problem with my configuration on mongodb.
My configuration is:
Linux Ubunut 18.04LTS
I've follow documentation MongoDB.org. Every going well.
But I meetting problem when I run mongod command.
He return me that:
2020-07-07T12:59:43.510+0200 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted
2020-07-07T12:59:43.510+0200 F - [initandlisten] Fatal Assertion 40486 at src/mongo/transport/transport_layer_asio.cpp 684
2020-07-07T12:59:43.510+0200 F - [initandlisten]
***aborting after fassert() failure
I tested of remove /tmp/mongodb-27017.sock and of change administratif law:
# rm /tmp/mongodb-27017.sock
# sudo systemctl start mongod
# sudo mongod
# ls -la /tmp/
Return :
srwx------ 1 usr usr 0 juil. 7 13:14 mongodb-27017.sock
# sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
# ls -la /tmp/
# srwx------ 1 mongodb mongodb 0 juil. 7 13:14 mongodb-27017.sock
If I raise mongod command:
2020-07-07T13:19:43.641+0200 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-07-07T13:19:43.644+0200 W ASIO [main] No TransportLayer configured during NetworkInterface startup
2020-07-07T13:19:43.644+0200 I CONTROL [initandlisten] MongoDB starting : pid=23119 port=27017 dbpath=/data/db 64-bit host=dasco-UX32VD
2020-07-07T13:19:43.645+0200 I CONTROL [initandlisten] db version v4.2.8
2020-07-07T13:19:43.645+0200 I CONTROL [initandlisten] git version: 43d25964249164d76d5e04dd6cf38f6111e21f5f
2020-07-07T13:19:43.645+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
2020-07-07T13:19:43.645+0200 I CONTROL [initandlisten] allocator: tcmalloc
2020-07-07T13:19:43.645+0200 I CONTROL [initandlisten] modules: none
2020-07-07T13:19:43.645+0200 I CONTROL [initandlisten] build environment:
2020-07-07T13:19:43.645+0200 I CONTROL [initandlisten] distmod: ubuntu1804
2020-07-07T13:19:43.645+0200 I CONTROL [initandlisten] distarch: x86_64
2020-07-07T13:19:43.645+0200 I CONTROL [initandlisten] target_arch: x86_64
2020-07-07T13:19:43.645+0200 I CONTROL [initandlisten] options: {}
2020-07-07T13:19:43.645+0200 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted
2020-07-07T13:19:43.645+0200 F - [initandlisten] Fatal Assertion 40486 at src/mongo/transport/transport_layer_asio.cpp 684
2020-07-07T13:19:43.645+0200 F - [initandlisten]
***aborting after fassert() failure
Finally, if I do:
# mongod --port 27018
Return
2020-07-07T13:24:57.906+0200 I STORAGE [initandlisten] exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db, terminating
2020-07-07T13:24:57.906+0200 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2020-07-07T13:24:57.906+0200 I - [initandlisten] Stopping further Flow Control ticket acquisitions.
2020-07-07T13:24:57.906+0200 I CONTROL [initandlisten] now exiting
2020-07-07T13:24:57.906+0200 I CONTROL [initandlisten] shutting down with code:100
But /data/ it's ok
drwxr-xr-x 3 mongodb mongodb 4096 juil. 6 20:23 /data/db
And if I run sudo mongod , it doesn't work:
# sudo mongod
....
2020-07-07T13:27:51.499+0200 E STORAGE [initandlisten] Failed to set up listener: SocketException: Address already in use
2020-07-07T13:27:51.499+0200 I CONTROL [initandlisten] now exiting
2020-07-07T13:27:51.499+0200 I CONTROL [initandlisten] shutting down with code:48
# ls -la /tmp/
srwx------ 1 root root 0 juil. 7 13:27 mongodb-27017.sock
That change law
For finish if I do:
# sudo mongod --port 27018
I don't have a problem...
You have solution please?

When running Mongodb got NonExistentPath: Data directory /data/db not found., terminating

The error generated when executed sudo mongod executed
2018-09-13T20:56:08.259+0530 I CONTROL [initandlisten] MongoDB starting : pid=3419 port=27017 dbpath=/data/db 64-bit host=admin
2018-09-13T20:56:08.260+0530 I CONTROL [initandlisten] db version v3.6.7
2018-09-13T20:56:08.260+0530 I CONTROL [initandlisten] git version: 2628472127e9f1826e02c665c1d93880a204075e
2018-09-13T20:56:08.260+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2018-09-13T20:56:08.260+0530 I CONTROL [initandlisten] allocator:
tcmalloc
2018-09-13T20:56:08.260+0530 I CONTROL [initandlisten] modules: none
2018-09-13T20:56:08.260+0530 I CONTROL [initandlisten] build environment:
2018-09-13T20:56:08.260+0530 I CONTROL [initandlisten] distmod: ubuntu1404
2018-09-13T20:56:08.260+0530 I CONTROL [initandlisten] distarch: x86_64
2018-09-13T20:56:08.260+0530 I CONTROL [initandlisten] target_arch: x86_64
2018-09-13T20:56:08.260+0530 I CONTROL [initandlisten] options: {}
2018-09-13T20:56:08.312+0530 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2018-09-13T20:56:08.312+0530 I CONTROL [initandlisten] now exiting
2018-09-13T20:56:08.312+0530 I CONTROL [initandlisten] shutting down with code:100
I'm a beginner in MEAN stack application development and stuck with this error. Please help me. Thanks in advance
This solution solves my problem
Make a directory as
sudo mkdir -p /data/db
That will make a directory named as db and than try to start with commands
sudo mongod
If you get another error or problem with starting mongod, You may find problem as
Failed to set up listener: SocketException: Address already in use
If you find that another error than you have to kill the running process of mongod by typing to terminal as
ps ax | grep mongod
Find the mongod running port and kill the process.
sudo kill ps_number
Another way is to make a specefic port when starting mongod as
sudo mongod --port 27018
cd ~
mongod
All you need to do above step to prevent the error.
Don't run the mongod at different local disk location.
eg. My computer has two local disk:
1.) Local disk E: - drive : (When I run mongod on E: drive or on targeting any location on E local disk then I will get error message as)
Admin#DESKTOP-CJBHIMO MINGW64 /e/Full-Stack-Developer
$ mongod
...
{"t":{"$date":"2021-03-22T11:33:26.675+05:30"},"s":"E", "c":"STORAGE", "id":20557, "ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error":"NonExistentPath: Data directory E:\\data\\db\\ not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the 'storage.dbPath' option in the configuration file."}}
...
{"t":{"$date":"2021-03-22T11:33:26.677+05:30"},"s":"I", "c":"CONTROL", "id":23138, "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":100}}
{"error":"NonExistentPath: Data directory E:\data\db\ not found.
2.) Local disk C: - drive : (When I run mongod on C: drive, which I recommend to use, cause, we mostly do the installation of mongodb on C: drive as per the instruction. If in your case, you installed on another drive, then run mongod on that drive's folder on hyper. Eg. as I run mongod on C:
Admin#DESKTOP-CJBHIMO MINGW64 ~/Desktop
$ mongod
{"t":{"$date":"2021-03-22T00:52:23.840-07:00"},"s":"I", "c":"STORAGE", "id":22270, "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"C:/data/db/","storageEngine":"wiredTiger"}}
...
{"t":{"$date":"2021-03-22T11:34:59.300+05:30"},"s":"I", "c":"NETWORK", "id":23016, "ctx":"listener","msg":"Waiting for connections","attr":{"port":27017,"ssl":"off"}}
"msg":"Storage engine to use detected by data files","attr":{"dbpath":"C:/data/db/","storageEngine":"wiredTiger"}}
This whole example is based on windows 10. It runs successful on root directory cause it is inside C: disk. To get inside root directory :
Just run
sudo mkdir -p /data/db
On the machine running the mongoDB server
Before doing any of the other solutions see my answer here.
Maybe your conf file is being rejected due to outdated options or format changes.

MongoDB - shutting down with code:100

I've been trying to set up MongoDB on my Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-22-generic x86_64) VPS and I've been running into a few problems. I am running as a user on my server that has root access but not using the root account itself.
I started to notice the problem when I was executing db.createUser() on the admin database so I could add other users and I was getting this error:
not authorized to execute command
So I then proceeded to uninstall and install again using the tutorial as provided on the website: https://docs.mongodb.com/v3.2/tutorial/install-mongodb-on-ubuntu/
Now when I'm on stage 2 Verify that MongoDB has started successfully on the Run MongoDB Community Edition section, that is I look at my output from the file /var/log/mongodb/mongod.log, I get the following:
2017-04-14T14:23:09.309+0200 I CONTROL [main] ***** SERVER RESTARTED *****
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] MongoDB starting : pid=9691 port=27017 dbpath=/var/lib/mongodb 64-bit host=vps338741
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] db version v3.4.3
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] git version: f07437fb5a6cca07c10bafa78365456eb1d6d5e1
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] allocator: tcmalloc
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] modules: none
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] build environment:
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] distmod: ubuntu1604
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] distarch: x86_64
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] target_arch: x86_64
2017-04-14T14:23:09.316+0200 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
2017-04-14T14:23:09.349+0200 I STORAGE [initandlisten]
2017-04-14T14:23:09.349+0200 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-04-14T14:23:09.349+0200 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2017-04-14T14:23:09.349+0200 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=464M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-04-14T14:23:09.366+0200 E STORAGE [initandlisten] WiredTiger error (2) [1492172589:366629][9691:0x7f1755946cc0], file:WiredTiger.wt, connection: /var/lib/mongodb/WiredTiger.wt: handle-open: open: No such file or directory
2017-04-14T14:23:09.367+0200 I - [initandlisten] Assertion: 28595:2: No such file or directory src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 267
2017-04-14T14:23:09.367+0200 I STORAGE [initandlisten] exception in initAndListen: 28595 2: No such file or directory, terminating
2017-04-14T14:23:09.367+0200 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-04-14T14:23:09.367+0200 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2017-04-14T14:23:09.367+0200 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-04-14T14:23:09.367+0200 I CONTROL [initandlisten] now exiting
2017-04-14T14:23:09.367+0200 I CONTROL [initandlisten] shutting down with code:100
I've looked around and it is not the same error as found here, because that is to do with the fact there isn't an /data/db folder which I have. From that log I can see it is something to do with this line:
2017-04-14T14:23:09.366+0200 E STORAGE [initandlisten] WiredTiger error (2) [1492172589:366629][9691:0x7f1755946cc0], file:WiredTiger.wt, connection: /var/lib/mongodb/WiredTiger.wt: handle-open: open: No such file or directory
Which is true, when I go to /var/lib/mongodb and do ls -l it results with:
drwxr-xr-x 2 mongodb mongodb 4096 Apr 14 14:10 journal
-rw-r--r-- 1 mongodb mongodb 0 Apr 14 14:02 mongod.lock
-rw-r--r-- 1 mongodb mongodb 0 Apr 14 14:10 WiredTiger
-rw-r--r-- 1 mongodb mongodb 21 Apr 14 14:10 WiredTiger.lock
-rw-r--r-- 1 mongodb mongodb 1004 Apr 14 14:10 WiredTiger.turtle
But I don't know if I should manually create that file as not seen this problem elsewhere. I made sure that mongodb user has permissions on these files too as stated in the answer to this question, but still no luck.
I'm really at a loss as to what to do, any help would be very appreciated as this is my like fifth attempt at getting it working!
Thanks!
If you created the mkdir -p /data/db maybe there is a chance that you must start your server with the following command : sudo mongod
macOS/OSX : https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
try :
sudo service mongod start ;
then run the mongodb with:
mongo
This is a known bug in MongoDB, check the report
Your problem is not that files are missing in general, it's that they go missing when you restart after a clean shutdown. Your problem is not related to the /data/db directory but more to WiredTiger.wt file that is missing after a restart.
Oct 1 20:00:44 alpha mongod.27017[1074]: [initandlisten] WiredTiger
(2) [1443729644:306783][1074:0x7fdba8fd4bc0], file:WiredTiger.wt,
connection: /data/db/WiredTiger.wt: No such file or directory
The bug report talks about the same thing.
Try:
I would suggest try and disable WiredTiger in the config file.
MongoDB Config Options
WiredTiger
UPDATE: To disable WiredTiger you have to change the storage.engine option in your mongo config file, by default mongod uses WiredTiger but you can also use InMemory LINK
Make a directory
sudo mkdir /data/db
Provide access to the directory
sudo chown -R $USER /data/db
Then run
mongod
If you get port already in use the stop mongod, it might be running in the background
sudo service mongod stop
If the last line is
waiting for connections on port 27017
then the mongod is working
This command helped me:
mongod --dbpath /data/db --repair
for me the 'answer' was to execute the following command (since service mongod start and just mongod failed)
sudo mongod --fork --port 27017 --replSet admin --logpath /data/log/mongo.log
I did not need to turn off wired tiger
Docker container:
In my case, I was using a docker container running
mongodb:
image: 'bitnami/mongodb:latest'
user: root
command: "chown -R $USER /bitnami/mongodb"
volumes:
- '/var/www/mongodb_data:/bitnami'
environment:
- MONGODB_USERNAME=bn_parse
- MONGODB_PASSWORD=3yfQexfqcc
- MONGODB_DATABASE=bitnami_parse
I migrated the docker host to other VPS/VM (aws is too expensive).
I added temporarily the command "chown -R $USER /bitnami/mongodb" to change the owner of that folder /bitnami/mongodb. It worked.
sudo mdkir data/db
sudo service mongod stop
sudo mongod
mongosh
this fixed it for me on ubuntu 22.04 after hours and hours of hunting down solutions

Docker run, no space left on device

[root#host ~]# docker run 9e7de9390856
Timestamp: 2015-06-15 22:20:58.8367035 +1000 AEST
Code: System error
Message: [/usr/bin/tar -xf /var/lib/docker/tmp/cde0f3a199597ac2e18e7efc7744c84a6c134adef31fb88b6982a8732f45efa5090033894/_tmp.tar -C /var/lib/docker/devicemapper/mnt/cde0f3a199597ac2e18e7efc7744c84a6c134adef31fb88b6982a8732f45efa5/rootfs/tmp .] failed: /usr/bin/tar: ./was/fixPack/7.0.0-WS-WASSDK-LinuxX64-FP0000027.pak: Wrote only 4608 of 10240 bytes
/usr/bin/tar: ./was/fixPack/wasFixPackInstallResponseFile: Cannot write: No space left on device
.
.
Cannot write: No spaFATA[0141] Error response from daemon: : exit status 2
df -h:
Filesystem Size Used Avail Use% Mounted on
/dev/xvda2 6.0G 3.2G 2.9G 52% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.8G 0 1.8G 0% /dev/shm
tmpfs 1.8G 17M 1.8G 1% /run
tmpfs 1.8G 0 1.8G 0% /sys/fs/cgroup
/dev/xvdb1 99G 28G 67G 30% /var/lib/docker
docker info:
Containers: 2
Images: 34
Storage Driver: devicemapper
Pool Name: docker-202:17-2621441-pool
Pool Blocksize: 65.54 kB
Backing Filesystem: extfs
Data file: /dev/loop0
Metadata file: /dev/loop1
Data Space Used: 15.89 GB
Data Space Total: 107.4 GB
Data Space Available: 76.3 GB
Metadata Space Used: 10.27 MB
Metadata Space Total: 2.147 GB
Metadata Space Available: 2.137 GB
Udev Sync Supported: true
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Library Version: 1.02.93-RHEL7 (2015-01-28)
Execution Driver: native-0.2
Kernel Version: 3.10.0-229.el7.x86_64
Operating System: Red Hat Enterprise Linux Server 7.1 (Maipo)
CPUs: 2
Total Memory: 3.452 GiB
Name: ip-10-100-128-182.localdomain
ID: 4ZZZ:BSQD:GBKL:4Y3N:J6BL:47QE:3HMQ:GLMY:FPUK:CEPM:3EBP:ZU7G
Debug mode (server): true
Debug mode (client): false
Fds: 13
Goroutines: 18
System Time: Mon Jun 15 22:48:24 AEST 2015
EventsListeners: 0
Init SHA1: 836be3a369bfc6bd4cbd3ade1eedbafcc1ea05d0
Init Path: /usr/libexec/docker/dockerinit
Docker Root Dir: /var/lib/docker
uname -a:
Linux ip-10-100-128-182.localdomain 3.10.0-229.el7.x86_64 #1 SMP Thu Jan 29 18:37:38 EST 2015 x86_64 x86_64 x86_64 GNU/Linux
Anyone can help me?
Not sure this information is enough. But tried couple of solutions, nothing worked.
docker version:
Client version: 1.6.0
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 8aae715/1.6.0
OS/Arch (client): linux/amd64
Server version: 1.6.0
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 8aae715/1.6.0
OS/Arch (server): linux/amd64
[root#host ~]# service docker status -l
Redirecting to /bin/systemctl status -l docker.service
docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled)
Active: active (running) since Tue 2015-06-16 00:31:46 AEST; 2min 2s ago
Docs: http://docs.docker.com
Main PID: 3306 (docker)
CGroup: /system.slice/docker.service
└─3306 /usr/bin/docker -d --storage-opt dm.basesize=30G --storage-opt dm.loopmetadatasize=4G
It sounds like you're trying to start a container from a 14GB image.
A Docker container, when using the devicemapper storage driver, only has 10GB of space available by default. You appear to be using the devicemapper driver, so this is probably the source of your problem.
This article discusses in detail the process you need to use to increase the amount of space available for container filesystems.
Filesystem-based drivers (like the overlay driver) to not have this same limitation (but they may of course suffer from other limitations).

BLKRASET: Inappropriate ioctl for device

I'm receiving this error
BLKRASET: Inappropriate ioctl for device
when trying to run
sudo blockdev --setra 256 /data
on my Linux server. The server is being used as a MongoDB server and /data is where it stores it's data.
I initially tried to run this command when I received this warning when starting my MongoDB shell:
Wed Mar 20 22:40:49.850 [initandlisten]
Wed Mar 20 22:40:49.850 [initandlisten] ** WARNING: Readahead for
/data/db is set to 2048KB
Wed Mar 20 22:40:49.850 [initandlisten] ** We suggest setting it to
256KB (512 sectors) or less
Wed Mar 20 22:40:49.850 [initandlisten] **
http://dochub.mongodb.org/core/readahead
The blockdev --setra command is supposed to set the readahead value for that directory and resolve the issue but I'm running into this issue
The blockdev command operates on block devices (disks), not directories. You need to pass it the name of the device in /dev/ where your data directory is stored. If you df /data it will tell you which device is currently mounted there. Then you can run blockdev --setra 512 /dev/whatever

Resources