Page 8 of 18 FirstFirst ... 678910 ... LastLast
Results 71 to 80 of 180

Thread: TIP: Improve bootup speed by reprofiling bootup

  1. #71
    Join Date
    Aug 2005
    Beans
    47

    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.
    Last edited by John Nilsson; March 25th, 2007 at 12:00 PM.

  2. #72
    Join Date
    Dec 2004
    Location
    hacking on my Debian box
    Beans
    1,305

    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
    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
    ln: cannot remove `/bin/mount': Permission denied
    which doesn't sound too promising!
    Last edited by glotz; March 25th, 2007 at 11:52 AM. Reason: brain no worky

  3. #73
    Join Date
    Aug 2005
    Beans
    47

    Re: TIP: Improve bootup speed by reprofiling bootup

    Quote Originally Posted by glotz View Post
    ^ 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...

    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.

    when executing the relinking, i'm give loads of stuff like
    You need root permission to replace system files.
    Last edited by John Nilsson; March 25th, 2007 at 11:42 AM.

  4. #74
    Join Date
    Dec 2004
    Location
    hacking on my Debian box
    Beans
    1,305

    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.
    Last edited by glotz; March 25th, 2007 at 11:57 AM.

  5. #75
    Join Date
    Jun 2006
    Beans
    Hidden!

    Re: TIP: Improve bootup speed by reprofiling bootup

    Quote Originally Posted by John Nilsson View Post
    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?
    Last edited by Sencer; March 26th, 2007 at 12:34 PM.

  6. #76
    Join Date
    Aug 2005
    Beans
    47

    Re: TIP: Improve bootup speed by reprofiling bootup

    Quote Originally Posted by Sencer View Post
    Hey John [#71], what a nice idea!
    I can't take credit though, see the thread I linked to for the whole thing. Quinn Harris crated some python scripts and a patch for readahead to do this (only better because the patch sorted the files according to atime), the script didn't work for me though, thus this bash version.

    After doing your method, bootchart shows a total of 40 seconds. Improvement: 6 seconds (or 13%). Thank you.
    Cool =)

    Since in the last step you are making hard links, I assume we can simpy delete the entire refrag directory afterwards.
    Should be safe.

    Also there should be no hindrance in doing the same for readahead-desktop, right?
    I couldn't get this to work though. Assumed it was because of my weird mounting scheme (I bind mount /home/.var to /var).

  7. #77
    Join Date
    Apr 2005
    Beans
    78

    Re: TIP: Improve bootup speed by reprofiling bootup

    Thanks for this thread. I've just shaved 10 seconds off my feisty system by doing the profile thing (the --background is of course already removed).

    I noticed that the original boot file, before profiling, referred to a lot of files in /lib/modules/2.6.20-12-generic and /lib/linux-restricted-modules/2.6.20-12-generic when I was actually running 2.6.20-13, so profiling sorted that out. So I would recommended re-profiling for every kernel upgrade, not just major Ubuntu version upgrades, unlike the advice in the first post.

  8. #78
    Join Date
    Jan 2005
    Beans
    20
    Distro
    Ubuntu Breezy 5.10

    Re: TIP: Improve bootup speed by reprofiling bootup

    My boot time actually increased after doing this...
    I've got a pretty old system, just keep dist-upgrading at every release and I'm running Feisty now. The number of files now read is way more then the original but that's to be expected and probably even a good thing I guess.
    I did notice this by the way:
    Code:
    wc -l readahead
    199 readahead
    
    sort readahead|uniq|wc -l
    179
    So there are twenty files read "double" on boot, unless the profiler actually takes doubles in consideration...
    Also there are lots of files that seem unnecessary to me. Cups banner pages and files in /var/log for example.
    Then there are fglrx entries in my boot file while I have a nVidia card. or about two hundred python lines as well which seem pretty scary to me.

    I could just remove these entries but I guess at boot those files are then still read so I would effectively slow the system down.

    Only thing I can think of is a fresh Feisty reinstall, but that's the Windows way and not acceptible in my opinion.

    Any ideas?

  9. #79
    Join Date
    Jun 2006
    Beans
    Hidden!

    Re: TIP: Improve bootup speed by reprofiling bootup

    Quote Originally Posted by Mon View Post
    My boot time actually increased after doing this...
    Did you measure it, or is it just your impression? Just curious. Because for about 10-15 seconds (or longer) it will just read the necessary files which can seem like a long time, especially if you have usplash+quite - but it's worth it, as the total time does go down.
    Of course you can always go and reduce the number of files that are preloaded, or you can put the process in the background - while I doubt it would be faster, it will certainly remove the "stuck" feeling, as the progress bar keeps moving.

    wc -l readahead
    Is it possible that you checked the readahead script? And that you intended to check the file-list which is in "/etc/readahead/boot"? Because 199 seems like an awfully low number, I have always had > 1000 in there (and no duplicates for me).

    Also there are lots of files that seem unnecessary to me. Cups banner pages and files in /var/log for example.
    Yeah, I got those, too. As long as those files are touched on startup (there is a cupsys that is started on boot), readahead sticks them in there. As long as those files are in a more or less continous spot on the harddrive (see sugestion at the top of this page), the many small files hardly matter IMHO. Kicking out a lot of small files (due to removed services) hardly reduced the amount of time boot spends in readahead for me (bootchart is nice to check this).

    or about two hundred python lines as well which seem pretty scary to me.
    due to hplib maybe? You can always try

    find /etc/rc* | xargs grep -i python
    to get some hints (though it may not always work, since scripts from other locations are sourced and started).

    Any ideas?
    After the above - check the services you have installed (sysv-rc-conf), and try out bootchart which will also give you an idea where time is spent. (Unnesseary interfaces? duplicate dhcp queries? unneeded services?).

  10. #80
    Join Date
    Oct 2004
    Location
    Cupertino, CA
    Beans
    5,092
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: TIP: Improve bootup speed by reprofiling bootup

    Quote Originally Posted by Mon View Post
    My boot time actually increased after doing this...
    I've got a pretty old system, just keep dist-upgrading at every release and I'm running Feisty now. The number of files now read is way more then the original but that's to be expected and probably even a good thing I guess.
    I did notice this by the way:
    Code:
    wc -l readahead
    199 readahead
    
    sort readahead|uniq|wc -l
    179
    So there are twenty files read "double" on boot, unless the profiler actually takes doubles in consideration...
    Duplication really doesn't matter; once a file is read once into cache, asking it to be read again is an instantaneous operation.

    Also there are lots of files that seem unnecessary to me. Cups banner pages and files in /var/log for example.
    Then there are fglrx entries in my boot file while I have a nVidia card. or about two hundred python lines as well which seem pretty scary to me.
    Any files being listed in there mean that your system bootup opened those files for read access. Hence, they are actually being read during bootup and readahead is doing you a favor to prefetch it. Python, if your bootup starts any Python apps, will indeed need to touch a few hundred module files.




    However, it is important to point out that there is a break-even point for readahead. That is, there's a point where you are spending so much time prefetching when you could be booting, that you end up slowing down bootup. Try profiling, then truncating your readahead file by 25% or so at a time, seeing when you get the fastest boot. Reading everything ahead may not be the fastest.
    Quote Originally Posted by tuxradar
    Linux's audio architecture is more like the layers of the Earth's crust than the network model, with lower levels occasionally erupting on to the surface, causing confusion and distress, and upper layers moving to displace the underlying technology that was originally hidden

Page 8 of 18 FirstFirst ... 678910 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •