PDA

View Full Version : burn_home Persistent Home Burn CD CDRW CDR Backup



paradocs
05-30-2003, 04:35 AM
I present burn_home as method for keeping persistent
home on a CD record or CD read-write. For repeated
use, the CDRW is the best. The following topics may
help in organizing discussion:

0. Usual warnings --> I really don't know much, my
English is poor, my German is worse. So don't depend
on anything.

1. Goal and Uses
The advantage of this use of KNOPPIX is to proved
a low cost, portable, secure computer environment.
Student, library, multi-user family, high security,
demonstration projects and public computers may
be a good match. Speed and limited installation
of new software are among many disadvantages.

2. Target Computer
one floppy
CD drive
500 MB memory ( less can work, more is better )
sound
Internet connection
Second CDRW ( I have a USB2 CDRW )
( these scripts assume cdrom1 dev=1,0,0 )
(enter cdrecord -scanbus to get dev=?,?,? )
No hard drive is present.
A printer, DVD and scanner may be added.

3. Methods, Scripts and Interface
I have used a very simple approach. I am sure
there are better ways to accomplish this.

4. Bugs and Problems
So far all appears to be working but I get an
annoying message after boot up that a program
is not found. Just click OK and ignore it.
I have not checked many applications to date.

5. Security
I don't know much about this. I am sure the
home.iso could be encrypted and compressed
to make the CDRW secure. But keeping the
CD with you and locked up is the first step.

6. New Features and Other
How about automatically installing packages on
booting? Merging or splitting a persistent homes?
Sending or saving the home.ios file on the Internet?

7. KNOPPIX Adoption
Some built in features for Knoppix would be great.
What needs to be done to make burn_home an
easily used option?

Steps to make it work:

1. Make a boot floppy from the KNOPPIX CD
2. Start knoppix
3. Text edit the file syslinux.cfg on the boot floppy.
After the first BOOT_IMAGE=knoppix add -->
myconfig=/mnt/cdrom1
and in my case I also added -->
wheelmouse alsa lang=us
4. Click Home --> right click --> Create New
--> Directory --> (type) burn_home -->OK
5. Open it and create the text files in steps a,b,c,d

5a. burn_home_erase.sh
#!/bin/sh
cdrecord -v speed=4 dev=1,0,0 blank=fast
mkisofs -r -o /ramdisk/home.iso /ramdisk/home/knoppix
cdrecord -v speed=4 dev=1,0,0 -data /ramdisk/home.iso
rm -f /ramdisk/home.iso
eject cdrom1

5b. burn_home_noerase.sh
#!/bin/sh
#cdrecord -v speed=4 dev=1,0,0 blank=fast
mkisofs -r -o /ramdisk/home.iso /ramdisk/home/knoppix
cdrecord -v speed=4 dev=1,0,0 -data /ramdisk/home.iso
rm -f /ramdisk/home.iso
eject cdrom1

5c. burn_home_blank.sh
#!/bin/sh
cdrecord -v speed=4 dev=1,0,0 blank=fast
#mkisofs -r -o /ramdisk/home.iso /ramdisk/home/knoppix
#cdrecord -v speed=4 dev=1,0,0 -data /ramdisk/home.iso
#rm -f /ramdisk/home.iso
eject cdrom1

