How to run scandisk automatically

This howto is valid if your FREESCO is installed on a FAT or FAT32 partition only, so if you're using an EXT2 install, you cannot use this!

Sometimes you might find that you router is in read-only mode, after a power failure for instance.
The solution to fix this is to run scandisk 1) on the hard drive to return to a read/write file system.
However doing this manually every time on the router can be complicated (for instance if you have no monitor connected, or the router is in a distant place), so here is a solution that you can apply to do this automatically :

Prepare CONFIG.SYS

Boot your FREESCO to DOS and at the C:\> prompt create a CONFIG.SYS similar to this:

[menu]
MENUITEM = Dos, MS-DOS mode
MENUITEM = FREESCO, Start FREESCO, normal mode
MENUITEM = Setup, Start FREESCO, setup mode
MENUITEM = Debug, Start FREESCO, debug mode
MENUITEM = Shell, Start FREESCO, shell mode
MENUDEFAULT  FREESCO, 5

[Dos]
[FREESCO]
[Setup]
[Debug]
[Shell]

Prepare autoexec.bat

Your autoexec.bat should look like this:

@echo off
GOTO %CONFIG%

:Dos
GOTO :END

:FREESCO
router.bat
GOTO :END

:Setup
router.bat setup
GOTO :END

:Debug
router.bat debug
GOTO :END

:Shell
router.bat shell
GOTO :END

:END

Now boot your FREESCO using the new menu.

Finishing up

Make 2 copies of router.bat
name one router.faild
and one router.org
For instance at the console type :

cd /mnt/bootdev/router
cp router.bat router.faild
cp router.bat router.org


edit router.faild with :

edit router.faild

and add this line first :

scandisk /autofix /nosummary



Then edit rc_user, with :

edit /rc/rc_user

and in the start section (find this line) :

start) echo -n "Starting rc_user...                       "

add this line after :

cp /mnt/bootdev/router.faild /mnt/bootdev/router.bat



and a litlle further down the file search for (stop section) :

stop) echo -n "Stopping rc_user...                       "

and add this line after :

cp /mnt/bootdev/router.org /mnt/bootdev/router.bat


finally save the file with <alt+x>, y

This way if the router shuts down eg by power out or if the filesystem is readonly scandisk will run the next time you reboot your router and not every time you reboot. this to minemise the boot time if nothing is wrong with the filesystem.

1) scandisk must be installed on the hard-drive for this howto…
 
freesco/howtos/how-to_automatically_run_scandisk.txt (55411 views) · Last modified: 2007/01/20 21:27 (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki