After a day struggling to make space for /tmp
just for installing a new system image for Android Virtual Device, right before I gave up, this magical thought came to my mind: why not change /tmp
mount to somewhere more spacious: /home/<user>/tmp
!
Android system image installation in IntelliJ / Android Studio is straightforward, supposedly. Choose a device configuration, select an existing image, or download a new image in my case, and after a short wait, it shall be done.
However, IntelliJ has been failing me in the middle step: download extract and install that Android system image. It says, not enough space, and indeed, my /tmp
which resides in /
root directory partition was filling up to the brim. Without wanting to risk myself in improperly configuring the image, I tried my way to slim down my /
usage, increasing free space from 3GB to 5GB, uninstalling a few obsolete packages etc, Android system image still refused to give way.
Then I thought, how about to change the tmp directory to /home/<user>/tmp
where I have ample free space?
A few answers on Stackoverflow [1] says exporting -Djava.io.tmpdir=<dir>
flag would alter the tmp folder location for JVM which runs IntelliJ. I tried, and I could read from the console that IntelliJ recognized that. However, at the process to add the Android system image, it still resorted to the original /tmp
folder. As download goes, I saw the free space of /
diminishing, and by the time of extraction, all space’s gone, again.
That sucks. There must be a solution, I thought.
After a few rounds of furious googling, the idea of mount
caught my eyes.
To cut things short, the lines here are telling the Linux system: I want to use /home/<user>/tmp
for /tmp
:
1 2 |
chmod 1777 /home/<user>/tmp mount -o bind /home/<user>/tmp /tmp |
Note: the common permission for tmp
folder is 1777
(ref [Server Fault] & [Unix & Linux Stack Exchange]). Also this change to tmp
folder is not persistent, meaning it WILL go away upon reboot.
With this, finally, peace.
One reply on “Change /tmp mount for AVD installation in IntelliJ IDEA”
super helpful! thank you very much.