postinit script changing kernel parameter "fdrive"
-
Hi,
I would like to change the Host Primary Disk at postinit script. For example from the Web UI, configura as /dev/sda but during capture or deploy I would like to change it to /dev/sdb at postinit script. May i know how can i achieve this?
Currently i’m trying with editing /proc/cmdline. Is this the right way to edit the kernel parameter or is there any better alternate ways?
cat /proc/cmdline > /root/cmdline ##replace /root/cmdline content with new fdrive location --> in progress creating the replace script mount -n --bind -o ro /root/cmdline /proc/cmdline
-
@wt_101 AFAK you can’t edit the kernel invocation line. That should be a read only attribute. You can only change it before bzImage boots.
-
@george1421 said in postinit script changing kernel parameter "fdrive":
before
May i know where can i made the changes? It can be done at postinit script too?
-
@wt_101 said in postinit script changing kernel parameter "fdrive":
May i know where can i made the changes?
This is difficult to answer. Because when you pick an FOG iPXE menu item or pxe boot into imaging, bzImage and init.xz are transferred to the target computer and then booted. When bzImage is launched it is passed certain kernel parameter which when booted become /proc/cmdline. The /proc file system is not a real file system, but a logical file system created in the kernel’s memory so you can’t change things from the user space in it.
So why don’t you change, in the host definition for these hosts, there is a field called primary disk which defaults to a blank field. Why not just place /dev/sdb in that primary disk field. That way when that host is booted into imaging, it sends /dev/sdb as a kernel parameter?
-
@george1421 said in postinit script changing kernel parameter "fdrive":
AFAK you can’t edit the kernel invocation line.
@WT_101 While I think George is right on this part I can still see how you might achieve what you want to do by overwriting the fdrive variable within a postinit script. The postinit script is being sourced (ref) instead of called (subshell).
This is just from brain to keyboard and I have not done any testing. Give it a try and see…