-
-
Save shoeper/63d3002df11f2156a988 to your computer and use it in GitHub Desktop.
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=/media/usb1 | |
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=/media/usb1 | |
# 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 20480 linear /dev/disk/by-id/scsi-SATA_KINGSTON_SV300S50026B774108482C-part1 0' | |
dmsetup create ssd-blocks --table '0 104857600 linear /dev/disk/by-id/scsi-SATA_KINGSTON_SV300S50026B774108482C-part2 0' | |
dmsetup create hdd-cached --table '0 1953118377 cache /dev/mapper/ssd-metadata /dev/mapper/ssd-blocks /dev/disk/by-id/usb-TOSHIBA_External_USB_3.0_231843245107-0:0-part1 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