PDA

View Full Version : I want /var/lib/mysql/foo to NOT be linked to /KNOPPIX!!!!



ace
03-11-2005, 02:46 AM
I have a database in /var/lib/mysql/ When I remaster and boot new CD, the file does not get copied to the ramdisk. It remains in the READONLY directory /KNOPPIX with only a link in the ramdisk. I have seen other posts asking for a solution to this but I have not seen any good solutions posted.

I have also noticed that some of the files under /var/ are not linked but are in fact copied over to the ramdisk. Who or what determines which files get copied over? Is it based on permissions, file ownership, wha that? Somebody please help. I have to have a bootable KNOPPIX cd with our mysql databases up and running by this weekend (3/12/05.)

I have read that moving them to /home/ might solve this problem. However, given that some /var/ files are ramdisk'ed, I am sure there is a way to ramdisk my files as well.

Any helpl greatly appreciated.

Ace

UnderScore
03-11-2005, 06:52 AM
According to my research, the ramdisk symlinks are created & controlled by the linuxrc script that is contained in the minirt24.gz file. See this post http://www.knoppix.net/forum/viewtopic.php?p=78447 and this post http://www.knoppix.net/forum/viewtopic.php?t=17509 where I dscuss the linuxrc file.

markpreston
03-11-2005, 10:07 PM
Try as root

rm -rf /var/lib/mysql
cp -rp /KNOPPIX/var/lib/mysql /var/lib
mysqld_safe &

once you have booted into your remastered knoppix CD

If this works you might like to look at this page
http://truth.positive-internet.com/~mpreston/tp/tp0412intro.html
for some further ideas.

ace
03-11-2005, 11:02 PM
Try as root

rm -rf /var/lib/mysql
cp -rp /KNOPPIX/var/lib/mysql /var/lib
mysqld_safe &

once you have booted into your remastered knoppix CD

If this works you might like to look at this page
http://truth.positive-internet.com/~mpreston/tp/tp0412intro.html
for some further ideas.

Problem is, this CD is for the sales guys to pass around at a show.... want to make it as idiot proof as possible. When is KNOPPIX 3.8 out anyway?

UnderScore
03-11-2005, 11:21 PM
From Knoppix 3.7, minirt24.gz, the linuxrc file, starting at line 611, showing how the symlinks are created.
# We need /bin/mount here for the -o size= option
/bin/mount -t tmpfs -o "size=${RAMSIZE}k" /ramdisk /ramdisk && mkdir -p /ramdisk
/home /ramdisk/var && ln -s /ramdisk/home /ramdisk/var /
echo "${BLUE}Done.${NORMAL}"
else
mkdir -p /home /var
fi

echo -n "${CRE}${BLUE}Creating directories and symlinks on ramdisk...${NORMAL}"
# Create common WRITABLE (empty) dirs
mkdir -p /var/run /var/backups /var/cache/apache /var/local /var/lock/news \
/var/nis /var/preserve /var/state/misc /var/tmp /var/lib \
/var/spool/cups/tmp /var/lib/samba /var/lib/nessus \
/mnt/cdrom /mnt/floppy /mnt/hd /mnt/test \
/home/knoppix /root /etc/sysconfig /etc/X11 /etc/cups /etc/dhcpc
chown knoppix.knoppix /home/knoppix
As for WHY the remaster links to /KNOPPIX, it is either in the linuxrc script or in the remastering scripts.
This is about as much I can help you.
James

ace
03-12-2005, 01:21 AM
I see the minirt24.gz file in my /mnt/hda1/knx/master/boot/isolinux/ directory. However, when I gunzip it, I get a huge binary file. How did you extract the text file? Is this the file I should modify to change how the links are created? And if so, do I just modify and then gzip it back, before I remaster?


Thanx


From Knoppix 3.7, minirt24.gz, the linuxrc file, starting at line 611, showing how the symlinks are created.
# We need /bin/mount here for the -o size= option
/bin/mount -t tmpfs -o "size=${RAMSIZE}k" /ramdisk /ramdisk && mkdir -p /ramdisk
/home /ramdisk/var && ln -s /ramdisk/home /ramdisk/var /
echo "${BLUE}Done.${NORMAL}"
else
mkdir -p /home /var
fi

echo -n "${CRE}${BLUE}Creating directories and symlinks on ramdisk...${NORMAL}"
# Create common WRITABLE (empty) dirs
mkdir -p /var/run /var/backups /var/cache/apache /var/local /var/lock/news \
/var/nis /var/preserve /var/state/misc /var/tmp [b]/var/lib \
/var/spool/cups/tmp /var/lib/samba /var/lib/nessus \
/mnt/cdrom /mnt/floppy /mnt/hd /mnt/test \
/home/knoppix /root /etc/sysconfig /etc/X11 /etc/cups /etc/dhcpc
chown knoppix.knoppix /home/knoppix
As for WHY the remaster links to /KNOPPIX, it is either in the linuxrc script or in the remastering scripts.
This is about as much I can help you.
James

UnderScore
03-12-2005, 02:43 AM
> How did you extract the text file?
See the second link in my first post above. In that thread i detail how to get access to the linuxrc file. I am not copying & pasting it because you should be able to read & find it.

