Created
July 1, 2013 08:17
-
-
Save kylemanna/5899179 to your computer and use it in GitHub Desktop.
Ubuntu SSD dm-cache upstart tasks. Place these files in /etc/init to setup and teardown cache. See http://blog.kylemanna.com/linux/2013/06/30/ssd-caching-using-dmcache-tutorial/
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
description "Suspend dmcache for SSD cache" | |
author "Kyle Manna <[email protected]>" | |
# Start monitoring with inotifywait (will block) after the filesystem is | |
# mounted, when the filesystem is unmounted, teardown the dm devices. | |
start on mounted MOUNTPOINT=/mnt/other | |
script | |
inotifywait -e unmount $MOUNTPOINT | |
dmsetup suspend home-cached | |
dmsetup remove home-cached | |
dmsetup remove ssd-blocks | |
dmsetup remove ssd-metadata | |
end 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
description "Configure dmcache for SSD cache" | |
author "Kyle Manna <[email protected]>" | |
# This would be handy, but it assumes the source device is already | |
# available, which in this case it isn't. | |
#start on mounting MOUNTPOINT=/mnt/other | |
# Run after /proc and /dev are finalized | |
start on virtual-filesystems | |
task | |
script | |
# Setup the /dev/mapper/home-cached entity so that mountall will automount it after reading fstab | |
dmsetup create ssd-metadata --table '0 19730 linear /dev/disk/by-id/scsi-SATA_OCZ-AGILITY2_f2d200034-part6 0' | |
dmsetup create ssd-blocks --table '0 189008622 linear /dev/disk/by-id/scsi-SATA_OCZ-AGILITY2_f2d200034-part6 19730' | |
dmsetup create home-cached --table '0 1048576000 cache /dev/mapper/ssd-metadata /dev/mapper/ssd-blocks /dev/vg0/spindle 512 1 writeback default 0' | |
dmsetup resume home-cached | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment