-
Memory Management in Knoppix?
Knoppix is an interesting idea for people looking to learn Linux without abandoning Windows first.
But I do have one small question:
Is there no way to change the ramdisk to a smaller size so you can free up more memory for applications? If your not going to load the whole OS into RAM then it seems a little excesive to have an 800 meg Ramdisk that is only going to get maybe 5% used at most.
Sorry if its a dumb question.
-
Senior Member
registered user
This is all for Knoppix 3.8 Cebit Edition which is 4 months old but it should be roughly the same for Knoppix 3.9 & 4.0. Knoppix loads the kernel and mini root partition from /KNOPPIX-CD-ROOT/boot/isolinux. The kernel loaded is linux and the mini root is minirt.gz. You can view the mini root by copying it to another location, unziping it, and loop mounting it.
Code:
cd $HOME
cp /KNOPPIX-CD-ROOT/boot/isolinux/minirt.gz ./
mkdir foobar
gunzip minirt.gz
sudo mount -t ext2 -o loop,ro minirt ./foobar
Inside the minirt you will find a executable script named linuxrc. This linuxrc script is init script for Knoppix.
The entire linuxrc script for Knoppix 3.8 Cebit Edition is posted at my website at http://virtualacuity.com/james/knopp...nuxrc-3.8.html
Code:
11 # hardcoded configurable options
12 # Default maximum size of dynamic ramdisk in kilobytes
13 RAMSIZE=1000000
612 # New in Kernel 2.4.x: tmpfs with variable ramdisk size.
613 # We check for available memory anyways and limit the ramdisks
614 # to a reasonable size.
615 FOUNDMEM="$(awk '/MemTotal/{print $2}' /proc/meminfo)"
616 TOTALMEM="$(awk 'BEGIN{m=0};/MemFree|Cached/{m+=$2};END{print m}' /proc/meminfo)"
617
618 # Be verbose
619 echo "${CRE}${BLUE}Total memory found: ${YELLOW}${FOUNDMEM}${BLUE} kB${NORMAL}"
620
621 # Now we need to use a little intuition for finding a ramdisk size
622 # that keeps us from running out of space, but still doesn't crash the
623 # machine due to lack of Ram
624
625 # Minimum size of additional ram partitions
626 MINSIZE=20000
627 # At least this much memory minus 30% should remain when home and var are full.
628 MINLEFT=16000
629 # Maximum ramdisk size
630 MAXSIZE="$(expr $TOTALMEM - $MINLEFT)"
631 # Default ramdisk size for ramdisk
632 RAMSIZE="$(expr $TOTALMEM / 5)"
633
634 # Create additional dynamic ramdisk.
635 test -z "$RAMSIZE" -o "$RAMSIZE" -lt "$MINSIZE" && RAMSIZE="$MINSIZE"
636 mkdir -p /ramdisk
637 # tmpfs/varsize version, can use swap
638 RAMSIZE=$(expr $RAMSIZE \* 4)
639 echo -n "${CRE}${BLUE}Creating ${YELLOW}/ramdisk${BLUE} (dynamic size=${RAMSIZE}k) on ${MAGENTA}shared memory${BLUE}...${NORMAL}"
640 # We need /bin/mount here for the -o size= option
641 /bin/mount -t tmpfs -o "size=${RAMSIZE}k" /ramdisk /ramdisk
Those lines detect the system's total RAM, calculate the ramdisk size, & then create the ramdisk. This calculation is not user configurable but in theory it should be possible to create a boot time cheat code for ramdisk size that is then detected & used in this script. The logic of it would have to do bounds checking to make sure the user is not setting the ramdisk too small or too large.
I hope this helps.
James
-
Try a kernel parameter. From /usr/src/linux/Documentation/ramdisk.txt:
ramdisk_size=N
==============
This parameter tells the RAM disk driver to set up RAM disks of N k size.
Don't know if it works with knoppix though.
-
Thanks to both Underscore and Markus for their responses. Learned a lot more about Linux and Knoppix - course it turned out that wasn't my problem after all. I was looking in the wrong direction. But now that i've got my feet wet I look foreward to much more use of Knoppix from now on
(I was trying to use Knoppix to run the SETI@home and Einstein@home programs after reading about it on their website. I got it to run on my first try [sheer stupid luck as it turned out] but could not duplicate this success after changing the screen resolution to 1024X768 and rebooting. I assumed that they were using way too much RAM with the bigger [and much more readable] screen. It turns out I didn't understand the directory [folder?] system under Linux as that turned out to be my problem. The RamDisk is dynamic anyway so it shouldn't really take up that much room if not needed. I think.
I have noticed the programs run much slower than they did under Windows XP. That combined with the fact the the same two processes are using considerably less RAM under Knoppix leads me to believe I haven't finished my study of Memory Management under Linux yet..)
-
More questions
I'm looking to free up memory because vegastrike runs like a snail (pause up to 15 seconds to respond to mouse movement or click) under Knoppix (why bother to include it?). With only 200 MB out of 1 GB RAM available as memory, I'm assuming that low memory availability is the cause (even though I have a 500 MB USB swap file). Response is much faster in the windows version of vegastrike (but it crashes very quickly after startup).
I'm running the Knoppix 4.02 DVD (no HD install). The ramdisk_size boot option doesn't affect the size of the ramdisk created in the linuxrc script, so that didn't help. Based on the discussion of the linuxrc script, this looks like a messy remastering job.
I'm assuming there's no way to umount and mount the ramdisk under a new size while the system is running. It certainly sounds like an invitation to crash unionfs and the OS if we do that.
Similar Threads
-
By JohnnyH in forum Hdd Install / Debian / Apt
Replies: 1
Last Post: 03-08-2007, 04:01 AM
-
By Steven Hair in forum Hdd Install / Debian / Apt
Replies: 2
Last Post: 09-29-2004, 03:04 PM
-
By maurovik in forum Laptops
Replies: 0
Last Post: 09-03-2004, 08:22 AM
-
By jazzback in forum Customising & Remastering
Replies: 0
Last Post: 06-01-2004, 12:52 AM
-
By A. Jorge Garcia in forum Hdd Install / Debian / Apt
Replies: 2
Last Post: 11-02-2003, 09:43 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
![Vintage DataDesk MAC 101E Model 1069 Keyboard QWERTY Bundle -Made in Taiwan picture](/store/img/g/mm8AAOSwsqRmhFr0/s-l225/Vintage-DataDesk-MAC-101E-Model-1069-Keyboard-QWER.jpg)
Vintage DataDesk MAC 101E Model 1069 Keyboard QWERTY Bundle -Made in Taiwan
$149.99
![Vintage Apple Mac Mini 1,1 Core Duo, 60GB HDD, 1.66GHz, 1GB RAM picture](/store/img/g/hhAAAOSwQ99mhyCU/s-l225/Vintage-Apple-Mac-Mini-1-1-Core-Duo-60GB-HDD-1-66G.jpg)
Vintage Apple Mac Mini 1,1 Core Duo, 60GB HDD, 1.66GHz, 1GB RAM
$42.99
![Vintage Apple Macintosh PowerBook G3 M4753 w/ Power Adapter picture](/store/img/g/iOUAAOSwxU1mh1xG/s-l225/Vintage-Apple-Macintosh-PowerBook-G3-M4753-w-Power.jpg)
Vintage Apple Macintosh PowerBook G3 M4753 w/ Power Adapter
$130.00
![Vintage 1993 Apple Computer Mac Macintosh Install Me First CD picture](/store/img/g/~JIAAOSwmdtmiAtD/s-l225/Vintage-1993-Apple-Computer-Mac-Macintosh-Install-.jpg)
Vintage 1993 Apple Computer Mac Macintosh Install Me First CD
$19.99
![Vintage Apple Power Macintosh 7200/120 Tested and Boots picture](/store/img/g/1xAAAOSwKN5mhvsF/s-l225/Vintage-Apple-Power-Macintosh-7200-120-Tested-and-.jpg)
Vintage Apple Power Macintosh 7200/120 Tested and Boots
$90.00
![Original Apple Macintosh M0001 - 1984 Vintage Computer in Working Condition picture](/store/img/g/8RwAAOSwM3RmhJth/s-l225/Original-Apple-Macintosh-M0001-1984-Vintage-Comput.jpg)
Original Apple Macintosh M0001 - 1984 Vintage Computer in Working Condition
$850.00
![VINTAGE APPLE MACINTOSH SE SUPER DRIVE COMPUTER M5011 POWER ON PARTS, REPAIR picture](/store/img/g/PMQAAOSwc~pmfEsa/s-l225/VINTAGE-APPLE-MACINTOSH-SE-SUPER-DRIVE-COMPUTER-M5.jpg)
VINTAGE APPLE MACINTOSH SE SUPER DRIVE COMPUTER M5011 POWER ON PARTS, REPAIR
$129.99
![Vintage Apple Power Macintosh G3 Computer M4405 - FP R3D picture](/store/img/g/al0AAOSw6VhmfzO~/s-l225/Vintage-Apple-Power-Macintosh-G3-Computer-M4405-FP.jpg)
Vintage Apple Power Macintosh G3 Computer M4405 - FP R3D
$150.00
![APPLE MACINTOSH SE All In One Vintage Computer Turns On - Model M5011 1988 picture](/store/img/g/c8QAAOSwY0BmYRFP/s-l225/APPLE-MACINTOSH-SE-All-In-One-Vintage-Computer-Tur.jpg)
APPLE MACINTOSH SE All In One Vintage Computer Turns On - Model M5011 1988
$249.93
![MACINTOSH IISI COMPUTER VINTAGE With Extras. picture](/store/img/g/M2YAAOSw8dhmg5u-/s-l225/MACINTOSH-IISI-COMPUTER-VINTAGE-With-Extras-.jpg)
MACINTOSH IISI COMPUTER VINTAGE With Extras.
$275.80