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

Quick to answer questions about finding your way around Linux Mint as a new user.
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. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
DavidGX

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

Post by DavidGX »

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?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29510
Joined: Wed Jul 06, 2011 3:58 am

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

Post by xenopeek »

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.
Image
RudeViper

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

Post by RudeViper »

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
User avatar
xenopeek
Level 25
Level 25
Posts: 29510
Joined: Wed Jul 06, 2011 3:58 am

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

Post by xenopeek »

That wasn't a command I shared, that was the line of text you were to add to the file /etc/fstab.
Image
Locked

Return to “Beginner Questions”