Benutzer jetzt online: 467 - Anmelden  » Suche  » Forum Index  

Robust USB Keys, even when removed improperly

CarolineM
wrote 1 year ago


reply
Hi,

I'm working on a project called "School Key" (www.schoolkey.org). The idea is to give each student in a school a USB key with a linux system which they can boot at any computer in the school and use at home.

One issue with this approach is we know kids are going to take out the USB key and walk away without waiting for the system to properly shut down. The bell will ring, a friend will ask them to come outside and play, and they will grab the USB and go.

Currently, I'm having problems with the USB going into "boot error" mode when its not treated with respect. Does anyone have any ideas on how to make the process more robust and/or self repairing?

One thought I have is that I don't actually want to save any state around any boot configuration. Can I make the files needed for boot read only?

Thanks,
Caroline
 
fundamental
wrote 1 year ago


reply
One possible solution is to partition the usb key into two sections.
Partition 1: Slax boot files
Partition 2: Changes directory and other storage

The Linux Live scripts in intrd could then be modified to always mount partition 1 read only, and when it goes to mount partition 2 it could check for errors (currently it is able to detect errors on partitions and mount them read only, so it should not be too difficult to add functionality). If it detects errors on the second partition it could start up fsck (with the needed options) on that partition. After the children corrupt the second partition a few times and have to wait through a mandatory fsck to boot, they might remove the usb prematurely less (While the fsck is running you should be able to display a message on why the filesystem might be corrupt).
 
him89
wrote 1 year ago


reply
one other solution is to make a whole root drive into a .lzm module and not use changes(always fresh mode) and make the students store what they need or make into a folder.

that way u will still be easily booting slax without the worry of a corrupted drive(works for me :) )

regards,

him89.
 
daveb
wrote 1 year ago


reply
I am working with Caroline. I created the two parition USB key.

Does anyone know of an efficient way to duplicate the key? I have used dd and that works pretty well but its difficult to distribute the image and explain how to create it to another person. Especially compared to the simple process to create a default slax usb key.

Is there any way to write a shell script for linux or batch file for windows to copy the image to a usb key?
 
PhilippeL
wrote 1 year ago


reply
daveb wrote:

Does anyone know of an efficient way to duplicate the key?

Is there any way to write a shell script for linux or batch file for windows to copy the image to a usb key?


YES. I am using something like your "School Key" for two years now. Every student must buy an USB key and it's up to me to fill it with Slax. It works very fine. I use some bash scripts that are present in every "School Key". Your can start with mine. I'm working for improving them, and plan to have a new release by the mid of january 2009.

Here is the main program (old fashion)
=============

#!/bin/sh
echo Making bootable the LAST plugged in USB disk
echo "Are-you sure that the new USB is plugged-in ? [Y]"
read YN
[ r$YN = r ] || exit 50
sleep 1
DEV=$( ls -rt /dev/sd* | tail -1 | cut -c 6-8)
echo The last plugged in USB disk is $DEV
echo Here is what Linux kernel thinks this device is :
dmesg | grep -B1 $DEV
#if [[ $DEV=sda ]] ; then
# echo sda refused
#exit 456
#fi
echo This will erase all data on it
echo "Do you wish to continue [y|N] ?"
read YN
[ r$YN = ry ] || exit 51
Plist=$(awk " /${DEV}./{print \$4} " /proc/partitions)
echo "umount-ing all partitions on $DEV :"
echo $Plist
for p in $Plist; do
grep /dev/$p /proc/mounts > /dev/null &&
(cmd="umount /dev/$p" ; echo "-->$cmd" ;$cmd || exit 101)
done

echo Making USB bootable system on target $DEV

echo Partionning '...'
echo "Main (FAT) partition size [230,400,800,1700] ?"
read T1
cmd="__cl_mkpart.sh /dev/${DEV} $T1"
echo '-->' $cmd ; $cmd

sync
echo Making filesystems ...
D1=/dev/${DEV}1
D2=/dev/${DEV}2
cmd="__cl_mkFS.sh $D1 $D2"
echo '-->' $cmd ; $cmd

echo Checking labels...
cmd="__cl_label.sh $D1 $D2"
echo '-->' $cmd ; $cmd

echo Copying '...'
cmd="__cl_copy.sh $D1 $D2"
echo '-->' $cmd ; $cmd

sync

echo Installing syslinux bootloader '...'
cmd="__cl_syslinux.sh $D1 $D2"
echo '-->' $cmd ; $cmd

echo ... Done !
cmd=sync
echo '-->' $cmd ; $cmd

cmd=sync
echo '-->' $cmd ; $cmd

echo You can unplug your new USB stick !

===================

More if you are interested.

PhL.
 
nimh
wrote 1 year ago


reply
Hello,
an other way can be to mount with "sync" option,
this will be real slowwwwwwwww for writing many tiny files,
reading is not affected, but you can be sure that nothing will
be lost. And it may wear the flash device(usb thumb) more than
usual.
Have a nice day!
 
Daniele
wrote 288 days ago


reply
Hi all,
Does anyone know an efficient way to make SLAX more robust when the system is not properly shut down?
Two partition? a read only partition?
I've got a big trouble with my little boy... he is too fast when takes out the USB key!!!
 
jayflood
wrote 288 days ago


reply
Do you mean you are having problems with the data on the USB device when it is 'pulled out' without unmounting? and you have corrupt data? Or do you mean a problem with slax itself not knowing the device is gone? Is your slax running from the hard drive?

I have seen a script around designed to help when a USB device is extracted prematurely. The most stable configuration i have seen (if slax runs on USB) is 2 partitions with the changes folder on a linux partition.
 
jcsoh
wrote 288 days ago


reply
"Does anyone know an efficient way to make SLAX more robust when the system is not properly shut down?"
Try this:
Slax in usb on two partitions(Fat32 and ext3)
http://www.slax.org/forum.php?logmein=1&action=view&parentID=46858
 
Daniele
wrote 287 days ago


reply
Hi jcsoh, thanks for your reply.
The only thing is that I didn't understand this:
"Note: Adapt the comands below and version syslinux to your needs."
I have to modify some config file?
bye.
 
jcsoh
wrote 287 days ago


reply
"Note: Adapt the comands below and version syslinux to your needs."

I think he meant the command above.
For eg if stated

open a terminal and...

cd /root/syslinux-3.82/mbr

If you are not using syslinux-3.82 say you are using syslinux-3.84
then you need to adapt

cd /root/syslinux-3.84/mbr
 
jayflood
wrote 287 days ago


reply
If you need something easier then you can use my scipt fom a slax livecd: It creates 2 partitions FAT32/EXT3
http://ibj.co.nz/main/slax/slax-usb.sh

or there is a module here: i have not tested this one
http://www.slax.org/modules.php?action=detail&id=2211
 

  » Suche  » Forum Index  

Post your reply

Your name (Login):

Message:

These HTML tags are allowed: <quote>, <b>, <u>, <i>, <pre>, <code>, <small>, <h1>, <h2>, <h3>, <li>



Visit Tomas M's blog for fun, mostly on religious idiocy.