-
TIP: Improve bootup speed by reprofiling bootup
Digg this story
This tip applies to Ubuntu Dapper 6.06 or newer. It won't do anything if you try it on an earlier version. I typically don't like bootup gimmicks and other silly tweaks that really don't do much, but I seriously do believe you can benefit from this one... I've made an effort to explain how it works in addition to just doing it, so if you're impatient, start scrolling down.
Disclaimer: This is a safe procedure that utilizes well-tested and noninvasive code already contained in Ubuntu's bootup procedures, but are not activated by default. However, I can't be responsible for any misfortune it may inflict in your computer.
Background:
One cause of slow bootup is excessive disk seeking -- as files are being read off the disk in arbitrary order, the disk heads have to jump all around looking for the files. If during your bootup, you hear the disk making a constant grinding noise loading files, you could possibly help your bootup speeds through this tip. On the other hand, if the hard disk does not appear to be working that hard, and your slow bootup is caused by intermittent "pauses" in bootup, then this tip may not be as handy for you, and you should investigate into other reasons why your bootup is slow (i.e. trying to get an IP on a slow network, etc).
What does this procedure do?
Ubuntu has a mechanism called "readahead" that attempts to minimize disk seeking. During a profiled bootup, Ubuntu will make a list of all the files read from the disk during the bootup procedure. It then sorts the files by the order in which they appear on your hard disk, and saves it into the /etc/readahead folder. On subsequent bootups, Ubuntu will first read this list of files into RAM. Since this list of files are in order, it should be faster to read them all at once rather than on an as-needed basis at bootup. In addition, this gives your hard disk something to do during the loading drivers and getting IP address phases of bootup, where usually the hard drive would be idle. As a result, bootup will be faster.
Isn't readahead something already set up in Ubuntu? Why am I running it again?
Well, Ubuntu ships with a default readahead list. Basically, the developers ran this procedure on their computer, then you use their list. However, this list may not reflect how files are laid out on your hard drive. Also, it may not reflect what you load during bootup, especially if you've installed any extra services. In addition, if you're running a development build of Ubuntu, this list might not be accurate at all.
Does it actually help?
Well, on my system, it took around 10 seconds off the bootup. I can't say what it'll do to you, but it doesn't hurt to try!
However, if you have an insanely fast computer, it could be that readahead won't help your bootup times, as your system can handle bootup seeking without delay (and perhaps also your system doesn't wait long for the network to come up or hardware to be detected). So, your mileage may vary.
Why isn't this done periodically by my computer, if it helps so much?
Well, the process of refreshing the readahead list introduces overhead, and makes your system boot slower that one time. It's not really fair for the computer to arbitrarily decided that THIS bootup should be 25 seconds slower ;)
How do I do it?
(1) At the bootup menu (GRUB), select your default kernel. You may need to press ESC to see this menu.
(2) Press e for edit.
(3) Choose the first line (it should start with "kernel"). Press e again.
(4) Move to the end of the line, then add the word profile. Press enter.
(5) Press b to boot.
(6) Let the system boot to the login screen, and wait for all disk activity to stop. Remember, during this one bootup, you've told Ubuntu to keep track of all disk activity going on, in order to build that list. Don't be surprised if it's significantly slower than your ordinary bootups -- that's why it's not activated by default, remember?
(7) Reboot your system, and enjoy the results.
How often should I repeat this procedure?
I recommend doing it:
* Once after you install Ubuntu and get the system set up the way you like.
* After doing a major upgrade, such as to the next version of Ubuntu. No need to do it for regular updates, etc.
* After setting up prelink (if you use it), since that could cause bootup files to change locations on your hard drive
* After restoring your entire system from backups, as that would change locations of files on your hard drive.
-----
BONUS HACK!
Here's another related tweak that could help. It is a little more involved, but for me, the results shaved another 10 seconds off my bootup.
How does this one work?
By default, readahead is done in the background, while the rest of the system is booting up. I suspected that this could lead to more disk seekage, so I tried making readahead finish first, before allowing the rest of the bootup continue. To my delight, it took 10 seconds off my bootup.
Why isn't this default?
The three reasons I can think of are:
(1) Users would falsely file bug reports or complain that "Reading Desktop Files" is taking a long time to run on bootup (~10 seconds on average), not realizing that in doing so it saves them LOADS of time through the rest of bootup.
(2) The LiveCD would be agonizingly slow to load!
(3) People with insufficient RAM to cache the readahead would not receive much benefit from this form of readahead, which can worsen bootup time.
How do I do this?
(1) Perform the above profiling procedure. It is important that the order is correct, else this form of readahead won't do a thing!
(2) Use your favorite text editor (under sudo or root privileges) to open /etc/rcS.d/S01readahead
(3) Find line 21, which reads:
Code:
if /sbin/start-stop-daemon --start --quiet --background \
Remove the --background, so that it reads:
Code:
if /sbin/start-stop-daemon --start --quiet \
(4) Save, reboot.
It didn't help. How do I go back?
Just reverse step 3, putting --background back in.
Whoa! This really helped! Make it default for the next Ubuntu release!
It actually is in Edgy and beyond. A reverse of the hack is to add --background again, which some people reports is slightly faster. This completely depends on your hardware/software setup and whether your boot is IO bound or wait/modprobe-bound.
-
Re: TIP: Improve bootup speed by reprofiling bootup
thanks for the tip im gonna try it now :biggrin:
-
Re: TIP: Improve bootup speed by reprofiling bootup
WOW! Significant decrease in boot time. Thank you very much for this tip!
-
Re: TIP: Improve bootup speed by reprofiling bootup
i found this topic early this morning. just now had a chance to try it. don't know if it really made any difference or not, but i'm wondering, should the word "profile" still show up in in the boot options line as the system is starting back up after having let the login screen fully load? the machine i'm on is a P4 1.4ghz that never did take to long to load. tomorrow i'll try it on one my older intel celerons. one is a 600mhz and the other is an 800mhz. should be able to notice something on one of those old beasts!
-
Re: TIP: Improve bootup speed by reprofiling bootup
Should I remove the word profile after the first boot? Or just leave it there?
-
Re: TIP: Improve bootup speed by reprofiling bootup
Bummer no joy for me...I guess my speed was maxed already :p
Adding "profile" using jdong's method shouldn't make any permanent changes to your /boot/grub/menu.lst.If it is still there for some reason you should remove it.
-
Re: TIP: Improve bootup speed by reprofiling bootup
The word profile won't stick there -- it only lasts that one bootup.
As I said, it may or may not make a big difference for everyone -- Ubuntu ships with a default readahead list that should theoretically be "correct".... I'd expect if everyone installs Ubuntu the same way onto the same filesystem (i.e. LiveCD installer, ext3), files would end up on the hard drive in a nearly identical way (I don't think ext3 uses a random number generator to pick where to store files!)
However, if you've modified your bootup services, switched to kubuntu, installed using the Alternate CD (which uses a different method of installation), or picked a different filesystem, it could very well be that files land on your HD in a different order than what was expected.
In addition, if your hard drive is very efficient at seeking, you'll notice less of an improvement.
-
Re: TIP: Improve bootup speed by reprofiling bootup
yep, that's exactly how i've installed k/ubuntu on all 7 of my systems. just tried this trick on my 800mhz system. maybe a little difference. didn't really time it or watch it when i rebooted.
i thought after doing this on this machie and watching/reading what was going on, that the word profile should only show up that one time.
thanks
-
Re: TIP: Improve bootup speed by reprofiling bootup
Hmm, how much RAM you people have? If you've got insufficient RAM to load all the readahead files into RAM, it's not worth your time to do any readahead at all.
Another alternative way you can try to speed bootup is disabling readahead -- open up /etc/readahead/boot with a sudo'ed text editor of your choice, and delete its contents.
To get the contents back, just re-profile :)
-
Re: TIP: Improve bootup speed by reprofiling bootup
Thanks for this! My (X)ubuntu system now boots up almost 10 seconds faster. Woot!
-
Re: TIP: Improve bootup speed by reprofiling bootup
i have 384MB's ram on the 2 machines i've tried this on. that's the least amount on any of my machines. is that sufficient?
-
Re: TIP: Improve bootup speed by reprofiling bootup
That should be sufficient, yes.
-
Re: TIP: Improve bootup speed by reprofiling bootup
How cool. It's cut 6 seconds of my boot time :).
-
Re: TIP: Improve bootup speed by reprofiling bootup
According to bootchart, the boot-time went from 35 seconds to 33 seconds :wink:
Probably it can't be faster than that on my pc :)
-
Re: TIP: Improve bootup speed by reprofiling bootup
I have a question jdong...
I had a look in my /etc/readahead folder.It also contains a file titled "desktop".
Does the profile command generate this file as well?If not how is this file generated and is it possible to "reprofile" it for a boost?
-
Re: TIP: Improve bootup speed by reprofiling bootup
The "desktop" file is only generated/used for LTSP/Edubuntu setups, where /usr and /var are on different partitions. If you're looking to accelerate GNOME/KDE or another application's startup via readahead, sadly this is not supported. In fact, I'm not sure... we might already be using the readahead technique to its full potential :)
-
Re: TIP: Improve bootup speed by reprofiling bootup
-
Re: TIP: Improve bootup speed by reprofiling bootup
Hi jdong!
Can I translate this to spanish and put it on my blog, referencing it here?
-
Re: TIP: Improve bootup speed by reprofiling bootup
Certainly! Go right ahead :)
-
Re: TIP: Improve bootup speed by reprofiling bootup
An update to the HOWTO, I have added a Bonus Hack section that has readahead run in the foreground to further minimize disk seeking. This has proven very successful on my systems.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Tests on edgy:
Before tweaking: 45s
After profiling: 43s
After removing --background: 40s
Not much, but still better :)
Thanks!
And I'm gonna translate this to Polish if you don't mind :)
-
Re: TIP: Improve bootup speed by reprofiling bootup
Tests on edgy:
Before tweaking: 38s
After profiling: 35s
After removing --background: 35s-45s (somewhat inconsistent)
Strangely enough, I can't boot anymore after applying the "hack".
After 4 reboots now all kernels hang at different positions during bootup. I'm not sure it's related to the hack, though.
Adding "--background" back fixes this, however
-
Re: TIP: Improve bootup speed by reprofiling bootup
41 to 38 to 40 so maybe no difference at all when we take into account I hand-watched it
-
Re: TIP: Improve bootup speed by reprofiling bootup
Thanks for this. I think it only saves me a second or two in the end (I'm using a very sparse Xubuntu setup anyway), but it's definitely helpful. Cheers!
-
Re: TIP: Improve bootup speed by reprofiling bootup
Definite improvement, I can't provide benchmark data, perhaps 8-10 sec less :) Thank you for this ;)
-
Re: TIP: Improve bootup speed by reprofiling bootup
this may sound weird, but this actually increased my boot time by 10 seconds. I followed both "hacks" and then I disabled the second one, and my boot time is 57 seconds were it is usually 45-46 seconds. Now this is every time I boot, not just the first time after the profiling thing. Basically what happens when it boots up is it kinda gets "stuck" on "Reading files needed to boot" It stays on that for a long time, and then usplash does that annoying thing where it quits and it goes to the text and then eventually after a while the boot proceeds.
This pisses me off quite a bit, so if anybody has any way that I can fix this it would be greatly appreciated.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Open up /etc/readahead/boot with a text editor (with admin privs) and delete all the contents.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Quote:
Originally Posted by
jdong
Open up /etc/readahead/boot with a text editor (with admin privs) and delete all the contents.
aah...it's all nice and back to normal. Thanks!
But do you think there was anything that I did wrong that would cause that to happen?
-
Re: TIP: Improve bootup speed by reprofiling bootup
Nah, I don't think you did anything wrong... There's just something about your hardware/software configuration that means you don't benefit from readahead... and that certainly does happen.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Hmm.. on my nearly-latest edgy setup, the bonus hack is already implemented? (i.e. --background is already not present) - I imagine this is the same for everyone else on edgy (I'm sure I haven't already tried this hack!)
Also, seeing as edgy uses upstart rather than the old sysvinit system as per dapper, will this hack still have an effect?
Eddie
-
Re: TIP: Improve bootup speed by reprofiling bootup
After I mentioned the results of this test to Scott James Remnant, Edgy's readahead program was changed in two ways:
(1) It's now done in the foreground
(2) On each bootup, the list is dynamically resorted to match on-disk layout
So, this should mean that Edgy will boot faster without the need for reprofiling, unless of course you start a lot of services that are not part of the default Edgy system.
-
Re: TIP: Improve bootup speed by reprofiling bootup
On my P3 laptop, profiling took it from 65s to 56s. Removing the --background thing didn't make a difference.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Nice, thanks! The first hack shaved 3-4 seconds off my boot time, and the second one didn't apply, as --background had already been removed.
But good to know I'm now at maximum boot efficiency!
-
Re: TIP: Improve bootup speed by reprofiling bootup
I have authorized for Edgy's readahead-list to be backported to Dapper. This makes foreground the default mode of readahead, and also resorts the list on-the-fly on each bootup.
Enjoy!
-
Re: TIP: Improve bootup speed by reprofiling bootup
Hi jdong,
first, thanks and nice idea. this seems to improve bootup time for me, too (didn't take any measurements yet).
Just one thing I don't understand: why should I want to resort the list every time I boot? Normally, the standard boot files don't really change their places and resorting will surely cost some time - surely I'm missing something?
cheers, raph
-
Re: TIP: Improve bootup speed by reprofiling bootup
Quote:
Originally Posted by
raphha
Hi jdong,
first, thanks and nice idea. this seems to improve bootup time for me, too (didn't take any measurements yet).
Just one thing I don't understand: why should I want to resort the list every time I boot? Normally, the standard boot files don't really change their places and resorting will surely cost some time - surely I'm missing something?
cheers, raph
(1) Resorting the boot list takes about 50 milliseconds to do on my Celeron M 1.4GHz. If you notice this, then you need to step away from the caffeine pills :)
(2) The resort-on-boot is primarily designed so that the default, unprofiled boot.list that ships with readahead-list would be more valid on more systems. They are generated on fresh-installed Ubuntu's using ubiquity, which might be vastly different than what your box may be.
(3) Resort-on-boot can help you out when system packages get dist-upgraded. When files are replaced, there's no guarantee that they remain in the same locations. Even security updates might replace some of these bootup files.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Had already profiled myself, but removing --background had a significant impact. Nice tip!
-
Re: TIP: Improve bootup speed by reprofiling bootup
For "power users" who can do a bit of tinkering, you can build your own readahead lists. Run "sudo readahead-watch -o /etc/readahead/myapp.list" to start readahead monitoring and write a list to /etc/readahead/myapp.list. Run "sudo killall readahead-watch" to stop monitoring after you're done.
Then, run " (sudo) readahead-list /etc/readahead/myapp.list" to prefetch myapp.list. Running without sudo just means the app won't resort before reading.
So, you can tinker with readaheading various lengthy tasks. I've had good success with readaheading GNOME/KDE startup (hint: have /etc/rc.local prefetch your list, so if you don't immediately login, readahead will prefetch your login sequence anyway) and openoffice (just created a /usr/local/bin wrapper script). With firefox, there was no improvement, presumably not enough disk IO to make a real impact.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Thanks for the how-to. What puzzles me in the Bonus hack is that "--background" was already removed even before i knew the file even existed on my box.
A picture is worth a thousand words. I didn't notice any performance gained by this how-to. Is it possible that anyone can glance at the boot chart and see where it's taking it's time?
Boot time before profile:
http://img96.imageshack.us/img96/547...forehn0.th.jpg
Boot time after profile:
http://img145.imageshack.us/img145/3...fternk9.th.jpg
Thanks
-
Re: TIP: Improve bootup speed by reprofiling bootup
As I noted in post 36, dapper-backports now uses foreground as its default mode of operation.
-
Re: TIP: Improve bootup speed by reprofiling bootup
I could not tell if the "profile" hack sped up my bootup time at all. I am running dapper on an Inspiron B130 Dell Laptop. I never timed the thing before, so it may have helped and I didn't notice.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Quote:
# Remember that any major changes to this script need to also be made to
# readahead-desktop.init
The file says that, is it a moot point or should I also change that file?
-
Re: TIP: Improve bootup speed by reprofiling bootup
Using the mississipi counting method (yes not very scientific) I counted 25s to bootup to login screen and 34 seconds to boot up into a ready to use desktop (with beryl starting up too) so a very nice speed increase using the "profile" tweak! Before i believe it took 30-35 seconds to reach the login screen
-
2 Attachment(s)
Re: TIP: Improve bootup speed by reprofiling bootup
i whent for 1.04 mins to 56sec
whole 8sec improvment
kewl
edgy-20061008-1.png is before this tip
edgy-20061008-2.png is after
-
Re: TIP: Improve bootup speed by reprofiling bootup
Quote:
Originally Posted by
dolphinsonar
The file says that, is it a moot point or should I also change that file?
That's a moot point, an artifact that goes back to the Ubuntu packaging, where changing just that file does nothing, but you actually have to change debian/readahead.init to get the changes installed to the system. So, ignore it :)
-
Re: TIP: Improve bootup speed by reprofiling bootup
I didn't see this thread until just now. Tried it and shaved 10 seconds off my boot time. Thanks, jdong!
-
Re: TIP: Improve bootup speed by reprofiling bootup
In addition to the above, how can I remove unnecessary stuff such as laptop stuff and things I really don't have or use that I see listed while my computer is booting, and then see being killed as it is being turned off? Seems to me that these things would add some time for sure.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Quote:
Originally Posted by
jdong
Digg this story
How do I do this?
(1) Perform the above profiling procedure.
It is important that the order is correct, else this form of readahead won't do a thing!
(2) Use your favorite text editor (under sudo or root privileges) to open
/etc/rcS.d/S01readahead
(3) Find line 21, which reads:
Code:
if /sbin/start-stop-daemon --start --quiet --background \
Remove the --background, so that it reads:
Code:
if /sbin/start-stop-daemon --start --quiet \
I don't have that option! Using UBUNTU DAPPER! Mine looks like this:
Code:
#!/bin/sh -e
# init script for readahead
# Check the package is still installed
[ -x /sbin/readahead-list ] || exit 0
# Get LSB functions
. /lib/lsb/init-functions
. /etc/default/rcS
# Remember that any major changes to this script need to also be made to
# readahead-desktop.init
case "$1" in
start|restart|force-reload)
# This can take a while
if type usplash_write >/dev/null 2>&1; then
usplash_write "TIMEOUT 360" || true
fi
# If "profile" is placed on the kernel command-line we watch the boot
# sequence and generate new readahead lists, rather than read the lists
if ! grep -q "profile" /proc/cmdline; then
log_begin_msg "Reading files needed to boot..."
if /sbin/start-stop-daemon --start --quiet \
--pidfile /var/run/readahead-list.bogus \
--startas /sbin/readahead-list -- -s /etc/readahead/boot; then
log_end_msg 0
else
log_end_msg $?
fi
else
log_begin_msg "Preparing to profile boot sequence..."
if /sbin/start-stop-daemon --start --quiet \
--pidfile /var/run/readahead-watch.bogus \
--startas /sbin/readahead-watch -- -o /etc/readahead/boot; then
log_end_msg 0
else
log_end_msg $? || true
fi
fi
if type usplash_write >/dev/null 2>&1; then
usplash_write "TIMEOUT 15" || true
fi
;;
stop)
;;
*)
echo "Usage: /etc/init.d/readahead {start|stop|restart|force-reload}"
exit 1
;;
esac
exit 0
And upon further examination of the file I believe that when setting "profile" in grub it automaticly executes the following:
Code:
if /sbin/start-stop-daemon --start --quiet \
What do U thing?
-
Re: TIP: Improve bootup speed by reprofiling bootup
ashrack -- you must be running dapper-backports, in which case the "bonus hack" is already applied. No further work is necessary on your part then :)
BLTicklemonster, the presence of those files in boot.list indicates that your system is using them during bootup. If you want to try to bypass them completely, then you're gonna have to take a bootup manager application of some sort and remove "unnecessary" rc scripts from /etc/rcS.d and /etc/rc2.d.... Messing something up there could render your system unbootable though!
Basically, I'd leave it alone. That's not what I'd consider to be a "safe hack" :)
-
Re: TIP: Improve bootup speed by reprofiling bootup
Well, yeah, but I'm like running a desktop, not a laptop. But okay.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Those things really don't take that long to execute anyway...
-
Re: TIP: Improve bootup speed by reprofiling bootup
Thanks, I have gone from 48 seconds to 43 seconds, and just checked, and background is already gone.
(now, should I put it BACK, then profile again, then remove it? I noticed you said to make sure they were done in order, and apparently background was already missing before I profiled)
-
Re: TIP: Improve bootup speed by reprofiling bootup
Like the 5th time I said it in this thread (maybe I'll edit the howto and update it with the tidbit), but background has been removed already for you if you use dapper-backports. Recently I authorized Edgy's readahead system to be backported to Dapper, which brings most of this tip's benefits to any Dapper system. Not saying that profiling won't make any difference -- as you noticed, apparently everyone's system is somewhat different after we finish installing our apps :)
As far as removing background vs adding it back in, all I can say is experiment and see which works best. For most systems, the new style of operation (without background) will be faster, but the difference should only be by a few seconds at most anyway.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Quote:
Originally Posted by
jdong
Hmm, how much RAM you people have? If you've got insufficient RAM to load all the readahead files into RAM, it's not worth your time to do any readahead at all.
Another alternative way you can try to speed bootup is disabling readahead -- open up /etc/readahead/boot with a sudo'ed text editor of your choice, and delete its contents.
To get the contents back, just re-profile :)
384Mb SDRAM
-
Re: TIP: Improve bootup speed by reprofiling bootup
I'm on a Pentium 3 450@527MHz with whopping 192 megs of ram and an ancient harddisk. Results:
Initial 1.12
Profiling 2.57
Profiled 1.08 <---
No readahead 1.14
So a very small benefit for me. :)
-
Re: TIP: Improve bootup speed by reprofiling bootup
Thank you, I went from 2 mins to 1 min 40 secs :)
This has more effect than InitNG and there's nothing to compile & set up ;)
I didn't require the second hack, it was already set as specified (only on line 23).
Thanks again,
Tony.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Even more improvements:
To make your boot times even faster, use these two options:
profile single
This way, you will after some time fall into the console without booting X.
This will remove a lot of unnecessary files from the readahead folder.
Once in the console, just type reboot and see if it is faster.
I shoved 7 more seconds from my boot time this way.
Please, check this and post the results.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Profiling in single-user mode will only accelerate /etc/rcS.d bootup.... X Windows, GDM, and HAL/D-Bus will not be preloaded... It may improve your boot speed, or it might cause it to decrease.
-
Re: TIP: Improve bootup speed by reprofiling bootup
It doesn't seem to do anything for me according to bootchart... and I'm using the latest Edgy...?
Eddie
-
Re: TIP: Improve bootup speed by reprofiling bootup
Quote:
Originally Posted by
Eddie Hung
It doesn't seem to do anything for me according to bootchart... and I'm using the latest Edgy...?
Eddie
You'll get less of a boost in Edgy because all of the above techniques are applied by default.
-
Re: TIP: Improve bootup speed by reprofiling bootup
I tried this on Edgy before i read your comment about it already applied by default. I'm not really sure if it applies to this thread, but what made a 5 second difference is disabling FAT32 fs check in fstab. At fresh install my boot time was at ~36 +/- 2 seconds. shaved about 5 seconds disabling fschck.vfat, took off another 3 seconds when i uninstalled vmware ws and disabled usplash. Constant boot time now is 27 seconds on every reboot and cold boot.
Any chance to get it down to 15 without disabling any more services? :D
-
Re: TIP: Improve bootup speed by reprofiling bootup
Thank you for this howto, it cutted about 8-10 seconds for me.
As you said, i'm not found the --background, but the profile worked well.
It's on kubuntu edgy on a notebook: 2000+amd mobile, 256mb ram (-92 video) and it boots in 46 seconds. I'm going to find other workarounds to speed up, and then i do all on my pc and come back the results (i i not forget that:))
So again, thanx.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Thank you for this. Definitely made a difference on my dell laptop 6400.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Quote:
Originally Posted by
jdong
For "power users" who can do a bit of tinkering, you can build your own readahead lists. Run "sudo readahead-watch -o /etc/readahead/myapp.list" to start readahead monitoring and write a list to /etc/readahead/myapp.list. Run "sudo killall readahead-watch" to stop monitoring after you're done.
Then, run " (sudo) readahead-list /etc/readahead/myapp.list" to prefetch myapp.list. Running without sudo just means the app won't resort before reading.
So, you can tinker with readaheading various lengthy tasks. I've had good success with readaheading GNOME/KDE startup (hint: have /etc/rc.local prefetch your list, so if you don't immediately login, readahead will prefetch your login sequence anyway) and openoffice (just created a /usr/local/bin wrapper script). With firefox, there was no improvement, presumably not enough disk IO to make a real impact.
This sounds like a really good way to speed up gnome. For me, it takes as long for gnome to finish loading after I get to gdm as it takes to get to gdm from grub. But how exactly can I do this? Will this even work for me if I have gdm log me automatically?
-
Re: TIP: Improve bootup speed by reprofiling bootup
It's less effective if GNOME logs you in for you. and the performance speedup is not terribly significant. If it sped things up a mind-blowing amount I would already have posted a howto and sample readahead lists for GNOME and KDE already :D
-
Re: TIP: Improve bootup speed by reprofiling bootup
Dang, but thanks. Loading the files at the same time as the boot files wouldn't work?
It's really great that the ubuntu people are speeding up the boot process (collapsing cron, etc into it is good too), but desktop start up is where so much of the wait is now, I wonder if the kde people have something planned for kde4?
I've heard that feisty is going to be even faster than edgy, I'm looking forward to that. Bootchart tells me it takes 27 seconds right now, any estimate what that'll be on feisty?
-
Re: TIP: Improve bootup speed by reprofiling bootup
Well preloading does less good on accelerating desktop load time -- it helps to some degree for sure, but for me the improvement was like 5% or so... not worth the amount of effort I put into it. Basically, you'd edit /etc/rc2.d/S99stop-readahead and in the stop action, put in sleep 120 before it stops readahead.
Now you have 120 secs to perform actions you typically do. (log in. load Firefox/Openoffice?). Now wait or ps aux | grep readahead to see when readahead dies. When it does, reboot :)
-
Re: TIP: Improve bootup speed by reprofiling bootup
So what's with that readahead-desktop that's under /etc/rcS.d/ ? Looking through the code (I'm no expert at this though) it looks like it does the same thing except that it fills up /etc/readahead/desktop at a different point in the boot process. But that doesn't have anything in it. Why's it there if it doesn't do anything? How can I make it work?
-
Re: TIP: Improve bootup speed by reprofiling bootup
IIRC that's for Edubuntu/LTSP network boot so that readahead doesn't take absurdly long.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Thanks for tip my thinkpad R51 seems to boot a bit quicker. The really cool bit is that I now know more about the boot up process.:)
-
Re: TIP: Improve bootup speed by reprofiling bootup
By inspiration from this thread. I threw together this little defragmentation scheme:
(For this to work make sure that the destination dir resides on the same file system as the copied files)
Code:
mkdir /refrag && cd /refrag
Backup (if you don't know how to rescue a dead system using only a LiveCD and this tar-file, stop reading now)
Code:
tar -c -T /etc/readahead/boot -f backup.tar
Create a numbered list of files. (Maybe paranoid step, but at least we won't have any surprises)
Code:
cat -n /etc/readahead/boot > files.txt
Copy those files to single dir (should pack them together on the disk)
Code:
cat files.txt | while read num file; do cp -dp "$file" "./$num"; done
Relink the files to the copies
Code:
cat files.txt | while read num file; do test -e "./$num" && ln -f "./$num" "$file"; done
I haven't done any measuring. Maybe someone here might be interested enough to do that though.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Disregard this post, i'm tired and not thinking straight at all...
^ Should be
Code:
tar -cvvf backup.tar /etc/readahead/boot
I'm getting tons of entries like
Quote:
cp: cannot stat `/lib/modules/2.6.15-27-686/kernel/drivers/input/gameport/ns558.ko': No such file or directory
when copying to the dir, should this happen?
when executing the relinking, i'm give loads of stuff like
Quote:
ln: cannot remove `/bin/mount': Permission denied
which doesn't sound too promising!
-
Re: TIP: Improve bootup speed by reprofiling bootup
Quote:
Originally Posted by
glotz
^ Should be
Code:
tar -cvvf backup.tar /etc/readahead/boot
Doesn't that just backup the /etc/readahead/boot file? Then intention was to backup all files listed in it...
Quote:
I'm getting tons of entries like when copying to the dir, should this happen?
If you haven't done a profile run I guess this file would list files that no longer exist.
Quote:
when executing the relinking, i'm give loads of stuff like
You need root permission to replace system files.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Uhmmm, yes. Sorries, shouldn't read no forums this tired. I'll go to sleep a bit now....
EDIT: one thing you actually could include in that post is the spell to use the backup, if need be.
-
Re: TIP: Improve bootup speed by reprofiling bootup
Quote:
Originally Posted by
John Nilsson
I haven't done any measuring. Maybe someone here might be interested enough to do that though.
Hey John [#71], what a nice idea! I have a year old 2,5" HDD and made an upgrade from dapper to edgy (meaning, the hdd-speed is not great, and files were probably pretty defragmented). Bootchart showed that during readahead I had 100% Disk utilization, but very low throughput (and 1100 files in the readahead list) - so your idea looked promising.
So I tried out your method. After the initial profiling I was consistenly at 46 sec according to bootchart. After doing your method, bootchart shows a total of 40 seconds. Improvement: 6 seconds (or 13%). Thank you. :)
Since in the last step you are making hard links, I assume we can simpy delete the entire refrag directory afterwards.
Also there should be no hindrance in doing the same for readahead-desktop, right?
Anybody have any idea on how to do the profiling (as in the first post of this thread) for readahead-desktop?