Skip to content

Instantly share code, notes, and snippets.

@hryamzik
Last active March 24, 2016 12:59
Show Gist options
  • Select an option

  • Save hryamzik/0f7daa78dbef664201b3 to your computer and use it in GitHub Desktop.

Select an option

Save hryamzik/0f7daa78dbef664201b3 to your computer and use it in GitHub Desktop.
sudo aptitude update && sudo aptitude install -y build-essential checkinstall git dkms
git clone -b stable_v3.1.1 https://github.com/facebook/flashcache.git
cd flashcache
sudo make -f Makefile.dkms
sudo cp -v ./utils/flashstat /usr/sbin/
hdd=sda3
ssd=sdb
sudo tee /etc/init/flashcache.conf <<EOF
# flashcache - flashcache enabler
#
description "Reenable writeback cached drives"
start on starting mountall
task
script
/sbin/flashcache_load /dev/${ssd:-sdb}
end script
EOF
# sudo flashcache_destroy /dev/$ssd
sudo flashcache_create -p back cachedev /dev/$ssd /dev/$hdd
sudo tee -a /etc/sysctl.d/30-flashcache.conf <<EOF
dev.flashcache.${ssd:-sdb}+${hdd:-sda3}.fast_remove = 1
EOF
sudo sysctl dev.flashcache.${ssd:-sdb}+${hdd:-sda3}.fast_remove=1
cat /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf
file=/etc/lvm/lvm.conf
test -f ${file}.orig || sudo cp -v $file ${file}.orig
sudo sed -Ei "$(($(grep -En "^\s*filter =" $file|cut -d : -f 1) +1)) i \
\ filter = [ \"r|/dev/${hdd:-sda3}|\" ]
" $file
sudo sed -Ei "0,/^\s*filter/{s/(^\s*)(filter.*)$/\1# \2/}" $file
sudo update-initramfs -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment