Created
March 25, 2014 00:42
-
-
Save PeloNZ/9752848 to your computer and use it in GitHub Desktop.
ssd caching setup for ubuntu
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
= ssd cache setup= | |
I got a new pc with an SSD and a spinner disk. Having to decide exactly what I think I needed on the SSD was hard. Why not try using it as a caching device? | |
==Why use ssd caching?== | |
* Intel's "Smart Response Technology" on Windows 7 is awesome | |
* SSD wear can be reduced | |
* The ssd use can be optimized automagically | |
* No compromise on free space on ssd vs empty space on hdd | |
===What runs slow normally for me?=== | |
* git commands with large repos | |
* database restores, installs, and bulk changes | |
==Caching software options:== | |
* no linux driver for Intel SRT | |
* flashcache - by Facebook | |
* dm-cache | |
* bcache | |
===Why flashcache?=== | |
* packaged for Ubuntu 13.10 | |
* can be setup without wiping data | |
==Setup== | |
===install Ubuntu=== | |
* install Ubuntu on to the hdd, with your preferred partitions | |
* after install, create ext4 partition on SSD - I used the whole drive | |
* If you want multiple HDD partitions cached, create a cache partition on the SSD for each one | |
* don't mount the ssd | |
===Setup flashcache=== | |
This can be done without needed a fresh install. | |
* apt-get install flashcache-utils flashcache-dkms | |
* BACKUP /home partition first (or the other directorys that you want cached) | |
* logout | |
* Ctrl + Alt + F1 | |
* Login with your username | |
* Become root | |
sudo su | |
* set a password for root | |
passwd | |
exit | |
exit | |
* Login as root. Use root as username and the password you just set | |
* Stop Lightdm | |
service lightdm stop | |
* Now you can umount /home | |
umount /home | |
* build the flashcache partition | |
flashcache_create -p back fcache_home /dev/(MOUNT POINT OF /home) /dev/disk/by-uuid/(UUID OF SSD) | |
change /etc/fstab so /home uses flashcache | |
* comment out the current mount point for /home | |
* add the following lines | |
# Flashcache home_cached | |
/dev/mapper/fcache_home /home ext4 noatime,nodiratime,discard 0 0 | |
* reboot | |
===Test flashcache=== | |
test flashcache is working | |
sudo dmsetup status | |
fcache_home: 0 123456789 flashcache stats: ... | |
see /home mounted to fcache_home | |
df -h | grep home | |
/dev/mapper/fcache_home 444G 146G 276G 35% /home | |
=== Cache some more stuff === | |
Oh yeah, I wanted databases cached too! | |
move the postgres data directory | |
sudo mkdir /home/pgdata | |
sudo chown postgres:postgres /home/pgdata | |
cd /var/lib/postgresql/9.1/main | |
mv main main.old | |
ln -s /home/pgdata main | |
chown -h postgres:postgres main | |
move the mysql data directory | |
sudo mkdir /home/mydata | |
sudo chown mysql:root /home/mydata | |
cd /var/lib/mysql | |
mv mysql mysql.old | |
ln -s /home/mydata mysql | |
chown -h mysql:root mysql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment