0

My setup is based on this article: https://parall.ax/blog/view/3212/how-to-run-scalable-wordpress-on-aws-amazon-web-services-tutorial

I.e. Wordpress hosting via Elastic Beanstalk with a separate RDS instance and and handling file serving/uploads via Elastic Filesystem. My efs.config is as such:

packages:
  yum:
    nfs-utils: []
    jq: []
files:
  "/tmp/mount-efs.sh" :
    mode: "000755"
    content: |
      #!/usr/bin/env bash
      mkdir -p /mnt/efs
      EFS_NAME=$(/opt/elasticbeanstalk/bin/get-config environment | jq -r '.EFS_NAME')
      mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 $EFS_NAME:/ /mnt/efs || true
      mkdir -p /mnt/efs/uploads
      chown webapp:webapp /mnt/efs/uploads
commands:
  01_mount:
    command: "/tmp/mount-efs.sh"
container_commands:
  01-rm-wp-content-uploads:
    command: rm -rf /var/app/ondeck/wp-content/uploads
  02-symlink-uploads:
    command: ln -snf /mnt/efs/uploads /var/app/ondeck/wp-content/uploads

I trying to use scp to transter around 400G of files to EFS through one one the EC2 instances. Specifically I am transferring the files to "/mnt/efs/uploads", which should be the mounted EFS drive. However, after transferring around 7G, I am inevitably told "No space left on device."

Furthermore:

[ec2-user@ip-XXX-31-29-XXX uploads]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        1.9G   60K  1.9G   1% /dev
tmpfs           1.9G     0  1.9G   0% /dev/shm
/dev/xvda1      7.8G  7.7G     0 100% /

Why am I getting this message? It seems like I am filling up the EC2 space, but I should just be putting the files on the EFS mounted on the EC2... thoughts?

  • 1
    That df output doesn't actually seem to show that you have an EFS endpoint mounted. Seems like you're just putting the files on the EC2 filesystem. – Mugurel Nov 12 '17 at 16:53
  • Yes, that's the conclusion I came to as well. But how can "/mnt/efs/uploads" be on the EC2 file system? – two7s_clash Nov 12 '17 at 18:30
  • Any reason you're using EFS instead of S3? There are Wordpress plugins that will put all uploads (typically pictures / videos) which will serve them directly. You can go via CloudFront as well to accelerate them. – Tim Nov 12 '17 at 18:33
  • 1
    || true (i.e. "pretend success") at the end of the mount command seems more than a little bit wrong. – Michael - sqlbot Nov 12 '17 at 23:54
  • @Michael-sqlbot better way to not try to mount if already mounted? – two7s_clash Nov 13 '17 at 15:03
2

Try to execute /tmp/mount-efs.sh script manually while connected via SSH to your instance and check if it returns any error. Most likely the issue is in this line which failed to mount /mnt/efs directory to EFS:

      mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 $EFS_NAME:/ /mnt/efs || true
  • seems like my script needed to be launched with "sudo" as apparently this command was denied with insufficient permissions. – two7s_clash Nov 13 '17 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.