ADAM2_DEFRAG

Utilities and tools for networking, routers, setup etc
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12064
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

ADAM2_DEFRAG

Post by thechief » Thu Sep 24, 2009 8:20 am

This toolkit has been created to help owners of Adam2-based AR7 routers to defragment the adam2 environment. It is designed for versions of RouterTech firmware lower than version 2.91. This functionality is built into RouterTech firmwares from v2.91 onwards. Do NOT attempt to use this toolkit if your router has the PSP bootloader.

The Problem:
The adam2 bootloader is seriously broken. Manufacturers of AR7 routers have long abandoned it, in favour of the PSP bootloader. One big problem of Adam2 routers is fragmentation of the router's environment. In our experience, ALL routers with the Adam2 bootloader suffer from this to some extent. A little fragmentation is not a problem. However, in many routers (particularly DLink), the environment is very badly fragmented, leading to all sorts of problems. A typical problem is the inability to upgrade the firmware from the router's web interface. But there are also all sorts of other random problems, some of which are very serious, and impact on the router's reliability. The PSP bootloader has the ability to defragment itself when necessary. Adam2's attempts to do the same normally results in a trashed environment and, often, a "bricked" router.

The Solution:
The solution to fragmentation is to defragment. Windows PC users are accustomed to this, and recent versions of Windows have a built in facility to do this. With AR7 routers, the best way to defragment the environment is to connect directly to the bootloader's command prompt via a serial console cable, and to run the "fixenv" or "defragenv" command (for the Adam2 and PSP bootloaders respectively), and then boot up the router normally. However, serial console cables are hard to construct, and not everyone has the necessary technical know-how. If you are such a person, then you are stuck with a malfunctioning router that will eventually give up the ghost.

Enter adam2_defrag:
This is where adam2_defrag comes in, like a knight in shining armour, charging on a magnificent horse. This is a toolkit for defragmenting the environments of Adam2-based AR7 routers. Like the equivalents in the supporting RouterTech firmwares, it should only be used as a last resort (i.e., when all else has failed, and you have no other option). Using a toolkit like this is an act of desperation. If you are not desperate, then do not use it. If you are not prepared to take the risk of bricking your router, then do not use it. As with any other low level operation, there is always a risk of something going wrong.

IF you do decide to take the plunge and to use this toolkit, it is relatively simple to use - just follow these instructions (running the commands in blue):
1) Login to the router via telnet (telnet 192.168.1.1 [ supply username and password for telnet login ])
2) cd /var
3) wget "defrag/rt_defrag_tools.tar"
4) tar -xf ./rt_defrag_tools.tar
5) ./adam2-defrag (follow the prompts, and NOTE all warnings)

With any luck, the router's environment (if fragmented) will be defragmented.

Notes:
1. Please be sure to first read all the documentation, especially the DISCLAIMERS before downloading or attempting to use this toolkit.
2. If you have RouterTech firmware v2.91 (or higher), then do NOT attempt to use this toolkit. The functionality is built in.
3. This utility is written for earlier versions of RouterTech firmwares. If your firmware is not by RouterTech, then you are on your own if you try to use it.

Downloads:

Current release:
1. The adam2_defrag toolkit v1.7 (9 September 2010).
2. Documentation (read it first!).

Older (obsolete) releases:
1. The adam2_defrag toolkit v1.0 (24 September 2009).
2. The adam2_defrag toolkit v1.1 (13 February 2010).
3. The adam2_defrag toolkit v1.3 (18 February 2010).
4. The adam2_defrag toolkit v1.5 (14 June 2010).
5. The adam2_defrag toolkit v1.6 (18 July 2010).

Please report all successes (or failures!) in this thread.
robertocatenacci
Newbie
Newbie
Posts: 5
Joined: Wed Sep 16, 2009 10:47 am

Re: ADAM2_DEFRAG

Post by robertocatenacci » Sat Sep 26, 2009 6:08 pm

Dear thechief,
I successfully used adam2_defrag on a dlink g604t with firmware routertech version 2.8 and on a dlink 504t with firmware ... v.3 dlink :shock:
I must say that your "shining knight" is really powerful, another good job!
"Successfully" for me means that after the use of adam2-defrag, the procedure of updating the firmware through web gui procedure on both routers worked smoothly.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12064
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: ADAM2_DEFRAG

Post by thechief » Sat Sep 26, 2009 6:29 pm

