How to mount Cygwin's /tmp on usertemp?

0

I've add this line to my /etc/fstab, taken from Cygwin's user guide, section 3.1.5:

none /tmp usertemp binary,posix=0 0 0

However, I get an error trying to mount it:

# mount /tmp
mount: /tmp: Invalid argument

Both TMP and TEMP env vars point to /cygdrive/r/tmp (which is on a RAM drive) I can do mount r:/tmp /tmp without a problem, I just figured using usertemp would be desirable to avoid hardcoding the temp dir.

For the time being, I'm using this line in my fstab:

R:/tmp /tmp ntfs binary,posix=0  0 0

What's the reason it's not working?

Gene Pavlovsky

Posted 2016-04-18T17:00:34.233

Reputation: 356

What's happen if you use a windows style TEMP=R:\TMP ? – matzeri – 2016-04-22T15:11:17.793

They are like that. But Cygwin converts them to UNIX-style automatically. From cmd shell: C:\Users\root>set | grep TMP returns TMP=R:\tmp, but C:\Users\root>env | grep TMP returns TMP=/mnt/r/tmp. – Gene Pavlovsky – 2016-04-22T21:11:02.027

Answers

2

I guess is not very clear from the documentation. The steps are:

edit /etc/fstab 
close all cygwin processes
restart cygwin

With that

$ cat /etc/fstab
..
none /tmp usertemp binary,posix=0 0 0

$ mount
...
C:/Temp on /tmp type ntfs (binary,posix=0,usertemp)
...

matzeri

Posted 2016-04-18T17:00:34.233

Reputation: 1 662

That's what I did when I tried the first time. But this time it worked, for some reason. By the way what do you mean by restarting cygwin? After I closed all cygwin processes, is there anything left running that should be restarted? – Gene Pavlovsky – 2016-04-26T16:15:43.570

1@Gene-Pavlovsky : nothing else if you closed all process including services. – matzeri – 2016-04-26T17:37:01.613

Right, I remembered that but it's good to mention. Sometimes when update cygwin it complains dll can't be updated because of running processes. That's the time to remember that I have sshd and cron services (go to Windows services and stop them). – Gene Pavlovsky – 2016-04-28T10:49:22.637