Results 1 to 3 of 3

Thread: Ext3 filesystem automatic reboot is it possible?

  1. #1
    Junior Member
    Join Date
    Nov 2004
    Posts
    3

    Ext3 filesystem automatic reboot is it possible?

    Ok So I've installed Knoppix (DSL flavor actually) to my harddrive and then used
    Code:
    # tune2fs -j
    to convert my ext2 to an ext3 filesystem. The system is a digital picture frame so typically there isn't a keyboard hooked up. I would like to implement a method similar to what Smoothwall uses for automatically rebooting after checking the filesystem for errors (in the event it gets turned off without a proper shutdown).

    From the smoothwall forums:
    /etc/rc.d/rc.sysinit
    Code:
    # A return of 2 or higher means there were serious problems.
    if [ $RC -gt 1 ]; then
       export PS1="(Repair filesystem) \# # "
       if [ $RC -lt 4 ]; then
           echo "$STRING: Repaired."
           echo "*** Reboot required. The system will reboot in 30 seconds."
           sulogin -t 30
       else
           echo "$STRING: Failed"
           echo "*** An error occurred during the file system check."
           echo "*** Dropping you to a shell; the system will reboot"
           echo "*** when you leave the shell."
           sulogin
       fi
       echo "Unmounting filesystems"
       umount -a
       mount -n -o remount,ro /
       echo "Automatic reboot in progress."
       reboot -f
    fi
    But I'm not sure if this is the right place in the Knoppix start up procedure. I've tried setting my /dev/hda1 to readonly in /etc/fstab but it seems like Knoppix ignores this. Can anyone assist me in this endevour?

    http://www.frontiernet.net/~beakmyn/pictureframe

  2. #2
    Junior Member
    Join Date
    Nov 2004
    Posts
    3
    Bueller?

  3. #3
    Junior Member
    Join Date
    Nov 2004
    Posts
    3
    Ok so I got a chance to read through knoppix-autoconfig. It seems that at line 472

    Code Sample
    Code:
    if [ -n "$INSTALLED" ]; then
    echo "${BLUE}Running from HD, checking filesystems...${NORMAL}"
    # We are running from HD, so a file system check is recommended
    [ -f /etc/init.d/checkroot.sh ] && /etc/init.d/checkroot.sh
    [ -f /etc/init.d/checkfs.sh ]   && /etc/init.d/checkfs.sh
    fi
    
    # / must be read-write in any case, starting from here
    mount -o remount,rw / 2>/dev/null
    
    if [ -n "$INSTALLED" ]; then
    echo -n "${BLUE}Running from HD, regenerate ld.so.cache and modules.dep...${NORMAL}"
    # Regenerate ld.so.cache and module dependencies on HD
    ldconfig; depmod -a 2>/dev/null
    echo ""
    fi

    So maybe checkfs.sh is the place for the reboot script?

    But at Line 925

    Code Sample
    Code:
    # Start creating /etc/fstab with HD partitions and USB SCSI devices now
    if checkbootparam "nofstab"; then
    echo " ${BLUE}Skipping /etc/fstab creation as requested on boot commandline.${NORMAL}"
    else
    echo -n "${BLUE}Scanning for Harddisk partitions and creating ${YELLOW}/etc/fstab${BLUE}... "
    rebuildfstab -r -u knoppix -g knoppix >/dev/null 2>&1
    if [ -e /var/run/rebuildfstab.pid ]; then
    # Another instance of rebuildfstab, probably from hotplug, is still running, so just wait.
    sleep 8
    fi
    echo "${GREEN}Done.${NORMAL}"
    fi

    It seems there is a nofstab option. Is this why DSL is not reading my /etc/fstab?

    Then there's this at line 1030

    Code Sample
    Code:
    fstype(){
    case "$(file -s $1)" in
    *[Ff][Aa][Tt]*|*[Xx]86*) echo "vfat"; return 0;;
    *[Rr][Ee][Ii][Ss][Ee][Rr]*)  echo "reiserfs"; return 0;;
    *[Xx][Ff][Ss]*)  echo "xfs"; return 0;;
    *[Ee][Xx][Tt]3*) echo "ext3"; return 0;;
    *[Ee][Xx][Tt]2*) echo "ext2"; return 0;;
    *data*)          echo "invalid"; return 0;;
    *) echo "auto"; return 0;;
    esac
    }
    
    # Try to mount this filesystem read-only, without or with encryption
    trymount(){
    # Check if already mounted
    case "$(cat /proc/mounts)" in *\ $2\ *) return 0;; esac
    # Apparently, mount-aes DOES autodetect AES loopback files.
    [ -b "$1" ] && { mount -t auto -o ro "$1" "$2" 2>/dev/null; RC="$?"; }
    # We need to mount crypto-loop files with initial rw support
    [ -f "$1" ] && { mount -t auto -o loop,rw "$1" "$2" 2>/dev/null; RC="$?"; }
    # Mount succeeded?
    [ "$RC" = "0" ] && return 0
    echo ""
    echo "${CYAN}Filesystem not autodetected, trying to mount $1 with AES256 encryption${NORMAL}"
    a="y"
    while [ "$a" != "n" -a "$a" != "N" ]; do
    # We need to mount crypto-loop files with initial rw support
    mount -t auto -o loop,rw,encryption=AES256 "$1" "$2" && return 0
    echo -n "${RED}Mount failed, retry? [Y/n] ${NORMAL}"
    read a
    done
    return 1
    }
    So, it appears there's at least 3 spots I could possibly modify. I'd rather have /mnt/hda1 be readonly to begin with then I don't have to worry about corruption, but then I'm not sure which portion I need to modify.

Similar Threads

  1. Automatic Reboot
    By guenze in forum Hdd Install / Debian / Apt
    Replies: 4
    Last Post: 05-02-2005, 07:31 PM
  2. ext3 as ext2 HELP!!!
    By Forcemaster in forum Hdd Install / Debian / Apt
    Replies: 0
    Last Post: 09-06-2004, 01:27 PM
  3. EXT3, Reiserfs, xfs...any comments on the filesystem types?
    By champagnemojo in forum Hdd Install / Debian / Apt
    Replies: 15
    Last Post: 01-21-2004, 05:52 PM
  4. Reiser vs Ext3
    By Gnu Penguin in forum Hdd Install / Debian / Apt
    Replies: 3
    Last Post: 10-18-2003, 12:09 AM
  5. ERROR!: System incorrectly mounts EXT3 filesystem as EXT2
    By gwylion in forum Hdd Install / Debian / Apt
    Replies: 3
    Last Post: 05-12-2003, 03:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •