login
Header Space

 
 

Re: Putting partition in RAM

Previous thread: Re: rouge IPs / user by Unix Fan on Friday, December 7, 2007 - 5:05 pm. (2 messages)

Next thread: Re: Putting partition in RAM by Gilbert Fernandes on Friday, December 7, 2007 - 7:29 pm. (9 messages)
To: <misc@...>
Date: Friday, December 7, 2007 - 5:57 pm

Hello,

I want to put my /tmp partition in RAM and I got the following example  
from the fstab's man page:

swap /tmp mfs rw,nodev,nosuid,-s=153600 0 0

The problem is that I don't want to have any swap in RAM, only my /tmp  
partition so I'm wondering if I simply remove the "swap" entry from  
that line if that would work?

Sorry for asking here before trying it but I only have remote access  
to the server so if I take off that swap entry from the line and it  
doesn't work then I have no way of accessing my server so I just want  
to make sure that I can do this and when I reboot my system everything  
will come up just fine.

Thanks,
- Jake
To: Jake Conk <jake.conk@...>
Cc: <misc@...>
Date: Friday, December 7, 2007 - 6:22 pm

No, that first entry has to be there. But it does not mean what you
think it means, it has nothing to do with swap in (to?) RAM. Read
mount_mfs(8) for details.
To: Jake Conk <jake.conk@...>
Cc: <misc@...>
Date: Friday, December 7, 2007 - 6:18 pm

technically, swap is never on memory. swap is memory written
to the disk (when data is in memory it is either used or cache)

what you wrote is the correct way to create a partition in
memory (i do the same for my swap, the difference is my disk
is one 1 gb / and 95 Gb cgd disk but it is just for the fun
of doing it, i am not yet that paranoid...)

i suggest you to keep the swap entry. on bsd systems it wont be
used that much, and when it does you have usually trouble on your
hands (your mileage and size of flames coming from the server
might vary).

if you are worried and paranoid, you can create a partition,
mounted on each boot with a random key for your swap and tmp and
that key will be forgotten on each reboot and a new random one
used.

keep the swap entry. the /tmp one is good and that's how
you create one to put your /tmp in memory.

-- 
unzip ; strip ; touch ; grep ; find ; finger ; mount ; fsck ; more ;
yes ; fsck ; umount ; sleep
To: <misc@...>
Date: Friday, December 7, 2007 - 7:06 pm

Ok so I added that entry and it worked fine except for one problem and  
that is root only had permissions to write to that directory so some  
services did not start up properly. I then gave the /tmp directory  
0777 with chmod and rebooted my machine but it set it back to rwxr-xr- 
x...

How do I have it so that anyone can write to the directory when the  
computer starts up?

Thanks,
- Jake
To: Jake Conk <jake.conk@...>
Cc: <misc@...>
Date: Friday, December 7, 2007 - 7:31 pm

The answer to your question is in "man mount_mfs":
     "If the -P file option is not used,
     the owner and mode of the created mfs file system will be
     the same as the owner and mode of the mount point."

In other words, there is an entry for /tmp on the / filesystem, and
when the new swap filesystem is mounted, it inherits the permissions
of the original base /tmp entry.

So you need to chmod the underlying /tmp entry in the root filesystem,
then the change will stick.  Simplest way to do this is boot single
user, do the chmod, and then reboot.

Kevin
To: Gilbert Fernandes <gilbert.fernandes0902@...>
Cc: Jake Conk <jake.conk@...>, <misc@...>
Date: Friday, December 7, 2007 - 6:32 pm

To the reader: if you feel confused after reading this, this is not
your fault.  It's just a lot of bad and confusing advice. 

	-Otto
Previous thread: Re: rouge IPs / user by Unix Fan on Friday, December 7, 2007 - 5:05 pm. (2 messages)

Next thread: Re: Putting partition in RAM by Gilbert Fernandes on Friday, December 7, 2007 - 7:29 pm. (9 messages)
speck-geostationary