Linux: Whether you’re running a fast-booting, SSD-equipped netbook or you want to quicken your old computer’s startup, free command line tool E4rat will seriously decrease your boot time. Here’s how to set it up.
As you may know, the files on your computer are usually spread all over the physical drive itself. When your computer looks for the files it needs to boot, it usually has to scan all over the drive to find them. This takes awhile, and contributes to a good percentage of your boot time. E4rat is a tool that will log which files you access in the first two minutes of booting, put them in order on your disk, and preload them so it can read the files much, much quicker.
The process of getting it up and running takes three steps: collecting information about your startup, reallocating the files, and then setting them to preload on each boot. Note that your disk needs to be formatted in Ext4 for this to work.
Step 1: Collect
After installing E4rat, reboot your computer and wait for the GRUB menu to pop up. When it does, highlight your Linux partition and hit the “e” key to edit the configuration. Search for the kernel line, which varies a bit on everyone’s system, but should look something like this:
kernel /vmlinuz26 root=/dev/disk/by-uuid/bf1d191b-0f0d-4961-bd67-4d023a2e5873 ro
And add init=/usr/sbin/e4rat-collect
to the end of the line, so it reads:
kernel /vmlinuz26 root=/dev/disk/by-uuid/bf1d191b-0f0d-4961-bd67-4d023a2e5873 ro init=/usr/sbin/e4rat-collect
Then hit Ctrl+X to continue booting. If you prefer, instead of doing this all from GRUB, you could edit your GRUB configuration file directly (/boot/grub/grub.cfg
for GRUB2 users) from your desktop, and add the init line there. Just make sure you remember to remove the init
line after completing step 1.
What this does is run the E4rat collector for this boot only. The collector monitors everything that happens within the first two minutes of your startup. So, for the purposes of collecting the right files, act as you normally would when you boot. For example, if the first thing you do when you boot up your computer is open your browser and mail client, do that after you finish booting here. It’ll move those files too so those programs launch extra quickly. Once your two minutes are up, you can stop “acting”. To double-check if it worked, check to see if a startup.log
file exists in /var/lib/d4rat/startup.log
. If it does, everything went according to plan and you can proceed to step 2.
Step 2: Reallocate
Next, reboot your computer and edit your Linux boot entry again by highlighting it and hitting “e”. This time, add the word single
to the end of your kernel line:
kernel /vmlinuz26 root=/dev/disk/by-uuid/bf1d191b-0f0d-4961-bd67-4d023a2e5873 ro single
It should reboot you into a command line (if you get a blue screen, pick the option to boot as normal) and you can log in using your username and password. Once there, run the following command:
sudo e4rat-realloc /var/lib/e4rat/startup.log
This will move all your startup-necessary files to the same area of the drive for quick access. It can take a little while, so just let it run. When you’re done, reboot and finish up with step 3.
Step 3: Preload
The last step is to tell your machine to preload those files every time you boot. So edit your GRUB2 configuration file by running:
sudo nano /boot/grub/grub.cfg
GRUB legacy users will want to edit menu.lst instead of grub.cfg. Then, head back to that kernel line you edited before and add this init to the end:
init=/usr/sbin/e4rat-preload
Save the file and close it. Now, when you reboot, you should notice that you boot and start up your first few apps super quickly — I was up and running Firefox in nearly half the time on my netbook, and some users are even reporting boot times up to three times faster. Note that you may have to add this line to your grub.cfg
again whenever the kernel updates. Head to the link below to check it out, and let us know what kind of improvement you see in the comments.
E4rat is a free download for Linux only. Ubuntu users can grab a .deb file at the link below for easy installation; other users will probably have to compile from source.
E4rat [via One Thing Well]
Leave a Reply
You must be logged in to post a comment.