[PC-BSD Dev] Wild idea to speed up boot process
claudio at hpgcc3.org
Fri Aug 9 11:00:27 PDT 2013
Would it be possible to implement something like this?
1) Early during boot, create a RAM disk (mdconfig)
2) Read it in whole with dd from a file in the root file system.
3) Union mount this ramdisk over root.
This ramdisk should of course contain all files needed during the boot
process (but only the files needed for boot, not the whole root file
system), acting as a ram cache.
Since it's written in one big file, it can be restored at sustained read
speeds, avoiding random reads and the overhead of the filesystem.
Once it's in RAM, any file that exists in this ram disk would be used
instead of the underlying root file system.
On system shutdown, or actually as soon as boot process is finished,
this ramdisk can be dumped back to disk, to preserve any changes.
All we would need is some hook to detect which files are read during
boot, and copy them to the ram disk on the fly if they are not already
The union mount will automatically write the file to the ram disk if
it's modified, but 99% of the boot files will be read only during normal
We need some kind of service that monitors changes on any file that is
present in the ram disk, and dump those files back into the root file
system when the system shuts down (just to keep the ram disk in sync
with root), or better off, modify the 'union' to actually write to both
file systems, not just the top.
I think this should speed up the boot process noticeably. We can define
when the system is considered "booted". For example we can extend it
until the user logs on to the desktop and all applications are loaded.
A full desktop takes about 512 MB of ram, and that counts the ram needed
to run the programs and disk caches, so I'm thinking a 512 mb ram disk
should be able to fit all the executables and files needed for boot.
A normal hard disk can read 120 MB/s sustained, and an SSD around 500
MB/s, so we can have everything needed for boot in RAM in about 4 seconds.
Any comments / ideas?
More information about the Dev