Speeding up boot-time

Every day solutions to every day challenges. + Brilliant stuff

Moderators: b1o, jkerr82508

Forum rules
Please feel free to post your tip it does not have to be advanced. Also ask questions directly related to the tip here. But do not start new threads with questions or ask for help here. That is what the help section is for. forum rules: http://bjoernvold.com/forum/viewtopic.php?f=8&t=568
User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Speeding up boot-time

Postby viking60 » 06 May 2012, 00:40

I just knocked of a couple of seconds on my wifes laptop. It really is significant and I did not have to use the watch. I could see and feel the improvement! Everything is just snappy and fast.
The following will only improve the ext4 file system so you Raiser people need not read on. :-D
So I installed e4rat
E4rat is a utility that’s designed to cut your Linux boot time drastically. Essentially you show it what you do when you start your computer normally, and it analyzes the files you access and use. Then, it’ll move them to the beginning of your hard disk so that it takes less time to find them during boot.
If you are using SSD there will be no gain in using e4rat.

E4rat is available as a .deb package for *buntu users. Others may have to compile it from source.
Setting it up:

I edited /boot/grub/menu.lst and added

Code: Select all

init=/sbin/e4rat-collect
to the linux line.
This will only be used once so you must remove it again after one boot.
So time to reboot and e4rat will now collect what happens and move the data to the front so it starts faster - kind of defragmenting the boot process.
After two minutes you must edit /boot/grub/menu.lst again and replace

Code: Select all

init=/sbin/e4rat-collect
with

Code: Select all

init=/sbin/e4rat-preload

And check that /var/lib/e4rat/startup.log is created and contains (collected) data.

Now it is time to reallocate and that is the tricky part:
Type:

Code: Select all

sudo init 1

log in as root and type:

Code: Select all

e4rat-realloc  /var/lib/e4rat/startup.log
(remember the one you checked above :-D )
You will not be able to copy and paste this command so you better write it down before you do the init 1
This may take some time.
After that you can reboot and enjoy your Ferrari. :-D
http://lifehacker.com/5790311/e4rat-cut ... e-commands
http://software.opensuse.org/package/e4 ... term=e4rat
http://forums.debian.net/viewtopic.php?f=5&t=74774
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
gnuuser
Berserk
Posts: 449
Joined: 18 Aug 2010, 21:52
Location: northwestern Pa.
Contact:

Re: Speeding up boot-time

Postby gnuuser » 09 May 2012, 13:00

nice tip :s

anyone still using the old win 98 and dos, the best way to speed it up was how you wrote the autoexec.bat and the order of the config,sys file.((if i remember it I will post it later))
putting the commands in the correct order dramatically reduced boot time and increased the speed in which the system read and wrote to the drive.

they used to have a program for the commodore systems for tweaking the speed parameters on the drive.
but today it would be dangerous to use.
if you deconstructed, bypassed the parameters, added a few zero's ,recompiled, and saved it as a bootable file :naughty:
it would smoke a hard drive rather quickly
very evil!!

:lolup
registered Linux user number 505431
Amateur radio call sign KC3TEC
miracle (mere-ack-ull) :
the aspiration of the indigent, the expectation of the indolent, and the inspiration of the ignorant.

Im so old even dirt was my apprentice!

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: Speeding up boot-time

Postby viking60 » 09 May 2012, 13:16

I only had a tape recorder for storage with my Commodore 64. And there there were the ROM Cartrigdes of course. I remember Partition Magic had a defragmenting function for boot data, that would speed things up. And defragmenting the registry will probably still speed up Windows.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: Speeding up boot-time

Postby viking60 » 10 May 2012, 18:47

I managed to gain yet a couple of seconds by installing e4rat-preload-lite
Basically I just installed it and added this to the kernel line

Code: Select all

init=/usr/sbin/e4rat-preload-lite

So my kernel line now looks like this:

Code: Select all

kernel /vmlinuz-linux root=/dev/disk/by-uuid/ce335059-5488-4096-80a2-18eee55878f3 ro vga=795 init=/usr/sbin/e4rat-preload-lite


On one of the boxes I saved 15 seconds boot time; that is 1h and 52 Minutes per year of valuable computer time +1
Imagine if you have 10000 employees; that would be almost 20000 hours per year If we assume that the wages per h are 70 $ then it will cost you 1,4 Million dollars! :T So don't you dare to say that it does not matter...

I like this stuff :-D
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: Speeding up boot-time

Postby viking60 » 03 Nov 2012, 16:27

To use E4rat with systemd you have to edit /etc/e4rat.conf and uncoment the line:

Code: Select all

; init /sbin/init 

and alter it to:

Code: Select all

init /bin/systemd


Now you can replace init=/usr/lib/systemd/systemd in your kernel line (normally needed to start the system with systemd) with the traditional init=/sbin/e4rat-preload
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"


Return to “Tips & Tricks”