Tuesday, August 08, 2006

Modification to "Beginners Guide To Creating A Live CD With LFS 6.0"

Above all I would like to say thanks to Michael Hernandez, who wrote that guide. On may I had to do a job that needed a liveCD, I used Kwort and with that guide it was very easy to do.
My problem was that all the computers that were going to use that CD were very old, and had few ram...
So far so good... But two ramdisks of the same size? There was a ram limitation, so I couldn't use two.
So I had to find a solution. This is what I did to fix it:

dev_ram="/dev/ram1"
dir_ramdisk="/fake/ramdisk"
dir_needwrite="/fake/needwrite"
echo "Creating ext2fs on $dev_ram..."
/sbin/mke2fs -m 0 -i 1024 -q $dev_ram > /dev/null 2>&1
# MOUNT THE RAM DISK
echo "Mounting ramdisk on $dir_ramdisk..."
mount -n $dev_ram $dir_ramdisk -t ext2
# COPY FILES TO THE RAM DISK
echo "Copying files to ramdisk..."
cp -a $dir_needwrite/* $dir_ramdisk > /dev/null 2>&1
mount -n $dev_ram $dir_needwrite
umount -n $dir_ramdisk


The trick is this: What I do is to mount the same ramdisk in two places and then umount the old location. And because one is already mounted when you mount it again in the other location you don't have data lost.

No comments: