Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: script for initramfs to init rapiddisk on boot and/or use it for boot volume #38

Open
Shub77 opened this issue Jul 23, 2019 · 3 comments

Comments

@Shub77
Copy link
Contributor

commented Jul 23, 2019

Hi,
since I wanted to use rapiddisk for my boot partition/volume, I wrote what was needed by initramfs to add the modules and init them, and add a cache via rapiddisk command, during boot time. There is some work to do yet, but if you're interested I can pull them someway.

Regards

@pkoutoupis

This comment has been minimized.

Copy link
Owner

commented Jul 25, 2019

I would love to see these changes. I am not entirely sure how or where they will fit and if I have any reservations, I will be sure to let you know.

@Shub77

This comment has been minimized.

Copy link
Contributor Author

commented Jul 26, 2019

Ok, I'll give you some more infos.
I wrote two (ultrasimple to be honest) scripts in respect of the initramfs-tools docs,: the first to add new/specific modules and/or executable files to the final initrd files (it is called hook script), and the second one to execute or do something at boot time (this one is called boot script), during one or more of the boot process phases.

The hook script simply instruct initramfs-tools to add (copy) the rapiddisk's modules and the rapiddisk executable itself to the final initrd file, upon update or creation of the latter; while the boot script, which is copied inside the initrd file too, is invoked during the boot process and barely execute one or more rapiddisk commands with the wanted parameters.

This way is possibile to add any cache to any drive at boot time, but it really comes in hand if you want to use rapiddisk on your root partition. Since it is not possible to add a cache on mounted filesystems, we have to do it before the / is mounted: with initramfs-tools scripts becomes possible to activate a rapiddisk cache on the boot partition before / is mounted, to take advantage of the cache on the root partition too. Something like this:

shub@gturismo:~$ lsinitramfs /boot/initrd.img-4.15.0-55-generic |grep rapiddisk
lib/modules/4.15.0-55-generic/updates/dkms/rapiddisk.ko
lib/modules/4.15.0-55-generic/updates/dkms/rapiddisk-cache.ko
sbin/rapiddisk
scripts/init-premount/rapiddisk
shub@gturismo:~$

the hook script looks something like this:

#!/bin/sh
PREREQ=""
prereqs()
{
        echo "$PREREQ"
}

case "${1}" in
prereqs)
        prereqs
        exit 0
        ;;
esac

. /usr/share/initramfs-tools/hook-functions

# Begin real processing below this line

manual_add_modules rapiddisk
manual_add_modules rapiddisk-cache
copy_exec /sbin/rapiddisk /sbin

exit 0

and the boot script something like this:

#!/bin/sh
PREREQ=""
prereqs()
{
        echo "$PREREQ"
}

case "${1}" in
prereqs)
        prereqs
        exit 0
        ;;
esac

# Begin real processing below this line

modprobe rapiddisk
modprobe rapiddisk-cache
rapiddisk --attach 300
rapiddisk --cache-map rd0 /dev/sdb3 wa

exit 0

Regards

@pkoutoupis

This comment has been minimized.

Copy link
Owner

commented Jul 28, 2019

I am trying to figure out how to make this one fit. I think it would be a good addition but does it make sense to place it in the source repository or would it make more sense to throw it into the project Wiki? I like the idea. And many have asked for something similar over the years. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.