5d. burn_home_restore.sh
#!/bin/sh
mkdir /ramdisk/tmp
mkdir /ramdisk/tmp/burn_home
cp -rpf /mnt/cdrom1/* /ramdisk/tmp/burn_home
cp -rpf /mnt/cdrom1/.* /ramdisk/tmp/burn_home
rm /ramdisk/tmp/burn_home/.DCOPserver*
rm /ramdisk/tmp/burn_home/.ICEauthority
cp -rpf /ramdisk/tmp/burn_home/* /ramdisk/home/knoppix
cp -rpf /ramdisk/tmp/burn_home/.* /ramdisk/home/knoppix
chown -R knoppix:knoppix /ramdisk/home/knoppix
chmod -R u+w /ramdisk/home/knoppix
rm -rf /ramdisk/tmp
#add lines to configure devices as root
eject cdrom1

6. Adjust your KDE desktop features like background, clock font,
icon size, printer. Put in an empty floppy and K --> KNOPPIX
-->Configure --> Save Knoppix Configuration --> OK
--> floppy
Now copy the two file on the floppy, configs.tbz and
knoppix.sh, to your home directory. Whenever you change
settings you may need to repeat this step in the future.

7. Open the Autostart folder by clicking
View --> Show Hidden Files --> .kde --> Autostart
Now copy into this folder the file in section 5d called
burn_home_restore.sh

Bonnus: You may remove showindex.desktop if you
do not want the intoduction to show or add your own
tribute to knoppix. To confugure scanners and your
Internet settings burn_home_restore.sh can also modify
files in the root/etc/sane.d and other directores.

8. Open burn_home, place a CDRW disk to be overwritten,
and click once on burn_home_erase.sh and wait. I wish
there was a progress bar but if your CDRW supports software
eject, then you will know all is done when the disk pops out.
One nice feature of burn_home is that you can and should
keep multiple copies as backups.

9. Normal operation: Reboot with the boot floppy, the
KNOPPIX CD in the first CD tray, and the burn_home disk
in the second CD tray. Disregard the message saying
“Couldn't find the program ...” and click OK.

That is it. I hope I did not forget too much. If it does not
work ( or if it does ! ) let us hear from you.

Best Wishes,
paradocs

paradocs
08-02-2003, 07:11 AM
Hi All

Here is an update of burn_home,
it has been on the back burner too long.

A single script place in /home/knoppix/desktop is all that is needed
for the crrent version.

Copying the code may present a problem since some of
the lines may wrap. Be sure they are kept as one long line.
Be sure to use unix end of line format with no trailing spaces.
I will try to get a real page so these can be down loaded.

For help see:
http://www.knoppix.net/docs/index.php/BurnHome


#!/bin/bash
BH_BURNER="cdrom1"
BH_CDRW_DEV="1,0,0"
BH_CDRW_SPEED="4"
BH_KEY_DRIVE="/mnt/hda1"
BH_ENCRYPT_SIZE="25"
BH_SHOW_ENCRYPT_CHOICE=0
#enter 0 to show -or- 1 to skip meneu asking if you want public or encrypted
#version 11/15/2003
su
mkdir /ramdisk/tmp
mkdir /ramdisk/home/knoppix/.burn_home
mkdir /ramdisk/home/knoppix/.burn_home/Auto_install
mkdir /ramdisk/home/knoppix/.burn_home/Auto_wget
echo $BH_CDRW_DEV 1> /ramdisk/tmp/dev
DEV1=`gawk -F , '{print $1}' /ramdisk/tmp/dev`
DEV2=`gawk -F , '{print $2}' /ramdisk/tmp/dev`
DEV3=`gawk -F , '{print $3}' /ramdisk/tmp/dev`
cat >"/home/knoppix/.kde/Autostart/burn_home_restore.sh" <<EOT
#!/bin/sh
mkdir /ramdisk/tmp
mkdir /ramdisk/home/knoppix/dist
mkdir /ramdisk/home/knoppix/dist/bin
mkdir /ramdisk/home/knoppix/dist/man
mkdir /ramdisk/home/knoppix/dist/lib
mkdir /ramdisk/home/knoppix/dist/etc
mkdir /ramdisk/home/knoppix/dist/doc
mkdir /ramdisk/home/knoppix/dist/src
cp -rpf /ramdisk/home/knoppix/.DCOPserver* /ramdisk/tmp
cp -rpf /ramdisk/home/knoppix/.ICEauthority /ramdisk/tmp
#if public CD
if [ -e /mnt/$BH_BURNER/burn_home.tar ] ; then
tar -pPtf /mnt/$BH_BURNER/burn_home.tar | while read i; do rm -f "$i"; done
tar -pPxf /mnt/$BH_BURNER/burn_home.tar
fi
#if encrypt CD
if [ -e /mnt/$BH_BURNER/.crypto ] ; then
umount /dev/loop0
losetup -d /dev/loop0
losetup -e AES -p 0 /dev/loop0 /mnt/$BH_BURNER/.crypto <$BH_KEY_DRIVE/key
mkdir /ramdisk/crypto
mount -t ext2 /dev/loop0 /ramdisk/crypto
chown knoppix:knoppix -R /ramdisk/crypto
tar -pPtf /ramdisk/crypto/burn_home.tar | while read i; do rm -f "$i"; done
tar -pPxf /ramdisk/crypto/burn_home.tar
umount /dev/loop0
losetup -d /dev/loop0
fi
#if tar files exist in /home/knoppix/.burn_home/Autoinstall -- install them
cd /home/knoppix/.burn_home/Auto_install
rm -f /ramdisk/tmp/Auto_install
find /home/knoppix/.burn_home/Auto_install -type f > /ramdisk/tmp/Auto_install
cd /
cat /ramdisk/tmp/Auto_install | while read i; do tar -C / -xvvf "\$i"; done
sed '/export PATH=/d' /ramdisk/home/knoppix/.bashrc > /ramdisk/tmp/.bashrc
mv -f /ramdisk/tmp/.bashrc /ramdisk/home/knoppix/.bashrc
echo "export PATH=$PATH:/ramdisk/home/knoppix/dist/bin" >> /ramdisk/home/knoppix/.bashrc
export MANPATH="/ramdisk/home/knoppix/dist/man"
cp -rpf /ramdisk/tmp/.DCOPserver* /ramdisk/home/knoppix
cp -rpf /ramdisk/tmp/.ICEauthority /ramdisk/home/knoppix
#modify root directories to set up devices
chown -R knoppix.knoppix /ramdisk/home/knoppix
chmod -R u+w /ramdisk/home/knoppix
rm -f /ramdisk/home/knoppix/burn_home.tar
eject $BH_BURNER
exit
EOT
sudo chmod ugo+rwx /home/knoppix/.kde/Autostart/burn_home_restore.sh
# install burn_home_restore.sh in configs.tbz
cp -f /home/knoppix/configs.tbz /ramdisk/tmp/configs.tbz
rm -f /ramdisk/tmp/configs.tar
bzip2 -d /ramdisk/tmp/configs.tbz
rm -f /ramdis/tmp//config.tbz
tar --delete -pPf /ramdisk/tmp/configs.tar /home/knoppix/.kde/Autostart/burn_home_restore.sh
tar --append -pPf /ramdisk/tmp/configs.tar /home/knoppix/.kde/Autostart/burn_home_restore.sh
bzip2 /ramdisk/tmp/configs.tar
cp -f /ramdisk/tmp/configs.tar.bz2 /home/knoppix/configs.tbz
rm -f /ramdisk/tmp/configs.tar.bz2
## end of updateing configs.tbz
XDIALOG_HIGH_DIALOG_COMPAT=1
export XDIALOG_HIGH_DIALOG_COMPAT
XDIALOG_INFOBOX_TIMEOUT=1000000
export XDIALOG_INFOBOX_TIMEOUT
Xdialog --title "Burn_Home" --yesno "\
Edit it first lines of the burn_home\n\
script to change these setting.\n\n\
Burner's name ... $BH_BURNER\n\
Burner's #,#,# ... $BH_CDRW_DEV\n\
Burn Speed ... $BH_CDRW_SPEED\n\
EncryptKey Drive ... $BH_KEY_DRIVE\n\
Encrypt MB SIZE ... $BH_ENCRYPT_SIZE\n\n\
This CD will be BURNED\n\
This will take 10 to 15 minutes.\n\n\
Press Yes Press No\n\
to proceed to stop.\n\n\
I have read the Please read the\n\
Copyright and Copyright and\n\
GNU License. GNU License." 25 45
EXIT_CODE=$?
if [ $EXIT_CODE -eq 1 ] ; then
Xdialog --title "Burn_Home" --msgbox "\
Copyright (C) 2003 David M. Tan Creti <paradocs@hotmail.com>\n\n\
This program is free software; you can redistribute it and/or\n\
modify it under the terms of the GNU General Public License\n\
as published by the Free Software Foundation; either version 2\n\
of the License, or (at your option) any later version.\n\n\
This program is distributed in the hope that it will be useful,\n\
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
See the GNU General Public License for more details.\n\n\
You should have received a copy of the GNU General Public License\n\
along with this program; if not, write to the\n\
Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n\
Boston, MA 02111-1307, USA.\n\n\
Click OK -- Thank you for your support." 25 75
exit
fi
EXIT_CODE_ENCRYPT=0
if [ $BH_SHOW_ENCRYPT_CHOICE -eq 0 ] ; then
Xdialog --title "Burn_Home" --yesno "\
Make a publicly readable CD:\n\n\
Hit YES to save Hit NO to\n\
to the CD without Encrypt AES\n\
encrypting. Allow Key is saved on\n\
data to be read by $BH_KEY_DRIVE \n\
other computers. in file key." 25 45
EXIT_CODE_ENCRYPT=$?
fi
Xdialog --title "Burn_Home" --yesno "\
Hit YES Hit NO\n\
to ERASE for a CD-R or a\n\
a CD-RW PreBlanked CD-RW\n\
disk. disk." 25 45
EXIT_CODE=$?
Xdialog --title "BurnHome" --infobox "\
Please wait for\n Validation Message" 25 45 &
if [ $EXIT_CODE -eq 0 ] ; then
cdrecord -v speed=$BH_CDRW_SPEED dev=$DEV1,$DEV2,$DEV3 blank=fast
fi
rm -f /ramdisk/home/knoppix/burn_home.tar
tar -cpPf /ramdisk/home/knoppix/burn_home.tar /ramdisk/home/knoppix/
cd /ramdisk/home/knoppix
rm -f /ramdisk/tmp/burn_home.md5
if [ $EXIT_CODE_ENCRYPT -eq 0 ] ;then
md5sum /ramdisk/home/knoppix/burn_home.tar > /ramdisk/tmp/burn_home.md5
mkisofs -joliet-long -o /ramdisk/home.iso /ramdisk/home/knoppix
else
#make encrypted
umount /dev/loop0
losetup -d /dev/loop0
rm -f /ramdisk/.crypto
mkdir -p /ramdisk/crypto
dd if=/dev/urandom of=/ramdisk/.crypto bs=1024k count=25
losetup -e AES -p 0 /dev/loop0 /ramdisk/.crypto <$BH_KEY_DRIVE
mke2fs -b 1024 /dev/loop0
mount -t ext2 /dev/loop0 /ramdisk/crypto
cp -dpr /home/knoppix/burn_home.tar /ramdisk/crypto
umount /dev/loop0
losetup -d /dev/loop0
md5sum /ramdisk/.crypto > /ramdisk/tmp/burn_home.md5
mkisofs -joliet-long -o /ramdisk/home.iso /ramdisk/.crypto
fi
cdrecord -v speed=$BH_CDRW_SPEED dev=$DEV1,$DEV2,$DEV3 -data /ramdisk/home.iso
eject $BH_BURNER
rm -f /ramdisk/home.iso
rm -f /ramdisk/home/knoppix/burn_home.tar
rm -f /ramdisk/burn_home.md5
if [ $EXIT_CODE_ENCRYPT -eq 0 ] ; then
cd /mnt/cdrom1
md5sum /mnt/$BH_BURNER/burn_home.tar >> /ramdisk/tmp/burn_home.md5
else
cd /mnt/cdrom1
md5sum /mnt/$BH_BURNER/.crypto >> /ramdisk/tmp/burn_home.md5
fi
cd /
awk '{ printf "%1s ", $1 }' /ramdisk/tmp/burn_home.md5 > /ramdisk/burn_home.md5
ValidResult=`awk '$1 == $2 {print "CD Burn was GOOD" ; next };\
{print "CD Burn was BAD"}' /ramdisk/burn_home.md5`
killall "Xdialog"
Xdialog --title "Burn_Home" --msgbox "\
$ValidResult\n\n--->IF BAD REDO<---\n\n\
Click OK -- Remove CD" 30 30
rm -f /ramdisk/burn_home.md5
rm -f /ramdisk/tmp/burn_home.md5
rm -f /ramdisk/tmp/dev
eject $BH_BURNER
exit


Best Wishes
paradocs

Fruitloaf
10-07-2003, 04:13 PM
That sounds great, is there any way to change this so that it would keep the home directory on a USB stick device. I'd like to be able to take my OS to any computer I wanted to use and obviously they won't all have 2 CD drives so I'd like to be able to just carry around my knoppix CD and a USB stick.

paradocs
10-08-2003, 05:54 AM
Greetings Fruitloaf,

Thanks for your interest.
This is a specialized project and still in the early
stages. I am continuing to make quite a few changes. This
is not at all the standard way for keeping and
restoring your home files.

You are quite right that the USB stick is the way to
go. This is built into KNOPPIX.
Click on
K --> KNOPPIX --> Configure -->
Create persistent home (read about the options)
Hard drive partitions are hda1 .. hda4
and ubs sticks show up as sda1 ....

The beauty and fun of KNOPPIX is there is so
many different uses and possibilities to explore.

Best Wishes,
paradocs

Fruitloaf
10-08-2003, 08:54 AM
Thanks for that, I've recently found a few how-tos on doing what I want. I've been daubling with linux for a few years now and knoppix seems to be what I really want. It lets me use linux without having to bother my normal windows boxes at all or even to just take my OS to my girlfriends computer whenever I'm at her flat.

Basically there are so many useful ways of using it that I'm not even going to try to go into them here :)

cybergeo3
03-29-2004, 07:35 AM
im kind of new to linux, ive been playing around with knoppix and am loving it. i'm trying to create the persistant home and am having some problems. first of all, my 2 cdrom drives are switched in order for some reason, i dont know why, they always have been, my writable drive comes first, in windows its d and in knoppix its cdrom, while the drive i run the live cd is cdrom1. i accounted for this while editing the bootdisk, and rewrote the 3 occurances of cdrom1 i found in the shell script.
the problem i have is when i click on the burn_home script, it doesnt do anything. now ive been playing around and i think the problem is my writable drive isnt being recognized by knoppix, when i put in a cd and try to access it, it gives me an error, i cant eject the drive from the right click menu, etc. so maybe this isnt the topic to be asking this problem, but its in regard to the burn_home, and i figured you could point me in the direction if im missing a step in adjusting for my cd drive order. thanks for any help, i can be more specific if you need more info, i await your response.

george

paradocs
03-29-2004, 09:52 PM
Hello cybergeo3,

Thanks for trying burn_home.

First let me point out that this is a sepcal project and
that for most users the best is to keep your persistent
home on a hard drive or a usb memory stick.

Unfortunately different versions and hardware setups
do give different values for cdrom cdrom1 and
also for the the device numbers to make cdrecord
work. enter cdrecord -scanbus to get these.
then set the 3 numbers in BH_CDRW_DEV="1,0,0"

I am monitoring IRC #knoppix on freenode.net and
can give more help there.

Best Wishes,
pardocs