Can't mount RAMFS in /etc/fstab with proper permissions.

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

Can't mount RAMFS in /etc/fstab with proper permissions.

Postby DavidGX on Sun Jan 20, 2013 11:42 am

I'm fairly new to Mint, although I've dabbled with Ubuntu in the past. I can't, for the life of me, for any amount of internet searching, figure out how to set up /etc/fstab to mount a RAMFS type RAM drive on boot and have it readable/writeable by anyone but root.

I've tried with two different directories, /media/ramdisk and /ramdisk. I made the directories first, did "sudo chown /directory/here username:username" and the folders showed the proper permissions, great. But if I add RAMFS to the /etc/fstab it always becomes root access only when it mounts the RAM drive. I've tried many, many different configurations and variations of the fstab entry, including my newest one "ramfs /ramdisk ramfs defaults 0 0" but that doesn't work, none of them do. I've tried mounting THEN using chown, nothing. I've tried letting /etc/fstab mount it for me THEN using chown, again, nothing.

What am I doing wrong?
DavidGX
Level 1
Level 1
 
Posts: 1
Joined: Sun Jan 20, 2013 11:34 am

Linux Mint is funded by ads and donations.
 

Re: Can't mount RAMFS in /etc/fstab with proper permissions.

Postby xenopeek on Sun Jan 20, 2013 12:35 pm

I'm not familiar with ramfs, but reading this makes me think it isn't what you want. If you want a temporary fle system, mounted in memory and writable by normal users, then use tmpfs. On the manpage for mount ("man mount") you can find that ramfs has no mount options, while tmpfs has option to set its size and mode, amongst others. See the manpage for more details.

As an example, let's create a directory /mnt/ramdisk:
Code: Select all
sudo mkdir /mnt/ramdisk

Then let's add a line to /etc/fstab (edit it as root) to add a 1 GiB tmpfs on which normal users can write files:
Code: Select all
none /mnt/ramdisk tmpfs nodev,nosuid,size=1Gi,mode=1777 0 0

The nodev and nosuid are a security measure, meaning only normal files will be allowed. The size sets the maximum size, with it dynamically growing up to that size as needed. The mode sets the same mode as the /tmp directory, which allows all users access to it. More details on these in the aforementioned manpage.

Finally, activate your new mount:
Code: Select all
sudo mount -a

Now you have 1 GiB temporary file system, mounted in memory and writable by normal users, located at /mnt/ramdisk. It won't show up in your file browser as a separate file system. If you want that, replace /mnt with /media instead and the file browser will treat it as a removable storage device.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14554
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Can't mount RAMFS in /etc/fstab with proper permissions.

Postby RudeViper on Fri Apr 12, 2013 1:23 pm

Something is wrong with the command you said to use....

Code: Select all
 $ none /media/ramdisk tmpfs nodev,nosuid,size=2.5Gi,mode=1777 0 0
No command 'none' found, did you mean:
 Command 'nona' from package 'hugin-tools' (universe)
 Command 'one' from package 'opennebula' (universe)
 Command 'note' from package 'note' (universe)
 Command 'cone' from package 'cone' (universe)
 Command 'node' from package 'node' (universe)
 Command 'node' from package 'nodejs-legacy' (universe)
none: command not found
System Specs:
Windows Machine: AMD Dual Core Regor x215/4GB RAM/Windows 7
LinxMint Server: Intel P4 3.0 Ghz-3gb Ram - Linux Mint 15 32 bit
RudeViper
Level 1
Level 1
 
Posts: 5
Joined: Tue Feb 05, 2013 3:14 pm
Location: Micco, FL USA

Re: Can't mount RAMFS in /etc/fstab with proper permissions.

Postby xenopeek on Fri Apr 12, 2013 1:40 pm

That wasn't a command I shared, that was the line of text you were to add to the file /etc/fstab.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14554
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands


Return to Newbie Questions

Who is online

Users browsing this forum: acw89, annie, Bing [Bot], eduardogriff, jack0987, JoeBingo, palo and 40 guests