Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running an Ubuntu server on EC2 ebs, and my application needs a lot of temporary disk space, allocated in /tmp. However, on ec2 the root drive which also contains /tmp is pretty small, around 10GB. All of the remaining disk space is mounted under /mnt. As a result, my application returns 'out of disk space' errors, because /tmp seems to be full.

What is the best way to solve this problem? One thing I can think of is create /mnt/tmp and make a symbolic link

/tmp --> /mnt/tmp

However I am a bit reluctant to mess around with something that is used by so many linux programs and tools. I am not sure if every program will correctly resolve the symbolic link, and not sure what it would to to performance.

share|improve this question
1  
Bind mounts mean not having to symlink. –  Ignacio Vazquez-Abrams Mar 12 '12 at 19:36
add comment

2 Answers

up vote 3 down vote accepted

With EBS-backed images, the ephemeral storage is still available, it just isn't mapped as a block device by default (as it is on instance-store images)

The amazon doc is here, and there's a useful blog post, here

In summary: you can specify this mapping on the command line when you launch the image, and then mount it as a normal volume on /dev/sd[x]. Or you if you roll your own AMI, then you can bake the mapping into that AMI so that all images launched from it have access to it from the outset.

Symlinking /tmp will work, but I wouldn't recommend it in this case, where you have a large amount of temporary storage in use. Once you have the device mapping available, you can have the device mounted as /tmp in /etc/fstab.

With a small instance, you should have 150GB of instance store available for free. It hoepfully goes without saying that this storage dies when the instance reboots. If your usage isn't that temporary, then you need to create your own, new EBS volume and mount it that way.

share|improve this answer
1  
Why is symlinking not recommended? For example if I want to put both /var/tmp and /var/log onto my ephemeral storage, I can mount the storage as /mnt and symlink both directories there. –  j0nes Mar 11 '12 at 13:45
    
Good point. I was thinking about this specific case, based on the assumption that the OP was considering symlinking back to the main partition. I'll clarify my answer. –  SmallClanger Mar 11 '12 at 14:15
add comment

You can bind the /tmp mount point to /mnt/tmp:

sudo mount -B /tmp /mnt/tmp

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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