Yosemite + RAM disk issue

Discussion in 'OS X Yosemite (10.10)' started by vladdych, Jan 5, 2015.

  1. vladdych macrumors newbie

    Joined:
    Jan 5, 2015
    #1
    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
     
  2. vladdych thread starter macrumors newbie

    Joined:
    Jan 5, 2015
    #2
    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.
     
  3. bxs, Jan 6, 2015
    Last edited: Jan 6, 2015

    bxs macrumors 6502

    Joined:
    Oct 20, 2007
    #3
    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.
     
  4. vladdych thread starter macrumors newbie

    Joined:
    Jan 5, 2015
    #4
    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.
     

Share This Page