I use Ubuntu 20.04, on a machine that has a limited system drive.
I came across a build script that checks for available size in /tmp
, and it refuses to run if it doesn't see 12 GB available, which I do not have on system drive.
However, I do have another NTFS drive on this machine; since its NTFS, I cannot really use it directly, but I can create a disk image.
So, I thought of creating a 16 GB ext3 image on the NTFS partition, then mount this as /tmp.
So, I tried:
dd if=/dev/zero of=tmp16.img bs=16M count=0 seek=1024
mkfs.ext3 ./tmp16.img
fdisk -l ./tmp16.img
e2label ./tmp16.img tmp16
So far, so good - all of that worked; but then I try to mount:
$ sudo mount -o remount /path/to/ntfs/tmp16.img /tmp
mount: /tmp: mount point not mounted or bad option.
Ups, must be an old memory of mine from somewhere, that /tmp
is a separate mount - it turns out, on this machine, /tmp
is not a separate mount:
$ mount | grep tmp
udev on /dev type devtmpfs (rw,nosuid,noexec,relatime,size=3970256k,nr_inodes=992564,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=802768k,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
tmpfs on /run/snapd/ns type tmpfs (rw,nosuid,nodev,noexec,relatime,size=802768k,mode=755)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=802764k,mode=700,uid=1000,gid=1000)
tmpfs on /run/netns type tmpfs (rw,nosuid,nodev,noexec,relatime,size=802768k,mode=755)
Well ... is there any way that I can use this disk image as /tmp
on this machine - and is there a way to do that, without having to reboot the machine (which would be needed, I think, if something has to be done int /etc/fstab
?)
If not, is there any other way I could make use of the available NTFS space and use it as /tmp
- preferably, without having to reboot the machine?
TMPDIR
prior to running it. Unfortunately I don’t see a lot of scripts that are this well written.truncate -s 1G /tmp/1gb.img; mkfs.ext4 /tmp/1gb.img; sudo mount -o loop /tmp/1gb.img /tmp/junk
. runls /tmp/junk
again, all you'll see is thelost+found
dir./tmp
is relatively safe.