0

I just expanded my storage space on Amazon EC2, after I ran out of volume. However, even after doing so, I receive an error message as follows:

ubuntu@ip-172-31-30-27:~/walt/bin$ LC_ALL=C 
sort -k 1,1 -k 3,3n -k 2,2n -k 6,6 \-o ./final_1_mr.mr.sorted_end_first ./final_1_mr.mr
*sort: write failed: /tmp/sort8Aua2D: No space left on device*

My storage statistics:

Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G   12K  3.9G   1% /dev
tmpfs           799M  340K  799M   1% /run
/dev/xvda1      788G  295G  462G  39% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            3.9G     0  3.9G   0% /run/shm
none            100M     0  100M   0% /run/user
overflow        1.0M     0  1.0M   0% /tmp

I'm doing my Master's project and stuck with this this error message. Please help!

Thanks

  • you are displaying the free inodes , not the free disk space, used df -h to display the free space and edit the post...also, how big are the file which you are trying to sort ? – mazs May 11 '16 at 15:52
  • Edited the post. Sorry about that. The files I'm trying to sort is about 4 GB. – chaitanya May 11 '16 at 16:58
1

Your problem is that the /tmp is only 1Mb, while the file to be sorted is 4Gb. I don't know perfectly how sort works but it is surely using /tmp (as stated in the error) and the 1Mb is not enough.

You should create another partition and mount that in the /tmp, or if you can not do this, create a virtual disk of 10-20Gb (or bigger) with fallocate or dd in your home folder where you have enough space, and mount that as /tmp. fallocate is faster because it will not write the whole file like dd.

So, you should do the following to create a virtual disk in your home directory and mount it as /tmp :

cd                              # change to your home directory    
fallocate -l 10G mydrive.img    # create the virtual drive file
mkfs -t ext3 mydrive.img        # format the virtual drive
sudo umount /tmp                # unmount the /tmp
sudo mount -t auto -o loop mydrive.img /tmp   # mount the virtual drive

Maybe you could as well just umount the /tmp and use the existing tmp folder which is in the / root folder, as the / partition has a lot of space. Just make sure that after the umount the /tmp permits full access for everyone :

sudo umount /tmp
sudo chmod 1777 /tmp
  • 1
    Probably want sudo chmod 1777 /tmp so that the sticky bit is set. – forquare May 11 '16 at 22:00
  • 1
    Yes, I'm not sure what are the permissions of /tmp in this kind of scenario, so sticky bit is a good idea. Edited the post to reflect this – mazs May 11 '16 at 22:03
  • 1
    or just set $TMPDIR, or use sort's -T or --temporary-directory option. /var/tmp, perhaps. – cas May 12 '16 at 2:26
0

With GNU sort specify -T dir (or --temporary-directory=dir) where dir is a writable directory on a filesystem with enough space, such as /home/$USER/mytemp for the layout you posted.

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.