Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: Mount / in RAM and load apps instantly
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3, 4, 5, 6  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 792
Location: under a car or on top of a keyboard

PostPosted: Thu Feb 24, 2005 8:10 am    Post subject: Reply with quote

https://forums.gentoo.org/viewtopic-p-2125152.html
Just preload what's slow?
Back to top
View user's profile Send private message
darkfolk
n00b
n00b


Joined: 30 Jan 2005
Posts: 32

PostPosted: Thu Mar 10, 2005 11:40 pm    Post subject: Reply with quote

2 things;
first, on one of the "mknod" commands, you spelt one as "mknot". Typo?
second, you should all be reminded that you need RAM Disk Support and initrd support in the kernel; I didn't have it and had to reset this. other than that, I'm going to try this out with love2...
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 792
Location: under a car or on top of a keyboard

PostPosted: Fri Mar 11, 2005 4:45 am    Post subject: Reply with quote

Thanks for the 'bugs'. I've updated the howto.
Back to top
View user's profile Send private message
Enlight
Advocate
Advocate


Joined: 28 Oct 2004
Posts: 3519
Location: Alsace (France)

PostPosted: Fri Mar 11, 2005 10:24 am    Post subject: Reply with quote

Well In fact I hate this post :wink: , as soon as I saw it, I felt obliged to buy two gigs of RAM (I had only 256Mo)and it hurts :twisted: Hope they're comming soon :D

Thanks for this ass kicking post!
Back to top
View user's profile Send private message
joKer-O-zen
n00b
n00b


Joined: 12 Aug 2004
Posts: 29
Location: Montreal, Quebec

PostPosted: Sat Mar 12, 2005 10:53 am    Post subject: Reply with quote

Hi
great howto ... thks a lot :)

stahlsau wrote:
hi,
@thebigslide:
linuxrc is executable, works if i start it by hand, and if i set init=/bin/bash i get a shell and can do my job.
Only if i call linuxrc it doesn´t work, even if i copy it to /bin and call init=/bin/linuxrc from grub. Dunno.


same problem here ... did you find how to fix ?
_________________
°o<*o*>o°
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 792
Location: under a car or on top of a keyboard

PostPosted: Sat Mar 12, 2005 11:07 am    Post subject: Reply with quote

you must create the /newroot directory in the root filesystem before making the root tarball. I've modified the howto, although this is a hack and really, I should be modifying the linuxrc to not bother pivotrooting and just chroot instead, thus eliminating the need for this non-standard directory. I'll poke at that at work tomorrow. I just hate rebooting my box remotely incase I spell something wrong in a critical file and it doesn't come back :o
Back to top
View user's profile Send private message
joKer-O-zen
n00b
n00b


Joined: 12 Aug 2004
Posts: 29
Location: Montreal, Quebec

PostPosted: Sat Mar 12, 2005 11:24 am    Post subject: Reply with quote

I created /newroot directory, and it's in the tarball ... :/

when i put init=/bin/sh instead of init=/linuxrc i got a prompt. I can run ./linuxrc but i got an error with init ... i'm trying to fix that first ...

[EDIT]
I could'nt fix this problem ... so i let root file system on it's own partition
perhaps i'll create a tarball (or just copy the files ?) for /etc/

what do you think about that ? mounting / fs in ram is really efficient ?
[/EDIT]
_________________
°o<*o*>o°
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 2955

PostPosted: Mon Mar 14, 2005 1:46 pm    Post subject: Reply with quote

/newroot is not supposed to be in the tarball! It stays right on the / partition.

thebigslide, thanks for giving us tweakers a new way to speed up our systems. :D

A few suggestions:
  1. chmod +x /sbin/update-balls seems to be mandatory. But it is not included in your post.
  2. In this snippet from the linuxrc script:
    Code:
    # Mount root and create read-write directories
    mount -t tmpfs -o size=$ROOTSIZE none /new/ > /dev/null 2>&1
    cd /new/ && tar xpf $STORE/fs.tar > /dev/null 2>&1
    umount $STOREDEV
    # Pivot root and start real init
    cd /new
    pivot_root . newroot

    Is the /new/ directory a typo, to be replaced by /newroot/, or have I misunderstood you?

Finally, my snag when trying it all out - I get this fatal error when kernel boots :cry: :
Code:
RAMDISK: ext2 filesystem found at block 0
RAMDISK: image too big! (8192KiB/4096KiB)
UDF-fs: No partition found (1)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 792
Location: under a car or on top of a keyboard

