Search code examples
linuxamazon-web-servicesamazon-ec2amazon-linuxamazon-linux-2

Increasing Amazon Linux 2 AMI /tmp size


I'm trying to install tensorflow on a Amazon linux AMI EC2 micro instance, but I keep getting EnvironmentError: [Errno 28] No space left on device even while the disk is empty.
On ubuntu server, I fix this increasing the /tmp size with the command sudo mount -o remount,size=4G,noatime /tmp, however this command fails on Amazon Linux telling me that /tmp is not mounted at all.
How can I increase /tmp size on Amazon Linux 2?

Thx!


Solution

  • Following can help in achieving the tmp space.

    cd                              # change to your home directory    
    fallocate -l 20G 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