> Is this the file I should modify to change how the links are created?
Yes I think it is. I do not know for sure as I am not a Knoppix developer.

> And if so, do I just modify and then gzip it back, before I remaster?
Yes. Again I believe it to be correct but I do not know for sure.

markpreston
03-12-2005, 05:03 AM
You might like to consider placing an icon on the KDE Desktop for users to click and automate the commands.
This link should help, if you decide to do this:
http://www.knoppix.net/forum/viewtopic.php?t=17445

I have found the following scripts work for start-up and saving and
restoring from a USB device. Naturally I'd be very interested in any more efficient alternative solutions.

For start-up LAMP KDE Desktop icon:

sudo /KNOPPIX/usr/local/bin/startLAMP

in /etc/skel/Desktop

and
#!/bin/bash
# Start Apache and MySQL. Put toophpix database into RAM. Open Mozilla browser.

/etc/init.d/apache start
rm -rf /var/lib/mysql
cp -rp /KNOPPIX/var/lib/mysql /var/lib
mysqld_safe &
mozilla "http://127.0.0.1/Toophpix/page3.php"

goes in /KNOPPIX/usr/local/bin/ directory


I use the same directories for the USB scripts.
For save to USB the commands I am using are:

sudo /usr/local/bin/saveToUSB

and
#!/bin/bash
# Back up toophpix data to USB device.

modprobe usb-storage
mkdir /mnt/usbstore
mount -t vfat /dev/sda1 /mnt/usbstore
mysqldump --opt -u root toophpix > /mnt/usbstore/toophpix.sql
umount /mnt/usbstore


For restore from USB the commands I am using are:

sudo /usr/local/bin/restoreFromUSB

and
#!/bin/bash
# Restore MySQL toophpix database from USB device

modprobe usb-storage
mkdir /mnt/usbstore
mount -t vfat /dev/sda1 /mnt/usbstore
mysql -u root toophpix < /mnt/usbstore/toophpix.sql
umount /mnt/usbstore


The umount commands at the end help ensure that the USB device can be
mounted if the user clicks on the
Desktop icon (Hard-Disk Partition sda1) that appears once Knoppix has
booted up or when the USB device is identified when inserted.
toophpix is the name of the database that is backed up.

knopx4me
03-21-2005, 11:54 AM
Try to add the following to the /etc/skel/init.d/knoppix-autoconfig file of the remastered distro just before starting kdm:

cp -rp /KNOPPIX/var/lib/mysql /var/lib

I am not expert in mysql so I do not know what permissions you should also add to the above. Try it, it should work.

ace
03-21-2005, 08:18 PM
Thanx for all who helped. Modifying the minirt file as suggested by UnderScore proved to be the easiest and most efficient. It also allowed me to make all kinds of other tweaks.

I am also going to play around with suggestions from knopx4me as I still need to give the marketing guys the ability to reset some databases after they tip them over "as part of their demo."

Thanx again guys.

UnderScore
03-21-2005, 08:32 PM
Thanx for all who helped. Modifying the minirt file as suggested by UnderScore proved to be the easiest and most efficient. It also allowed me to make all kinds of other tweaks.Thanks for getting back to us & letting us know how it went.
I am glad that I can help.
James

markpreston
03-21-2005, 11:07 PM
knopx4me wrote


Try to add the following to the /etc/skel/init.d/knoppix-autoconfig file of the remastered distro just before starting kdm:

cp -rp /KNOPPIX/var/lib/mysql /var/lib

I am not expert in mysql so I do not know what permissions you should also add to the above. Try it, it should work.

The -p option to the cp command preserves the permissions and should be all that is needed. Thanks for the information about the
/etc/skel/init.d/knoppix-autoconfig file.
One question which underscore may be able to help with regarding Knoppix 3.8, which I haven't tried yet. Does the unionfs system mean that a LAMP server
running under Knoppix 3.8 will not need any special commands to enable users to modify data? Will it just mean starting Apache and MySQL and away you go?
Thanks.

UnderScore
03-22-2005, 12:49 AM
Does the unionfs system mean that a LAMP server
running under Knoppix 3.8 will not need any special commands to enable users to modify data? Will it just mean starting Apache and MySQL and away you go?As far as I can tell, you do not need to modify anything. Now I have NOT done any testing in regards to 3.8 & LAMP but with 3.8 it should be "start & away you go". This is because UnionFS transparently mounts a portion of the systems's RAM (/ramdisk) on top of / (root of the knoppix CD filesystem). This enables the user to do things that were practically impossible such as using apt-get to update the apt DB and install software. And note that apt-get stores the downloaded .deb archive files in /var/cache/apt/archive.
So yes, 3.8 should make LAMP and/or other scenarios that need to write to /var very easy.

I hope this helps.
James

knopx4me
03-25-2005, 06:30 PM
Is Knoppix 3.8 out yet? Where I can download it?

Sorry to go out of topic.

UnderScore
03-26-2005, 01:40 AM
Is Knoppix 3.8 out yet? Where I can download it?

Sorry to go out of topic.Page 4 or page 5 of this http://www.knoppix.net/forum/viewtopic.php?t=17398 has a link to a bittorrent download for 3.8 Cebit Edition.