DDWRT and Saving an EXT2 Installation

Wiki.TerraBase.info
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

It seems like Entware and DD-WRT like to fail on a somewhat regular basis if the router crashes and corrupts the EXT2 (or whatever format) Partition Entware is installed on.

A trick that I've learned is to take a page from high end routers that have two separate NVRAM segments. IE, whatever disk or USB FlashDrive Entware is to be installed on, divide it in two. USB FlashDrives are fairly big and cheap these days, so no big deal. Install Entware on one of the partitions, get it the way you like it and copy it to the other partition. If the first one ever craps out, boot to the second one and recover (format, re-partition, whatever) the first one. Then copy the files back.

  • To install any of the below utilities if they're missing: opk install XYZ
  • To change "boot" partition (IE, the one mounted to the OPT Directory): mount -o bind /tmp/mnt/sda_part1 /opt OR mount -o bind /tmp/mnt/sda_part2 /opt (part2 is the backup partition)
  • To display information about a "disk" or file system: mount OR df OR dumpe2fs /dev/sdaX OR tune2fs -l /dev/sdaX (that's a lowercase L)
    • tune2fs -c -1 /dev/sdaX: sets it to never check
  • To "CHKDSK" a file system:e2fsck -v -p /dev/sdaX OR fsck.ext2 (-v is for Verbose, -p automatically repairs, -t is file system type but is not available) (remember, make sure it is not mounted) (to install utility, with additional utilities for other stuff:opkg install e2fsprogs)
    • umount /dev/sdaX (some services like smb and proftpd might be using the partition, so stop)
    • If it runs into issues or complains: e2fsck -v -y (-y answers yes to everything)
  • To Defragment: e2defrag /dev/sdaX (again, make sure to unmount device, umount /dev/sdaX)
  • To format an EXT2 paritition: mke2fs or mkfs.ext2 -L WhatEverLabel /dev/sdaX
    • Remember to un-mount it first: umount /dev/sdaX (see smb and proftpd notes above)
    • ...wait FOREVER if it is a USB drive (about an hour for a small EXT2 partition on a USB 2.0 port)
    • If one forgets to change the label during format: tune2fs –L WhatEverName /dev/sdaX
    • And don't forget to copy everything back over: cp -ax /tmp/mnt/sda_partX /tmp/mnt/sda_partY (turns out -x is not available in the Entware Version)
  • General Information:
    • SuperBlock: 1st one typically at 32768