Last active
October 16, 2022 10:56
-
-
Save xawos/a89c3351957506323e648db19168da63 to your computer and use it in GitHub Desktop.
Rapiddisk RAM cache for Raspberry Pi USB2 disk
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
Raspberry Pi Rapiddisk Network Disk | |
Quick install script incuded ;) | |
This setup assumes you're running a Debian/Ubuntu OS on your Rpi/PC. | |
Also I assume you have a device on /dev/sda that want to cache with a bit of RAM. | |
Hack as needed. |
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 | |
### BEGIN INIT INFO | |
# Provides: rapiddisk | |
# Required-Start: kmod udev | |
# Required-Stop: kmod udev | |
# Should-Start: | |
# Should-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Rapiddisk | |
# Description: Rapiddisk 256M RAM cache for USB2 disk | |
### END INIT INFO | |
PATH=/sbin:/bin:/usr/sbin:/usr/bin | |
DAEMON_SBIN=/sbin/rapiddisk | |
NAME=rapiddisk | |
DESC="RAM cache for USB2 disk" | |
[ -x "$DAEMON_SBIN" ] || exit 0 | |
. /lib/lsb/init-functions | |
case "$1" in | |
start) | |
log_daemon_msg "Starting $DESC" "$NAME" | |
rapiddisk --attach 256 | |
rapiddisk --cache-map rd0 /dev/sda | |
rapiddisk --list | |
mount /dev/rc-wt_sda /mnt/storage | |
log_end_msg "$?" | |
;; | |
stop) | |
log_daemon_msg "Stopping $DESC" "$NAME" | |
sync && umount /mnt/storage | |
rapiddisk --cache-unmap rc-wt_sda | |
rapiddisk --detach rd0 | |
log_end_msg "$?" | |
;; | |
reload) | |
log_daemon_msg "Reloading is not supported. Maybe restart?" | |
log_end_msg "$?" | |
;; | |
restart|force-reload) | |
$0 stop | |
sleep 10 | |
$0 start | |
;; | |
status) | |
status_of_proc "$DAEMON_SBIN" "$NAME" | |
exit $? | |
;; | |
*) | |
N=/etc/init.d/$NAME | |
echo "Usage: $N {start|stop|restart|force-reload|reload|status}" >&2 | |
exit 1 | |
;; | |
esac | |
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
#!/bin/bash | |
apt install libjansson-dev build-essential git | |
git clone https://github.com/pkoutoupis/rapiddisk.git | |
cd rapiddisk/ | |
make | |
sudo make install | |
sudo make tools-install | |
echo "rapiddisk" > /etc/modules-load.d/rapiddisk | |
echo "rapiddisk-cache" >> /etc/modules-load.d/rapiddisk | |
echo "dm_mod" >> /etc/modules-load.d/rapiddisk | |
echo "dm_crypt" >> /etc/modules-load.d/rapiddisk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment