Last active
August 29, 2015 14:01
-
-
Save manhg/0d2da599e75e060ca1e2 to your computer and use it in GitHub Desktop.
RAM Disk, SSD tuning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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