Solved Crontab - Create ramdisk at launch fails.

Dogers

Member

Reaction score: 16
Messages: 50

Greetings everyone.

I want to create a memory disk for testing purpose automatically every-time I launch my FreeBSD workstation. Everything I have tried has failed. But it comes probably from me since I am a totally beginner at using cron. Here is what I have done until here :

-Created a folder name ramdisk.
-Added this line to my /etc/rc.conf : cron_enable="YES"
-And finally added this one to my /etc/crontab : @reboot root /sbin/mdmfs -n -p 777 -s 32G md /ramdisk

My goal is to have my ramdisk available at launch, cron maybe a way but if anyone have another way to achieve this or to fix my cron problem it would be nice !

Thanks everyone for any future responses.

PS : I am using ZFS, maybe this can be a useful infromation ...
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,969
Messages: 38,420

Don't use cron for this. Just add this to fstab:
Code:
md /ramdisk mfs rw,mode=777,-s32G	2 0
Don't create a filesystem with 777 permissions though. That's asking for trouble. Set some proper permissions on it.

Added this line to my /etc/rc.conf : cron_enable="YES"
cron(8) is enabled by default.

And finally added this one to my /etc/crontab
Don't edit or modify /etc/crontab, this might cause problems with upgrades as it has to merge your changes with any potential upgrade changes. Use crontab -e to add to root (or some other user) own crontab.
 

tux2bsd

Active Member

Reaction score: 38
Messages: 153

Probably still relevant:
 
OP
Dogers

Dogers

Member

Reaction score: 16
Messages: 50

Thank you for your quick responses.
Indeed mounting filesystem with 777 permission prevented my rig to boot. I just modified the line to this :

md /ramdisk mfs rw,-s32g 2 0

I also reverted the modification done to crontab. Everything works as intended now, problem solved !
 
Top