PostPosted: Mon Mar 14, 2005 4:31 pm    Post subject: Reply with quote

kimchi_sg wrote:
/newroot is not supposed to be in the tarball! It stays right on the / partition.
/ IS the tarball if you're mounting it on a ramdrive ;-)
Quote:
chmod +x /sbin/update-balls[/color] seems to be mandatory. But it is not included in your post.
added
Quote:
Code:
# Mount root and create read-write directories
mount -t tmpfs -o size=$ROOTSIZE none /new/ > /dev/null 2>&1
cd /new/ && tar xpf $STORE/fs.tar > /dev/null 2>&1
umount $STOREDEV
# Pivot root and start real init
cd /new
pivot_root . newroot

It's supposed to be there. /new becomes / after the pivotroot. /new is where the / filesystem's tarball gets extracted to from the initrd's perspective.
Quote:
Finally, my snag when trying it all out - I get this fatal error when kernel boots :cry: :
Code:
RAMDISK: ext2 filesystem found at block 0
RAMDISK: image too big! (8192KiB/4096KiB)
UDF-fs: No partition found (1)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0)
In your kernel config, increase the size of your initial ramdisks to 8192k. It looks like it's set to 4096k right now. The UDF error is because it's using autofs to find the filesystem type and it tried UDF after ext2 wouldn't work.

:)
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 792
Location: under a car or on top of a keyboard

PostPosted: Mon Mar 14, 2005 4:43 pm    Post subject: Reply with quote

joKer-O-zen wrote:
I created /newroot directory, and it's in the tarball ... :/

when i put init=/bin/sh instead of init=/linuxrc i got a prompt. I can run ./linuxrc but i got an error with init ... i'm trying to fix that first ...

[EDIT]
I could'nt fix this problem ... so i let root file system on it's own partition
perhaps i'll create a tarball (or just copy the files ?) for /etc/

what do you think about that ? mounting / fs in ram is really efficient ?
[/EDIT]


The performance boost is going to be from having /bin, /sbin (if you use the console lots) and /lib in RAM. You can make a tarball for every directory you want in RAM if mounting / in RAM is not working for you. Try stepping through the linuxrc line by line and see where the problem is occuring.
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 2955

PostPosted: Mon Mar 14, 2005 4:53 pm    Post subject: Reply with quote

Hmm... now it got past that error, but now linuxrc execution dies with
Code:
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 192k freed
mount: mount point /root does not exist
umount /dev/hda5: not mounted
pivot_root: No such file or directory
linuxrc: line 21: dev/console: No such file or directory
Kernel panic - not syncing: Attempted to kill init!

Darn... I must have messed up my linuxrc somewhere.

Come to think of it, I moved the /usr/.bin , /usr/.lib and /usr/.sbin directories into their original positions so that I could recompile the kernel. And I forgot to move them back. Will try moving them back to see if it helps.

EDIT: That didn't do the trick.

Why on earth is it complaining about the lack of /root ?! :? Also, I think that dev/console in the linuxrc script should be /dev/console instead.
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 792
Location: under a car or on top of a keyboard

PostPosted: Mon Mar 14, 2005 7:11 pm    Post subject: Reply with quote

I think it's dying on
mount $STOREDEV $STORE
Are you mounting /dev/hda5 on /root?
Did you mkdir a /root in the initrd?
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 2955

PostPosted: Tue Mar 15, 2005 1:04 am    Post subject: Reply with quote

OK, got past that error after making a /root in the initrd, but now system services fail to start. Right after entering runlevel 3:
Code:
INIT: Entering runlevel: 3
/sbin/rc: line 25: syslog-ng: command not found
* Configuration error. Please fix your configfile (/etc/syslog-ng/syslog-ng.conf) [!!]
[coldplugging, setting of domain name and bringing up eth0 were successful, omitted]
* Starting distccd...
* /usr/bin/gcc-config: Profile does not exist or invalid setting for /etc/env.d/gcc/i686-pc-linux-gnu-3.4.3-20050110 [ok]
* Starting gpm...
start-stop-daemon: stat /usr/sbin/gpm: No such file or directory [!!]
[mounted network filesystems and set clock using NTP - completed OK]
* Starting sshd...
start-stop-daemon: Unable to start /usr/sbin/sshd: No such file or directory [!!]
* Starting vixie-cron...
start-stop-daemon: stat /usr/sbin/cron: No such file or directory [!!]
* Starting local... [ok]

