Increasing the space available in /tmp?

Robert Connolly robert at
Sat Jan 31 06:32:15 PST 2009

On Saturday January 31 2009 09:14:59 am Angel Tsankov wrote:
> Sometimes GCC needs more space in /tmp to compile certain temporary tools.
> When using the LFS LiveCD as host system, how can I increase the space
> available in /tmp?
> Angel Tsankov

If you have a lot of ram, mount (or remount) /tmp with:
mount -t tmpfs tmpfs /tmp
This will give half your ram to /tmp. You can specify a size (512 megabytes 
here) with:
mount -t tmpfs -o size=512m tmpfs /tmp

Another way is to use a loopback file system. Somewhere on your drive, 
in /tools perhaps, do:
dd if=/dev/zero of=tmpfile bs=1024 count=500000
to make a tmpfile that's roughly 500 megabytes. With 'losetup -a' figure out 
which is the next available loop device, and do:
losetup /dev/loop5 tmpfile
Then format it (no need for a journalling file system):
mkfs -t ext2 /dev/loop5
And mount it:
mount /dev/loop5 /tmp

Before you do any of this try to be sure /tmp is already empty... do this 
before starting X, or else currently running programs will lose their temp 
files. Maybe someone else has a suggestion to migrate existing temp files to 
the new /tmp.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <>

More information about the lfs-chat mailing list