Created
May 14, 2014 09:16
-
-
Save basilfx/7af7dc30cdc2a0001f92 to your computer and use it in GitHub Desktop.
Flashcache Upstart script
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/sh | |
# $2 is the /dev/mapper/IDENTIFIER | |
# $3 is the name of the cache, as specified by Flashcache | |
# Tune parameters | |
sysctl -w "dev.flashcache.$3.fallow_delay=3600" | |
sysctl -w "dev.flashcache.$3.dirty_thresh_pct=80" | |
# Verify disk structure | |
/sbin/fsck -y -f "/dev/mapper/$2" | |
# Mount it | |
/bin/mount -t ext4 -o rw,nodiratime,noatime,acl "/dev/mapper/$2" "/mnt/cache" | |
# Done | |
exit 0 |
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
/dev/mapper/Ubuntu-cache--ssd cache Ubuntu-cache--ssd+cache-hdd |
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
# flashcache - load flashcache devices and configure them | |
# | |
# This helper scans the drives and starts the scripts on /etc/flashcache. The | |
# name of the files are <cachedev>.start and <cachedev>.stop, and require the | |
# files to be executable. | |
description "load flashcache device" | |
start on started udev | |
kill timeout 60 | |
task | |
script | |
# Make sure the kernel module is loaded | |
/sbin/modprobe flashcache || exit 1 | |
# Load each flashcache defined | |
cat /etc/flashcache/caches | while read P N S | |
do | |
if /sbin/flashcache_load "$P"; then | |
exec /etc/flashcache/$N.start "$P" "$N" "$S" || true | |
echo "Loaded flashcache device from $P" | |
fi | |
done | |
# Add little sleep for caches to come up | |
sleep 1 | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment