PDA

View Full Version : add "toram" arguments for /var and /usr/local



helmingstay
06-09-2004, 05:17 AM
I love knoppix. I use it "live" (uninstalled) in a variety of situations. I'm looking for an easy workaround that allows apt-get to use the ramdisks for its operations.

The earliest I've seen this mentioned is July 2003. Having looked at the newest cheatcodes, here's my proposal:

Add to the "toram" option, allowing /usr/local and /var to be individually specified. This would allow a machine of modest means to be reconfigurable/extendable without HD installation.

probono
06-11-2004, 11:02 AM
You would need approx. 2 gb of RAM for /usr
You really need a translucency/overlay filesystem for what you want to to. But these where not usable with Knoppic in a stable way yet last time I checked.

helmingstay
06-14-2004, 03:35 AM
>You would need approx. 2 gb of RAM for /usr

Right.
Allow me to restate my proposal.
I plan to mount /usr/local separately.

Honestly, a "fresh" linux instillation *should* have an empty /usr/local.
Similarly, /var and /etc are primarily "dynamic" & site-specific

Why not mount these dynamic "local" filesystems into RAM whenever possible?

airplays
06-23-2004, 06:57 PM
I agree with this concept.

It would be ideal to be able to use TORAM with only certain directories or filesystems, rather than the way it is, which is "all or nothing", because who has enough ram for the entire CD?

helmingstay
06-24-2004, 03:50 AM
I agree with this concept.

who has enough ram for the entire CD?

Indeed. Maybe in 2-4 years...

I realize that the problem is designing a sane mount table. It seems that "mounting over" gives the most obvious solution.

Let's try the following simple hack as root on command line:



# cp -rp /var /ramdisk/my_var
# cp -rp /usr/local /ramdisk/my_local
# mount /ramdisk/my_var /var
# mount /ramdisk/my_local /usr/local

helmingstay
06-24-2004, 07:38 AM
Let's try the following simple hack as root on command line:


Hahahah. That was funny. If only it were so easy...
Here is what (sortof) works (with >256M RAM, pref 512M):

[code]
dd if=/dev/zero of=/ramdisk/tmpfile \
bs=1k count=200000
losetup /dev/loop0 /ramdisk/tmpfile
mkfs -t ext2 /dev/loop0
mount /dev/loop0 /mnt
cp -rp /KNOPPIX/var/* /mnt
umount /mnt
mount /dev/loop0 /var

----------
Note: If you don't have a HD partition, but you do have room on a rw HD partition, you can mount that and substiture
/yourHDpart/yourKnoppixDir for /ramdisk/tmpfile. Then, next boot, you just use the "losetup" and "mount var" commands.

Fabianx
06-29-2004, 10:11 PM
Let's try the following simple hack as root on command line:



# cp -rp /var /ramdisk/my_var
# cp -rp /usr/local /ramdisk/my_local
# mount /ramdisk/my_var /var
# mount /ramdisk/my_local /usr/local


You almost had it ;-).

Working:



# cp -rp /var /ramdisk/my_var
# cp -rp /usr/local /ramdisk/my_local
# mount --bind /ramdisk/my_var /var
# mount --bind /ramdisk/my_local /usr/local

No need to hassle ...

cu

Fabian

TyphoonMentat
06-30-2004, 05:57 PM
How about:

cp -pRH /usr/local /ramdisk
ln -sf /usr /ramdisk/local

helmingstay
07-01-2004, 02:00 AM
ln -sf /ramdisk/local /usr

Ah, but you can't write to /usr, can you? :)



Working:


# cp -rp /var /ramdisk/my_var
# cp -rp /usr/local /ramdisk/my_local
# mount --bind /ramdisk/my_var /var
# mount --bind /ramdisk/my_local /usr/local



Since Linux 2.4.0 it is possible to remount
part of the file hierarchy somewhere else. The call is
#mount --bind olddir newdir

Awesome! Ah, sweet commandline...

Now if only Debian would create a politically stable mechanism whereby apt-get can download packages for manual install into someplace like /usr/local <big pet peeve; i can't find the relevant flamewar link just now...>