Re: fsck and format the filesystem at startup in case of error

From: Abdullah Ramazanoglu (ar018.REMOVE_at_CAPS.yahoo.cöm)
Date: 07/05/04


Date: Mon, 05 Jul 2004 21:06:07 +0300

herc wrote:

> Hi,
>
> I want to change the fsck at startup for a particular partition
> (eg /dev/hdd3) in such a way that the fsck can't fix the error
> automatically it will not stop but format this partion again using
> mkfs.ext2 and send a messages to syslog.
> Can somebody tell me which startup script I have to change and how
> I can to this ? I using debian version 3.0. In the directory
> /etc/init.d I found a script checkfs.sh, since /dev/hdd3 is the
> only partion that will be mount as read-write ( the other
> partitions are mounted as ro) I suppose I need to change this
> script.
>
> Regards,
> herc

But checkfs.sh works for all partitions. So you must modify it in a
way it treats /dev/hdd3 specially (hardcoded).
I would prefer a different approach that doesn't interfere with
system startup scripts:

/etc/fstab ::
    # auto-fsck and mount on boot disabled
    /dev/hdd3 /mnt/hddthree ext3 noauto 0 0

/etc/rc2.d/S99zz.local -> /etc/init.d/zz.local ::
(Or, depending on your distro, /etc/rc.d/rc.local)
    e2fsck -py /dev/hdd3
    RC=$?
    [ $RC = 2 ] && reboot
    [ $RC > 3 ] && {
        echo "hdd3 went south.." | tee -a /var/log/syslog
        mke2fs -j -m1 /dev/hdd3 || echo "Antarctica."
    }
    mount /mnt/hddthree

Or something along that line. But, since /dev/hdd3 is mounted only
after the whole system is up and running, this setup won't work if
you must start some services that depend on /dev/hdd3 before you
reach the end of startup (zz.local).

P.S. Important to double check e2fsck return code meanings in your
version.

-- 
Abdullah        | aramazan@ |
Ramazanoglu     | myrealbox |
________________| D O T cöm |


Relevant Pages

  • Re: Large IPF files?
    ... *AND* it queries something about all the partitions. ... I've seen several apps that scan on startup ... means that fm/2 has more than a few ways to manually request rescans, ... The manual rescan requirement is OK if the ...
    (comp.os.os2.programmer.misc)
  • Re: Restrict browsing partitions/directories hard disk
    ... > I have a PC with 3 partitions: ... > cannot be run by that user anymore. ... > Does anyone have any idea how to restrict browsing to D: ... > while startup remains error-free and all programs can still be run? ...
    (microsoft.public.win2000.security)
  • Re: Snow Leopard and boot camp
    ... When I upgraded again to Snow Leopard the startup disk ... option in System preferences had neither of these partitions listed. ... the option key at startup but it has vanished for the System Preferences ... email to oshea dot j dot j at gmail dot com. ...
    (comp.sys.mac.system)
  • Re: O.S.X. is dead
    ... Tom Stiller wrote: ... all you would need to do is use Startup Disk to decide ... The Option key won't allow you to select between two startup partitions ...
    (comp.sys.mac.system)