Skip to content

Instantly share code, notes, and snippets.

@manhg
Last active August 29, 2015 14:01
Show Gist options
  • Save manhg/0d2da599e75e060ca1e2 to your computer and use it in GitHub Desktop.
Save manhg/0d2da599e75e060ca1e2 to your computer and use it in GitHub Desktop.
RAM Disk, SSD tuning
#!/bin/bash
# Optimize performance by using RAM disk
# Espcially improve life for SSD
# Disable access time
mount -vuwo noatime /
# Create RAM disk
ramfs_size_mb=256
mount_point=/ram
ramfs_size_sectors=$((${ramfs_size_mb}*1024*1024/512))
ramdisk_dev=`hdid -nomount ram://${ramfs_size_sectors}`
newfs_hfs -v 'Ram' ${ramdisk_dev}
mount -o rw,noatime -t hfs ${ramdisk_dev} ${mount_point}
mkdir /ram/{log,tmp,user_cache}
# Create a skeleton
# Move all logs files here
chmod 777 /ram/{log,tmp}
chown your_name:staff /ram/user_cache
chmod 770
# Move user files cache there
rm -R /Users/your_name/Library/Caches
ln -s /ram/user_cache /Users/your_name/Library/Caches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment