HDD Partitioning and rc.rofilesys
From OESF
Configuring the MicroDrive
copied from "the Grinder"
What we have now: Windows FAT32 Partition (/dev/hdc3)
What we want: Ext2/3 Partition, either convert the whole /dev/hdc3 or part of it.(Mine is actually only a 1Gb partition[Ext2])
Notes:
This partition is /dev/hdc3 on my SL-C3100, but I was told it is /dev/hda3 on some Zaurii. So check with df -h and replace if necessary.
- su
- umount /dev/hdc3 (if it doesnt unmount the you need to kill the apps using it, see KillApps)
- fdisk /dev/hdc
* Use command t on partition 3, on set it to 83 * Exit with w to save changes
- mke2fs -j /dev/hdc3
KillApps
- fuser -m /dev/hdc3
and kill them with kill -9 $PID where $PID is one the numbers returned by fuser.
Tweaking the boot process
Procedure:
- mount -o remount, rw /
- cd /
- mkdir /hdd4
- cd /root/etc/rc.d
- cp -p rc.rofilesys rc.rofilesys.org
- use you favorite text editor to edit rc.ro.filesys
If you try to reboot now, the Zaurus will complain about a HDD3 problem. You can make it boot anyway by hitting Ctrl-C
Indeed, this partition is mounted by the startup scripts, and the type is forced to FAT. So weâEUR(TM)ll just edit those scripts. You must first remount the root filesystem to read-write: mount -o remount,rw /. Now you can edit /root/etc/rc.d/rc.rofilesys.
Note: look at my rc.rofilesys for what has been changed (with a #)
Note: I have heard of this minor problem when using the Zaurus as an external hdd(with Linux of course) there is a problem with usbd.agent thinking its a fat filesystem, when its a ext3 filesystem, I will look into this soon as I have time.
Here is my rc.rofilesys, I have divided the drive into 4 partitions, /dev/hdc1,2,3,4, being ext3,ext3,fat,ext2. The added lines will be in bold. Again this is for a SL-C3100.
#!/bin/bash
#export PATH=$PATH:/usr/sbin.rom:/usr/bin.rom
DEBIANFMT=ext2 LINUXFMT=ext3 MKE2FSOPT= if [ âEURoe$LINUXFMTâEUR = âEURoeext3âEUR³ ]; then MKE2FSOPT=-j fi
#
# get device pcmcia_slot
# format: get_dev_pcmcia_slot [slot number]
# slot number: 0, 1
# output: device name (hda or hdc)
#
get_dev_pcmcia()
{
while read SOCKET CLASS DRIVER INSTANCE DEVS MAJOR MINOR;
do
echo $DEVS
done
}
get_dev_pcmcia_slot()
{
grep âEURoe^$1âEUR³ /var/lib/pcmcia/stab | get_dev_pcmcia
}
RW_MTD_LINE=`cat /proc/mtd | grep âEURoehomeâEUR | tail -n 1`
if [ âEURoe$RW_MTD_LINEâEUR = âEURoeâEUR ]; then
RW_MTD_LINE=`cat /proc/mtd | grep âEURoe\.*\<2\>âEUR | tail -n 1`
fi
RW_MTD_NO=`echo $RW_MTD_LINE | cut -d: -f1 | cut -dd -f2`
RW_MTD_SIZE_HEX=`echo $RW_MTD_LINE | cut -dâEUR âEUR -f2`
RW_MTD=/dev/mtd$RW_MTD_NO
RW_MTDBLK=/dev/mtdblock$RW_MTD_NO
RW_MTD_SIZE=`dc 0x$RW_MTD_SIZE_HEX 1024 /`
initlog -s $âEURfound $RW_MTD ${RW_MTD_SIZE}\âEURKbyte\âEUR"
#echo âEURoeZAURUS_RESET=$ZAURUS_RESET RW_MTD_NO=$RW_MTD_NO RW_MTD_SIZE_HEX=$RW_MTD_SIZE_HEXâEUR #ZAURUS_RESET=HARD if [ âEURoe$ZAURUS_RESETâEUR = âEURoeHARDâEUR ]; then
STRING=$âEURStarting filesystem: âEUR msg -n $STRING
# mount /home /sbin/eraseall $RW_MTD 2> /dev/null > /dev/null mount -t jffs2 -o rw,noatime $RW_MTDBLK /home cd / tar xf /root/.home_default.tar
# mount /dev dd if=/dev/zero of=/dev/ram1 bs=1024 count=64 2> /dev/null > /dev/null mkfs.minix -i 512 /dev/ram1 64 2> /dev/null > /dev/null mount -t minix /dev/ram1 /dev (cd /home ; tar cf - dev | (cd / ; tar xf -))
# mount /tmp mount -t tmpfs -o size=1m none /dev/shm mkdir /dev/shm/tmp chmod 4777 /dev/shm/tmp mkdir /dev/shm/run touch /dev/shm/run/utmp mkdir /dev/shm/run/usb
/etc/ledmode reset
# mount HDD /etc/rc.d/init.d/pcmcia start while [ âEURoe$IDE1âEUR³ = âEURoeâEUR ]; do IDE1=`get_dev_pcmcia_slot 1` done
if [ âEURoe$HDDCLEARâEUR = âEURoeYESâEUR ]; then
dd if=/dev/zero of=/dev/${IDE1}2 > /dev/null 2> /dev/null
fi
mke2fs $MKE2FSOPT /dev/${IDE1}2 2> /dev/null > /dev/null
e2fsck -p /dev/${IDE1}2 > /dev/null
if [ âEURoe$HDDCLEARâEUR = âEURoeYESâEUR ]; then
dd if=/dev/zero of=/dev/${IDE1}3 > /dev/null 2> /dev/null
fi
mkfs.vfat -F 32 /dev/${IDE1}3 2> /dev/null > /dev/null
mount -t $LINUXFMT -o ro,noatime /dev/${IDE1}1 /hdd1
rc=$?
if [ âEURoe$rcâEUR != âEURoe0âEUR³ ]; then
echo -n âEURoeHDD1 Error!! âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
mount -t $LINUXFMT -o noatime /dev/${IDE1}2 /hdd2
rc=$?
if [ âEURoe$rcâEUR != âEURoe0âEUR³ ]; then
echo -n âEURoeHDD2 Error!! âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
mount -t vfat -o noatime,quiet,umask=000,iocharset=utf8 /dev/${IDE1}3 /hdd3
rc=$?
if [ âEURoe$rcâEUR != âEURoe0âEUR³ ]; then
echo -n âEURoeHDD3 Error!! âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
mount -t $DEBIANFMT -o noatime /dev/${IDE1}4 /hdd4
rc=$?
if [ âEURoe$rcâEUR != âEURoe0âEUR³ ]; then
echo -n âEURoeHDD4 Error!! âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
if [ ! -f /hdd1/.sys/hdimage2.tgz ]; then
echo âEURoeError!! HDD is not initialized!âEUR
fi
cd /
gzip -dc /hdd1/.sys/hdimage2.tgz | tar xf -
sltime -clear
rc=$? if [ âEURoe$rcâEUR = âEURoe0âEUR³ ]; then success âEURoe$STRINGâEUR else failure âEURoe$STRINGâEUR fi msg
else ### SW Reset !
#STRING=$âEURChecking filesystem: âEUR
# mount /home mount -t jffs2 -o rw,noatime $RW_MTDBLK /home
# mount /dev dd if=/dev/zero of=/dev/ram1 bs=1024 count=64 2> /dev/null > /dev/null mkfs.minix -i 512 /dev/ram1 64 2> /dev/null > /dev/null mount -t minix /dev/ram1 /dev (cd /home ; tar cf - dev | (cd / ; tar xf -))
if [ -f /home/etc/restorepc ]; then RESTORE_CONNECTION=`cat /home/etc/restorepc` else RESTORE_CONNECTION=âEUR" fi if [ âEURoe$RESTORE_CONNECTIONâEUR != âEURoeâEUR ]; then
cp /home/etc/restoreip /dev/restoreip 2> /dev/null > /dev/null cp /home/zaurus/Settings/Security.conf /dev/Security.conf 2> /dev/null > /dev/null umount $RW_MTDBLK /sbin/eraseall $RW_MTD 2> /dev/null > /dev/null mount -t jffs2 -o rw,noatime $RW_MTDBLK /home mount -t tmpfs -o size=1m none /dev/shm mkdir /dev/shm/tmp chmod 4777 /dev/shm/tmp mkdir /dev/shm/run touch /dev/shm/run/utmp mkdir /dev/shm/run/usb cd / tar xf /root/.home_default.tar rm -rf /home/zaurus/Applications/Contents/
/etc/ledmode reset
# mount HDD /etc/rc.d/init.d/pcmcia start while [ âEURoe$IDE1âEUR³ = âEURoeâEUR ]; do IDE1=`get_dev_pcmcia_slot 1` done
mount -t $LINUXFMT -o ro,noatime /dev/${IDE1}1 /hdd1
rc=$?
if [ âEURoe$rcâEUR != âEURoe0âEUR³ ]; then
echo -n âEURoeHDD1 Error!! âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
mke2fs $MKE2FSOPT /dev/${IDE1}2 2> /dev/null > /dev/null
e2fsck -p /dev/${IDE1}2 > /dev/null
mount -t $LINUXFMT -o noatime /dev/${IDE1}2 /hdd2
rc=$?
if [ âEURoe$rcâEUR != âEURoe0âEUR³ ]; then
echo -n âEURoeHDD2 Error!! âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
cd /
# Documents files are discardedâEUR¦
gzip -dc /hdd1/.sys/hdimage2.tgz | tar xf -
mount -t vfat -o noatime,quiet,umask=000,iocharset=utf8 /dev/${IDE1}3 /hdd3
rc=$?
if [ âEURoe$rcâEUR != âEURoe0âEUR³ ]; then
echo -n âEURoeHDD3 Error!! âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
mount -t $DEBIANFMT -o noatime /dev/${IDE1}4 /hdd4
rc=$?
if [ âEURoe$rcâEUR != âEURoe0âEUR³ ]; then
echo -n âEURoeHDD4 Error!! âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
if [ ! -f /hdd1/.sys/hdimage2.tgz ]; then
echo -n âEURoeError!! HDD is not initialized!âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
rm /home/zaurus/Settings/route.conf 2>/dev/null >/dev/null echo -n $RESTORE_CONNECTION > /home/zaurus/Settings/route.conf touch /home/etc/restorepc mv /dev/restoreip /etc/hotplug/usbdnet.conf 2> /dev/null > /dev/null mv /dev/Security.conf /home/zaurus/Settings/Security.conf 2> /dev/null > /dev/null
else # mount /tmp mount -t tmpfs -o size=1m none /dev/shm mkdir /dev/shm/tmp chmod 4777 /dev/shm/tmp mkdir /dev/shm/run touch /dev/shm/run/utmp mkdir /dev/shm/run/usb
/etc/ledmode reset
# mount HDD /etc/rc.d/init.d/pcmcia start while [ âEURoe$IDE1âEUR³ = âEURoeâEUR ]; do IDE1=`get_dev_pcmcia_slot 1` done
mount -t $LINUXFMT -o ro,noatime /dev/${IDE1}1 /hdd1
rc=$?
if [ âEURoe$rcâEUR != âEURoe0âEUR³ ]; then
echo -n âEURoeHDD1 Error!! âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
mount -t $LINUXFMT -o noatime /dev/${IDE1}2 /hdd2
rc=$?
if [ âEURoe$rcâEUR != âEURoe0âEUR³ ]; then
echo -n âEURoeHDD2 Error!! âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
mount -t vfat -o noatime,quiet,umask=000,iocharset=utf8 /dev/${IDE1}3 /hdd3
rc=$?
if [ âEURoe$rcâEUR != âEURoe0âEUR³ ]; then
echo -n âEURoeHDD3 Error!! âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
mount -t $DEBIANFMT -o noatime /dev/${IDE1}4 /hdd4
rc=$?
if [ âEURoe$rcâEUR != âEURoe0âEUR³ ]; then
echo -n âEURoeHDD4 Error!! âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
if [ ! -f /hdd1/.sys/hdimage2.tgz ]; then
echo -n âEURoeError!! HDD is not initialized!âEUR
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ âEURoe$DUMMYâEUR = âEURoeâEUR ]; do
sleep 1
done
fi
fi fi echo $LAUNCH > /home/sharp/etc/launch.default