EDIT: running update-balls fixes the problem, but syslog-ng still errors out, but a different one this time:
Code:
* Initializing random number generator... [ok]
INIT: Entering runlevel: 3
/sbin/rc: line 532: 6021 Bus error                    syslog-ng -s /etc/syslog-ng/syslog-ng.conf
* Configuration error. Please fix your configfile (/etc/syslog-ng/syslog-ng.conf) [!!]

A look in /sbin/rc shows that line 532 is a comment line :!: , specifically, the line "# the current "normal" runlevel" in this context:
Code:
# The -f eliminates a warning...
# ...
# ... and
# the current "normal" runlevel.
ln -snf "/etc/init.d/${x}" "${svcdir}/softscripts.new/${x}"

This error has me really stumped. :?

However, all the subsequent problems with gpm and sshd et al. have disappeared. Seems my /usr/sbin tarball needed refreshing. :oops: Apart from syslog-ng not starting (which causes all log messages to get streamed to stdout :x ), the system is working normally. :D

Also, here's my mount command after booting into the system, I'm wondering if it's the intended output :roll: :
Code:
# mount
/dev/hda2 on / type reiserfs (rw,noatime)
/dev/root on /newroot type ext2 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev type ramfs (rw)
none on /dev/pts type devpts (rw)
/dev/hda3 on /home type reiserfs (rw,noatime)
/dev/hda5 on /root type reiserfs (rw,noatime)
/dev/hda6 on /var type reiserfs (rw,noatime)
/dev/hda7 on /usr type reiserfs (rw,noatime)
none on /dev/shm type tmpfs (rw)
none on /usr/bin type tmpfs (rw,size=32m)
none on /usr/sbin type tmpfs (rw,size=2m)
none on /usr/lib type tmpfs (rw,size=256m)

And my "time emerge -s firefox" (I performed it once before that but forgot to time it):
Code:
real    0m5.181s
user    0m2.178s
sys     0m0.407s

"time emerge -pv gnome":
Code:
real    0m4.584s
user    0m4.020s
sys     0m0.408s

Seems like a decent speedup. :D
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 792
Location: under a car or on top of a keyboard

PostPosted: Tue Mar 15, 2005 1:54 am    Post subject: Reply with quote

Nice. I wonder what b0rked syslog-ng. I didn't have that problem. I wonder if syslog-ng is reporting the line number after stripping comments. cat /etc/syslog-ng.conf | grep -v # > syslognohash.conf might show you the 'real' culprit.

I wish there was a better way of benchmarking application load time :?:
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 2955

PostPosted: Tue Mar 15, 2005 2:06 am    Post subject: Reply with quote

