-
Place Knoppix into RAM when RAM >= 750MB? Now possible!
I don't know if this is possible or not, but I think it would be cool to have knoppix take a look at how much RAM the system has, and give the option to load itself into RAM if the user has more than, say 750 or 800MB. My thinking is that it could exist compressed in RAM, in the same way that it is compressed on the CDROM right now. The ram that is not used up to host the file system could be used to run applications, as normal.
If this is possible, I would imagine that this approach would give knoppix a major edge over everything else available. The hard drive is typically the slowest accessing part of any computer system, right? Well, actually the CDROM is slower, Knoppix runs off of CD, and therefore it takes a performance hit vs other distros. If Knoppix ran from RAM, though, it would be faster than HD based distros! It could just use the HD to store user data files [documents, bookmarks, etc.] persistantly between sessions. Additionally, this would free up the CDROM for normal operations again, since once the OS is loaded into RAM, the CD could be removed. Just think, it would be possible to load Knoppix, download an updated ISO to your /home directory (which is stores it on your hard drive), burn a new CD while Knoppix is running, and boot the new CD next time. Instant (clean) OS upgrade without having to worry about backing up your data files first.
I realize that most end users do not have that much RAM, but those who do typically have it just sitting around not doing anything. Plus I've heard it said that when designing a program, you should design for the system of tomorrow in mind, not the system of today. In just another year to two, most systems will contain gobs of RAM, and Knoppix could be ruling the world if it is prepared!
So what do you think? Is this a simple as copying everything into a giant ramdisk? Do I just not have any idea of what I'm talking about and the technical issues involved? I'd love to hear feedback on this idea.
-
Senior Member
registered user
Possible
Hi,
I'm somewhat familiar with knoppix and its associated technologies and I believe what you want to do is possible.
Btw. KNOPPIX / LiveCDs (especially with cloop) can be and are faster on my computer from cdrom then from harddisk.
I've looked a fairly long time at the code and think I have found a "solution" (it is no real problem).
You only need to alter the boot.img/miniroot.gz/linuxrc
Just mount the image, gunzip miniroot.gz, mount miniroot, change linuxrc according to idea below, unmount miniroot, gzip miniroot again, copy it back to boot.img, unmount boot.img and then most important step: syslinux boot.img to make it boot again.
Ok, so much for the instructions here is the idea: (Just search for cloop in linuxrc, and you'll find soon, what you seek)
if test -n "$FOUND_KNOPPIX" -a -f /cdrom/KNOPPIX/KNOPPIX; then
# DEBUG
# echo "6" > /proc/sys/kernel/printk
insmod -f /modules/cloop.o file=/cdrom/KNOPPIX/KNOPPIX
mountit /dev/cloop /KNOPPIX "-o ro" || FOUND_KNOPPIX=""
fi
ok, before the insmod we need to insert our code to copy it to Ramdisk (perhaps check if some parameter is missing, but thats just future, when it could be available as cheat code)
but, we don't have all necessary commands to do what we want to do cp, mv, mkdir ... all missing) .. so we let it mountit first from cdrom ...
Not tested (don't have so much ram, just the idea)
Code:
insmod -f /modules/cloop.o file=/cdrom/KNOPPIX/KNOPPIX
mountit /dev/cloop /KNOPPIX "-o ro" || FOUND_KNOPPIX=""
fi
COPYTORAM="yes" # yes we want to copy it
# CopyToRam ?
if test -n "$COPYTORAM";
then
# Pre-test if everything succeeded.
if test -n "$FOUND_KNOPPIX"
then
# copy library cache
cat /KNOPPIX/etc/ld.so.cache > /etc/ld.so.cache
echo ""
# Enable kernel messages
echo "6" > /proc/sys/kernel/printk
# Set paths
echo -n "${CRE}${BLUE}Setting paths...${NORMAL}"
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:."
export PATH
# Debian weirdness
/bin/cp -a /KNOPPIX/etc/alternatives /etc/ 2>/dev/null
# From here, we should have all essential commands available.
hash -r
echo "Copying /cdrom to RamDisk, this will take a while ..." # Hey, we could use some fancy dialog skript here :-))
mkdir /cdrom2
mount -t tmpfs -o size=800M /dev/shm /cdrom2
cp -a /cdrom/* /cdrom2 # Copy everything to /cdrom2; yes we need more things then only the KNOPPIX image, we don't want to produce problems we hadn't before, do we ?
export PATH= # reset path
umount /KNOPPIX # unmount it
umount /dev/cloop # release CD
umount /cdrom # unmount CD
insmod -f /modules/cloop.o file=/cdrom2/KNOPPIX/KNOPPIX
mountit /dev/cloop /KNOPPIX "-o ro" || FOUND_KNOPPIX="" # if everything else did suceeded so far, this will hopefully succeed too
# lets again do the initial stuff :-))
fi
fi
# Final test if everything succeeded.
if test -n "$FOUND_KNOPPIX"
then
# copy library cache
cat /KNOPPIX/etc/ld.so.cache > /etc/ld.so.cache
echo ""
# Enable kernel messages
echo "6" > /proc/sys/kernel/printk
# Set paths
echo -n "${CRE}${BLUE}Setting paths...${NORMAL}"
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:."
export PATH
# Debian weirdness
/bin/cp -a /KNOPPIX/etc/alternatives /etc/ 2>/dev/null
# From here, we should have all essential commands available.
hash -r
# Did we copy from ram ?
if test -n "$COPYTORAM";
then
rmdir /cdrom
ln -s /cdrom /cdrom2 # make a symlink and go on to normal boot
fi
Thats it! Only thing, that could make problems now is that there is another ramdisk for /home and /var mounted and there is not enough memory left to do so effiecently ...
Perhaps also in syslinux.cfg the size of the initial ramdisk has to be made bigger!
Then you can rewrite cdrom or boot from floppy!
And it "should" work!
Best Regards,
Fabian Franz
PS: Hope to hear from your efforts soon. If it wokrs successful maybe I can talk to Klaus to include it in official distribution (in 2005 )
-
Senior Member
registered user
Hehe. Yeah by 2005 we will all have plenty of RAM for this!
-
Thanks!
Wow, thanks for your answer, I would have never figured all that out on my own. As soon as I pay off my taxes, I hope to spend the $50 needed to buy another 512MB of RAM. Then I'll have enough of a system to try out this approach and report back on how well it works.
Thanks again for the info!
-
Junior Member
registered user
Great Idea...
I think this sounds like a great idea, perhaps Klaus should try to add a function like this to Knoppix.
After all it isnt that uncommon to have 1gb of ram today.
Couldnt this be added without to much trouble as a boot option / cheatcode?
-
This would be a great idea for systems that have a lot of RAM but only one CDROM drive.
-
Junior Member
registered user
Great idea
Yeah, and if you're running it from RAM you don't have to hear the extremly loud and annoying noise from the spinning cd-rom.
-
true that
-
More Strange Ideas
I just tried installing from CD to HD on my test system, and noticed that I was tapping my foot for a good 15 minutes while the contents of the CD were transferred over. I was thinking that it would take this long to boot up every time if we actually set the sytem up to pull from CD into RAM each time. It got me thinking of how to get around that, and I had another cool idea. Picture this:
Your hard drive contains the following parititions:
- a 300 MB swap partition
- a ?? GB /home partition
- a 700 MB /fastload partition
The /home partition would contain all your user files that you want to be persistant between sessions. (Mozilla bookmarks, OpenOffice documents, movies, songs, etc.) The /fastload partition would contain a copy of the ISO image from the CD. Then we could boot off the CD, load the kernel and some copy commands into RAM, and copy the contents of the CD from the HD image to create our filesystem in RAM, like we did before. Perhaps it would make sense to have a small /boot partition which would contain a kernel and some copy commands to put everything into memory. Then we wouldn't need to boot from CD each time.
OK, so now by pulling the filesystem from the HD instead of from the CD, we should have cut our boot time dramatically. Then I started thinking about keeping the system up to date. Perhaps if we downloaded a new package into our /home directory, we might be able to run a new command. "apt-get upgrade -kpx-double" or something similar. It would work the way you expect it to: it would update the filesystem in RAM with the contents of the new package -- but then it would mount the ISO image in /fastload, chroot over there, and update the package there too. That way the next time you reboot your system, you won't lose the changes that you made to the packages. This would have two, rather nice effects:
1) Knoppix could set up a system for distributing patches instead of users downloading a new ISO image every 3 days. That would cut down on their bandwidth, thus cutting their expenses.
2) At any time while running Knoppix, you could burn a new CD from the ISO that's in /fastboot, which would have all your updates applied to it. Not only would this be convenient for sharing with friends, but it would probably spawn a bunch of special purpose Knoppix clones. One might focus on Gnome, another might focus on Multimedia apps, etc.
I've been rambling much too long now. Obviously I'm talking about things that I only understand a little about, but I had such a nice response to my first post, that I thought I would throw these ideas out there and see what happened. That's the purpose of this forum right?
-
Wont you loose all of the software that's in the ram everytime you reboot???
ie, /ramdisk on KNOPPIX
Similar Threads
-
By colin stewart in forum Hdd Install / Debian / Apt
Replies: 4
Last Post: 03-23-2004, 02:18 AM
-
By desire in forum The Lounge
Replies: 5
Last Post: 02-19-2004, 05:06 AM
-
By Pierscoe1 in forum General Support
Replies: 3
Last Post: 12-16-2003, 05:18 PM
-
By smurfy__ in forum Customising & Remastering
Replies: 1
Last Post: 08-18-2003, 01:40 PM
-
By fingers99 in forum Hardware & Booting
Replies: 1
Last Post: 03-01-2003, 08:12 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
A-Tech 8GB DDR3 1600 PC3-12800 Laptop SODIMM 204-Pin Memory RAM PC3L DDR3L 1x 8G
$13.99
Samsung 16GB 2Rx4 PC4-2133P DDR4-17000 1.2V RDIMM ECC Registered Server Memory
$16.29
HyperX FURY DDR3 8GB 16GB 32GB 1600 MHz PC3-12800 Desktop RAM Memory DIMM 240pin
$12.90
Samsung 8 GB PC4-17000 DDR4-2133 1Rx8 DDR4 Desktop Memory HP P/N 798034-001
$10.00
A-Tech 16GB 2 x 8GB PC3-12800 Laptop SODIMM DDR3 1600 Memory RAM PC3L 16G DDR3L
$27.98
A-Tech 8GB PC3-12800 Desktop DDR3 1600 MHz Non ECC 240-Pin DIMM Memory RAM 1x 8G
$13.99
G.Skill RipJaws V 16GB (2x8GB) PC4-28800 (DDR4-3600) Memory F4-3600C16D-16GVKC
$23.50
Kingston HyperX FURY DDR3 8GB 16GB 32G 1600 1866 1333 Desktop Memory RAM DIMM
$13.25
A-Tech 256GB 4x 64GB 4Rx4 PC4-19200 ECC Load Reduced LRDIMM Server Memory RAM
$287.96
SAMSUNG M386A8K40BM2-CTD7Q 64GB 4DRX4 PC4-2666V DDR4 (21300) RAM SERVER MEMORY
$74.99