RAM disk fstab entry

Need support for GhostBSD. Ask here if your question does not fit elsewhere.
Post Reply
tudi
Posts: 2
Joined: Sat Feb 24, 2024 12:26 pm

RAM disk fstab entry

Post by tudi »

hi All,
trying to get my feet wet with v.24.01.1, just installed.
on Linux I have a RAM disk entry with

Code: Select all

sudo mkdir /mnt/tmpfs.ramdisk
# and in fstab
tmpfs   /mnt/tmpfs.ramdisk  tmpfs  nodev,nosuid,nodiratime,size=500M 0  0
could you please advise what would be the equivalent in Ghost BSD?
already tried:

Code: Select all

/sbin/mdmfs -M -S -o async -s 500m md5 /diskmnt
thank you
wb7odyfred
Posts: 206
Joined: Sat Nov 12, 2016 5:44 pm

Re: RAM disk fstab entry

Post by wb7odyfred »

google freebsd ramdisk see what you find.
maybe need to add a line or two in file /etc/rc.conf to create a ram disk.
https://forums.freebsd.org/threads/free ... how.91574/
https://forums.freebsd.org/threads/ques ... bsd.20345/
chadbsd
Posts: 26
Joined: Thu Oct 05, 2023 8:53 pm

Re: RAM disk fstab entry

Post by chadbsd »

In GhostBSD, which is based on FreeBSD, the approach to creating and using RAM disks is quite similar to Linux but with some differences in the commands and configuration files used. The `tmpfs` filesystem type is also supported in FreeBSD, making the transition easier.

Here's how you can achieve the equivalent setup in GhostBSD:

1. Creating the Mount Point: The command to create a mount point remains the same. You can use:

sudo mkdir /mnt/tmpfs.ramdisk


2. Adding an Entry to /etc/fstab: The format for the `/etc/fstab` file in FreeBSD (and by extension, GhostBSD) is similar to that in Linux, but there are slight syntax differences. The equivalent entry in GhostBSD's `/etc/fstab` for your Linux `tmpfs` line would be:

tmpfs /mnt/tmpfs.ramdisk tmpfs rw,size=500M,nosuid,nodev 0 0


Key differences to note:
- The options are largely the same, but `nodiratime` is not a recognized option in FreeBSD's tmpfs. FreeBSD's tmpfs does not distinguish between access times for directories and files, so you don't need an equivalent for `nodiratime`.
- The options are comma-separated as in Linux, and the basic syntax of the fstab line is the same.
- Ensure you use `rw` to denote that the filesystem is mounted read-write.

3. Mounting the Filesystem: After adding the entry to `/etc/fstab`, you can mount all fstab entries with the following command (or just reboot):

sudo mount -a

This command mounts all filesystems specified in `/etc/fstab`, including your `tmpfs` RAM disk.

This setup should give you a RAM disk on GhostBSD that functions similarly to your Linux setup, with a size of 500MB, mounted at `/mnt/tmpfs.ramdisk`, and with no device and no set-user-ID or set-group-ID bits.
tudi
Posts: 2
Joined: Sat Feb 24, 2024 12:26 pm

Re: RAM disk fstab entry

Post by tudi »

thank you chadbsd for the detailed answer.

the entry that worked was:

Code: Select all

tmpfs /mnt/tmpfs.ramdisk tmpfs rw,size=500M,nosuid 0 0
the nodev option was identified as invalid argument on boot.
Post Reply