Aha! Seems like we've got our man. But still don't know what to do with him. :(
Code:
# grep -v [#] /sbin/rc > rcnohash.conf

Line 532 is the "if [ -n "${LOGGER_SERVICE}" ]" line in this fragment:
Code:
for i in $(dolisting "${svcdir}/started/")
        do
                if [ -n "${LOGGER_SERVICE}" ]
                then
                        then
                                continue
                        fi
                fi

                is_critical_service "${i}" || dep_stop "${i}"
        done
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 792
Location: under a car or on top of a keyboard

PostPosted: Tue Mar 15, 2005 2:09 am    Post subject: Reply with quote

hmm
I don't think that's it either.
That's just checking for the existance of an environment variable.


It sees the error in syslog-ng.conf. syslog-ng was called by rc, that's why it appears that way.
What happens if you run syslog-ng -s /etc/syslog-ng/syslog-ng.conf from the shell?
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 2955

PostPosted: Tue Mar 15, 2005 2:13 am    Post subject: Reply with quote

thebigslide wrote:
What happens if you run syslog-ng -s /etc/syslog-ng/syslog-ng.conf from the shell?

Code:
# syslog-ng --help
Bus error
# syslog-ng -s /etc/syslog-ng/syslog-ng.conf
Bus error

What the... ?!? :roll:

Google doesn't seem to help here. :?

Also, I enlarged my USRSBINSIZE to 5m in /etc/init.d/localmount, otherwise alsa-utils wouldn't emerge, as the directory was almost full.
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 792
Location: under a car or on top of a keyboard

PostPosted: Tue Mar 15, 2005 2:24 am    Post subject: Reply with quote

maybe reemerge it. Possibly some library has been lost/corrupted.
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 2955

PostPosted: Tue Mar 15, 2005 2:36 am    Post subject: Reply with quote

thebigslide wrote:
maybe reemerge it. Possibly some library has been lost/corrupted.

Yay! That did the trick. :D

Aside: Any recommended size for the /usr/bin, /usr/sbin and /usr/lib for a system with 1024MB of physical RAM? I don't want to run into the "No space left on device" problem again. As it stands now, my /usr/bin size is 64MB, /usr/sbin is 5MB, and /usr/lib is 384MB. :twisted:
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 792
Location: under a car or on top of a keyboard

PostPosted: Tue Mar 15, 2005 2:43 am    Post subject: Reply with quote

You can resize on the fly, just make a copy of bzip2 and unbzip2 in /bin if you're resizing /usr/bin.
It drastically differs from system to system.

You might want to go through /usr/bin and make sure everything else still runs.... If /usr/lib/ had b0rkage, it's hard to be sure nothing else did.

Code:

#!/bin/bash
##/sbin/resizeramdisk
mkdir /tmp/specialpurpose
mv /usr/$1/* /tmp/specialpurpose/
umount /usr/$1
mount -t tmpfs -o size=$2 none /usr/$1
mv /tmp/specialpurpose/* /usr/$1/
rmdir /tmp/specialpurpose

call with (eg) resizeramdisk lib 512m
Back to top
View user's profile Send private message
Cinder6
l33t
l33t


Joined: 05 Aug 2004
Posts: 767
Location: California

PostPosted: Tue Mar 15, 2005 11:13 pm    Post subject: Reply with quote

thebigslide wrote:
Maybe you should clean out your /usr/lib/? Mine is only 200MB and I have TONS of apps installed.
Adended howto and provided an example of precacheing 1 app.


how do you clean it out?
_________________
Knowledge is power.
Power corrupts.
Study hard.
Be evil.

Ugly Overload
Back to top
View user's profile Send private message
thebigslide
l33t
l33t


Joined: 23 Dec 2004
Posts: 792
Location: under a car or on top of a keyboard

PostPosted: Tue Mar 15, 2005 11:43 pm    Post subject: Reply with quote

some things in /usr/lib don't actually belong there. you can make a /usr/waslib and move those directories there and link them back to /usr/lib. You'll have to check for these manually, as every system's different. I have some suggestions at the bottom of the howto.
Back to top
View user's profile Send private message
Cinder6
l33t
l33t


Joined: 05 Aug 2004
Posts: 767
Location: California

PostPosted: Wed Mar 16, 2005 12:19 am    Post subject: Reply with quote

k thx
_________________
Knowledge is power.
Power corrupts.
Study hard.
Be evil.

Ugly Overload
Back to top
View user's profile Send private message
mecolik
n00b
n00b


Joined: 06 Aug 2003
Posts: 21

PostPosted: Sun Mar 20, 2005 1:02 pm    Post subject: Reply with quote

Nice idea indeed. Want to try.

Here is another use of extra memory.
To speed up grip, a very powerfull and so quiet cd ripper.
First create a directory like /mnt/tmpfs or /tmpfs.
Code:
mount -t tmpfs -o size=800m none /tmpfs

Start grip.
In the config tab, change the rip file format to point to the tmpfs directory.
Quote:
/tmpfs/data/audio/%A/%y_%d/%t_%n.wav

Go to encode tab, and point to your data directory :
Quote:
/data/audio/%A/%y_%d/%t_%n.%x

In the options tab, check delete .wav

On this computer, the encoding with flac is very fast, if you have only one drive but some memory to use (300m should be enough for most CDs)
this will avoid write at rip and read at encode(probably during write from the following rip process).
It will avoid a lot of IO and the drive will only be accessed when writing the final flac file.

tmpfs use the kernel buffer cache and the size option is limited to half memory size by default.
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 2955

PostPosted: Sun Mar 20, 2005 1:39 pm    Post subject: Reply with quote

Note to self: Exercise great control over what components of KDE to emerge in conjunction with this HOWTO. emerge kde dies with /usr/lib out of space about 120 packages in. :(

P.S. It will probably be some time before I try this again. I've reinstalled the system as normal since then. ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6  Next
Page 2 of 6

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum