You are not logged in.
I've been taking a stab at making tmpfs ramdisks on a Devuan virtual machine.
Here is my setup in /etc/fstab
ramdisktmp /tmp tmpfs rw,discard,noatime,nosuid,noexec,nodev,mode=1777,size=2G 0 0
ramdiskrun /run tmpfs rw,discard,noatime,nosuid,noexec,nodev,mode=1777,size=2G 0 0
ramdiskvarlock /var/lock tmpfs rw,discard,noatime,nosuid,noexec,nodev,mode=1777,size=2G 0 0
ramdiskvarrun /var/run tmpfs rw,discard,noatime,nosuid,noexec,nodev,mode=1777,size=2G 0 0
ramdisktmp /dev/shm tmpfs rw,discard,noatime,nosuid,noexec,nodev,mode=1777,size=2G 0 0
ramdiskhome /home/johndoe/Downloads tmpfs rw,discard,noatime,nosuid,noexec,nodev,mode=1777,size=8G 0 0
I was hoping to move these directories above into tmpfs ramdisks, including my Home's downloads folder.
I tested it out by putting an empty text file in the downloads folder then reboot the VM.
But upon booting up, I found the file was still there when it should've been wiped out with the RAM.
That same Downloads folder, as I defined in the fstab file, was also visible as a mountable disk, like an external drive, on the desktop although I wasn't able to without root access.
To elaborate, although I can still access the Downloads folder in the file explorer, I can't mount it from the desktop. Whenever I do, I get the following error message.
Mount Failed
mount: only root can mount ramdiskhome on /home/johndoe/Downloads
Any help would be much appreciated.
Thanks.
Offline
You want to add a mount option to /home/johndoe/Downloads: "user" or maybe even "users."
From mount(8)
user Allow an ordinary user to mount the filesystem. The name of the mounting user is written to the mtab
file (or to the private libmount file in /run/mount on systems without a regular mtab) so that this
same user can unmount the filesystem again. This option implies the options noexec, nosuid, and
nodev (unless overridden by subsequent options, as in the option line user,exec,dev,suid).nouser Forbid an ordinary user to mount the filesystem. This is the default; it does not imply any other
options.users Allow any user to mount and to unmount the filesystem, even when some other ordinary user mounted it.
This option implies the options noexec, nosuid, and nodev (unless overridden by subsequent options,
as in the option line users,exec,dev,suid).
This space intentionally left blank.
Offline
I just added the user option to every tmpfs line, however whenever I enter mount -a in the terminal, I get this error message.
mount: wrong fs type, bad option, bad superblock on ramdisk[...],
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try dmesg | tail or so
I tried dmesg | tail and found out that it was the discard option that was stopping my tmpfs folders from being mounted so I removed them, tried mount -a again and then got this message.
mount: /run: filesystem mounted, but mount(8) failed: No such file or directory
mount: mount point /var/lock is a symbolic link to nowhere
mount: /run: filesystem mounted, but mount(8) failed: No such file or directory
mount: /dev/shm: filesystem mounted, but mount(8) failed: No such file or directory
mount: /dev/johndoe/Downloads: filesystem mounted, but mount(8) failed: No such file or directory
However, I tested each and every one of my tmpfs folders by adding an empty file into them and rebooting. They were gone from all of them once I rebooted so it looks like my ramdisk is fully working.
However, during this ordeal, I came across a couple of problems.
Whenever I tried to open /etc/fstab with nano (even with sudo) on the terminal, it opens the file but it shows up blank with a message reading Error reading lock file /etc/.fstab.spwp: Not enough data read.
Also, when inserting USB sticks used to mount them automatically, they are unmounted and clicking them in the file explorer brings up a password prompt to eject them and my user password doesn't work. It happened. I think, after I fixed the tmpfs.
My only guess is that it could be caused by OpenRC (the init software I am using), being in the experimental phase.
I also installed Devuan without any non-free or contrib software
Last edited by shiztivr (2020-04-02 09:58:45)
Offline
the discard option that was stopping my tmpfs folders from being mounted
Yeah, RAM doesn't support TRIM.
Don't apply options that you don't understand.
From mount(8):
discard
If set, causes discard/TRIM commands to be issued to the block device when blocks are freed. This is useful for SSD devices and sparse/thinly-provisioned LUNs.
So you should only use that option for SSDs that support TRIM (confirm with lsblk --discard).
Also note that /dev/shm and /run are already mounted with tmpfs by default.
I came across a couple of problems.
You should stick to a single problem per thread.
FWIW automounting of USB sticks is handled by GVFS & udisks2 via thunar (the file manager), it has nothing to do with the init system.
Brianna Ghey — Rest In Power
Offline
Have you looked in /etc/default/tmpfs?
You can set things like :-
# mount /tmp as a tmpfs. Defaults to no; set to yes to enable (/tmp
# will be part of the root filesystem if disabled). /tmp may also be
# configured to be a separate mount in /etc/fstab.
RAMTMP=yes
Geoff
Offline