Thanks for the report. :)
robertocatenacci wrote:I successfully used adam2_defrag on a dlink g604t with firmware routertech version 2.8 and on a dlink 504t with firmware ... v.3 dlink :shock:
I'm not surprised that it works on Dlink firmware. We have tried to make it as self-contained (i.e., not dependent on RT firmware features) as possible. It is good to know that we have succeeded (at least, as far as Dlink v3 is concerned :)).
robertocatenacci wrote:I must say that your "shining knight" is really powerful, another good job!
Thanks. This was a very challenging problem to overcome, but we got there in the end ...
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
amiramir
Newbie
Newbie
Posts: 1
Joined: Mon Jun 29, 2009 1:59 am

Re: ADAM2_DEFRAG

Post by amiramir » Thu Dec 03, 2009 6:18 pm

Update stucks, the same framework retains after update.
After running defrag in commnads the update works like magic.
Thanks!!!!!!!!!!!!!
Amir
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12064
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: ADAM2_DEFRAG

Post by thechief » Thu Dec 03, 2009 6:33 pm

Excellent!
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12064
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: ADAM2_DEFRAG

Post by thechief » Fri Feb 12, 2010 11:44 pm

Please note that this tool has now been updated (see the first post in the thread).
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
Supdario
Newbie
Newbie
Posts: 1
Joined: Fri Apr 24, 2009 5:51 pm

Re: ADAM2_DEFRAG

Post by Supdario » Sat Feb 13, 2010 11:41 pm

Defragmented successfully on a D-Link G604T with RouterTech 2.8, it worked like a charm. :D

Before: fragmentation level: 33 (79 records).
After: no fragmentation.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12064
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: ADAM2_DEFRAG

Post by thechief » Sun Feb 14, 2010 8:38 am

:)
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
aligator638
Novice
Novice
Posts: 34
Joined: Sat Apr 19, 2008 9:27 am

Re: ADAM2_DEFRAG

Post by aligator638 » Thu Apr 29, 2010 8:19 pm

From my modem I get:

/var # ping https://www.routertech.org
ping: https://www.routertech.org: Unknown host
/var # wget "defrag/rt_defrag_tools.tar"
wget: https://www.routertech.org: Unknown host
/var # wget "http://95.172.240.105/defrag/rt_defrag_tools.tar"
wget: Unable to connect to remote host (95.172.240.105): Network is unreachable
/var #

From my pc:

Pinging https://www.routertech.org [95.172.240.105] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Strange since I can post this message ;-(
aligator638
Novice
Novice
Posts: 34
Joined: Sat Apr 19, 2008 9:27 am

Re: ADAM2_DEFRAG

Post by aligator638 » Thu Apr 29, 2010 8:23 pm

Got it need to setup the gateway on the router
ranma88m
Newbie
Newbie
Posts: 8
Joined: Thu May 22, 2008 2:50 pm

Re: ADAM2_DEFRAG

Post by ranma88m » Sat Jul 17, 2010 7:40 pm

i had this error

Code: Select all

There was a problem (reported as: "Error opening env script file: /var/env.txt")
. Aborting ....
DrGonzo
Newbie
Newbie
Posts: 1
Joined: Sun Sep 14, 2008 1:38 pm

Re: ADAM2_DEFRAG

Post by DrGonzo » Thu Sep 16, 2010 8:41 am

After storing the G624T in the cabinet for a few years, I tried updating to the newest firmware 2.94 (from 2.60)
Tried both RRT and WebInterface but the router's info displayed the same version (2.60).

While searching I found the Defrag Tools. Everything worked luck a charm, updated the firmware via Web Interface
after executing the tools commands. (edit: Fragmentation was 49/49 ! :lol: )

Thanx again for your continuing support! :D :)
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12064
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: ADAM2_DEFRAG

Post by thechief » Thu Sep 16, 2010 9:00 am

:)
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
Habahaba22
Newbie
Newbie
Posts: 3
Joined: Mon May 23, 2011 7:12 pm

Re: ADAM2_DEFRAG

Post by Habahaba22 » Tue May 24, 2011 6:45 am

thechief wrote: Notes:
2. If you have RouterTech firmware v2.91 (or higher), then do NOT attempt to use this toolkit. The functionality is built in.
Is it mean the router's environment (if fragmented) will be defragmented when i'll run firmware?? Or i need choose some operations???
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12064
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: ADAM2_DEFRAG

Post by thechief » Tue May 24, 2011 9:53 am

The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
Post Reply