1

I've seen this question asked a few times but nothing is working for me at the moment. So from the error message which is:

Tue May 31 16:06:09.566 [initandlisten] ERROR: Insufficient free space for journal files
Tue May 31 16:06:09.566 [initandlisten] Please make at least 3379MB available in data/journal or use --smallfiles

My database is called data so when I run mongod I need to pass through where my database sits so I run mongod --dbpath data/ i've tried appending --smallfiles and end up with this:

Tue May 31 16:07:10.268 [FileAllocator] error: failed to allocate new file: data/local.ns size: 16777216 boost::filesystem::create_directory: No space left on device: "data/_tmp".  will try again in 10 seconds

I came across this answer Why getting error mongod dead but subsys locked and Insufficient free space for journal files on Linux? which told me to add smallfiles = true to the mongodb.conf file which I have and still getting the issue.


Because i'm not sure of how to fix this, i've tried increasing my instance from t2.micro to m4.large and i'm still getting the error with not enough space available.

Does anyone have any idea what I can do to fix this?

Community
  • 1
  • 1
pourmesomecode
  • 4,108
  • 10
  • 46
  • 87

1 Answers1

1

t2 or m4 instances are working with EBS drive (you get more CPU/RAM but not more disk space as you attach disk from EBS)

You can expand your EBS volume to get more disk space

The high-level step-by-step procedure will be:

  1. Run the command df –h on your EBS Volume. It will display the drive’s details before resizing and the available space on the drive

  2. stop your instance and detach the existing volume from this instance

  3. create a snapshot from the volume (the one you just detached)

  4. Go to the snapshot area of the console and select your snapshot then Create Volume. In the pop up window you can adjust the size (make sure to give it enough space)

  5. when volume will be ready, attach this new volume to your instance (attach as root device) and start your instance

  6. ssh to your instance and rerun df -h to check the new available space on the drive.

In case the info given by df -h does not show the expected space, you would need to claim the free space, run sudo resize2fs /dev/xvda??? (make sure to replace ??? by the number of your partition given by df -h)

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139