Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

vladdych

macrumors newbie
Original poster
Jan 5, 2015
4
0
Today i've tried to make ramdisk automatically created while booting.
I've taken script from one of sites, which google gives me:

Code:
#!/bin/bash
ramfs_size_mb=2048
mount_point=/private/tmp

ramfs_size_sectors=$((${ramfs_size_mb}*1024*1024/512))
#ramdisk_dev=`/usr/bin/hdid -nomount ram://${ramfs_size_sectors}`
ramdisk_dev=`hdik -drivekey system-image=yes -nomount ram://${ramfs_size_sectors}`
/sbin/newfs_hfs -v 'ramdisk' ${ramdisk_dev}
/bin/mkdir -p ${mount_point}
/sbin/mount -o union,nobrowse,noatime -t hfs ${ramdisk_dev} ${mount_point}
/usr/sbin/chown root:wheel ${mount_point}
/bin/chmod 1777 ${mount_point}

script works excellent, if i launch it from root. then i've added .plist in launchd, in order to start script at boot. after rebooting i've discovered that ramdisk didn't created.

few minutes passed, and i've discovered that script are started, ramdisk are created and mounted, but after 10 seconds after ramdisk mounting, it was unmounted by unknown yosemite system program. i see this in system.log, but cannot determine who is unmounting my ramdisk. i've tried to disable automountd, but nothing was changed.

please help
 

vladdych

macrumors newbie
Original poster
Jan 5, 2015
4
0
i've inserted 'sleep 10' at beginning of script, and currently it works. but this is not a very good solution, so question is open.
 

bxs

macrumors 65816
Oct 20, 2007
1,150
529
Seattle, WA
Does the system.log display/indicate the PID in the unmount message ? If so, maybe the PID would help identify the culprit. Just a thought.

I wonder if the boot process 'flushes' /private/tmp early on and after your script runs... ????? The 'sleep 10' tells me something like this is going on and there's a timing issue affecting when your script executes. If the 'sleep 10' is working for you I'd leave it that way for time being.
 
Last edited:

vladdych

macrumors newbie
Original poster
Jan 5, 2015
4
0
system.log just displays standard message from umount, without any information about calling process. 'sleep 10' helps, because umount-calling process started after my script. i need to identify this process, but currently don't know how to do this.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.