PDA

Bekijk de volledige versie : HOW-TO say Open Sesame to your internal disk



mumsoft
04-08-2007, 23:14
Took the drive out of the white box, pushed it in a usb case, attached it to my pc, gave it a working partition table, and that was all to say Open Sesame to the internal hard disk of the Asus WL-700Ge: see attachment
This picture shows what you are about to see if you do the same.

This makes all sorts of new and unthought things possible: recover from that little stupid mistake that rendered your box to a brick – backup all the data – replace the disk with a larger one without losing a single bit – grab your data much quicker – etc.

Now, if you are curious for the gory details, read on. I will explain in extenso what I did and it will give you the little recipe to get you going.

The recipe

Take the disk out of the Asus. It can be opened very easily. You'll see a screw in the middle of a silver case, unscrew it, and take the lid off. You'll break the warranty, but only for the disk, not for the other hardware. You'll have to get it loose with care and power.
Next, put it in something that you can use at your pc. I took a usb diskcase for that matter.
Start up your Linux pc. Oh, what, you have something different? Well, grab hold on a Knoppix DVD www.knoppix.org, that will give you a comfortable GUI to play with, or, if you're more brave, get yourself a Linux rescue disk www.sysresccd.org. It won't be so nice to look at, but it comes with all kind of goodies you will love to have, once acquainted to it. As the Asus itself uses Linux, and the disk is formatted with ReiserFS, you must use something capable for it. Why not take the plunge and install some sort of Linux next to what you're used to until now? Well, I leave you to decide what to do.
The Asus disk will have a name as /dev/sda or /dev/sdb, dev/sdc etc, depending on how many other USB drives or sticks it sees. Let me assume it is /dev/sda. Now, run
fdisk /dev/sdaYou will have to do this as root.
You can tell it is the Asus disk when fdisk says that the drive has no valid partition table. Ok, now just leave fdisk, with
qFirst we will and must make a backup of the first 512 bytes of the disk that contains this invalid partition table, or else your with brick won't start up.
Backing up the MBR or first 512 bytes is as easy as this:
dd if=/dev/sda of=asus-mbr-original bs=512 count=1What you specify after of= makes all the difference: that is the file you will need to restore later on. So make sure you have it, and don't loose it. :eek:
Now that we have a backup of the MBR, we can savely give the disk a new partition table. Run
fdisk /dev/sda again. Give
u to change the from cylinder input to sector input. The Reiser partition starts at a sectorboundary, that's because. Now make a new partition:
n p 1fdisk will ask for the first sector. Here comes the magic secret: 1262160. Next, for the last sector, just hit enter. It will define a Linux partition starting from sector 1262160 and occupying the rest of the disk. Check this with
pand then, then...
wto write it. Don't sweat, you have a backup, don't you? This write operation will only touch the first 512 bytes of the disk.
If you did it right, you can say open sesame with
mount /dev/sda1 /mnt/asusin which /mnt/asus is just a directory you made before, didn't you?
Now, all what you normally find in /shares/MYVOLUME1 you'll find in /mnt/asus. DONE.
If you did it wrong, mounting /dev/sda1 will fail, that's all. I'm pretty sure that 1262160 is the starting sector. It is so for my 250GB disk, and I guess it will be the same for a 160GB disk or whatever size disk your Asus came with.
All done? You'll have to restore the MBR, with
dd of=/dev/sda if=asus-mbr-originalDon't forget that, or else the Asus won't start at all. And don't mix if and of!!

Some remarks

I made a complete backup of the disk with dd if=/dev/sda of=/dev/sdb in which sdb was my backup disk. It took a mere 13 hours, and dd is not of the talkative kind. Better use ddrescue, that comes with the rescue disk.
If you want to transfer your disk to a larger one, use dd or ddrescue to copy all sectors until nr 1262160, that is about 600 MiB. Next, use partimage to backup the reiserfs partition from your original disk, define a new partition on your new disk occupying sector 1262160 to the end, and restore this with partimage, and resize it. The rescue cd has all the programs.
The disk starts with a Broadcom sign and with a compressed partition of about 600 MiB, containing probably the firmware. This means that a mirror disk of MYVOLUME1 is not enough to replace a faulty internal disk. It has to have the complete content.


I like to thank Jan van Wijk http://www.dfsee.com for his assistance in finding the startposition of MYVOLUME1:cool:

iczfirz
06-08-2007, 04:39
;) good job. definitely good for recovery. Thanks.

pzabortsev
17-03-2008, 17:06
I've tried to use this solution for repairing internal disk of my Asus WL-700gE after unsuccessful installation of Kamikaze. After completing all steps and installing original asus software my disk has look like this:


# fdisk /dev/ide/host2/bus0/target0/lun0/disc

The number of cylinders for this disk is set to 30401.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): u
Changing display/entry units to sectors

Command (m for help): p

Disk /dev/ide/host2/bus0/target0/lun0/disc: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System
/dev/ide/host2/bus0/target0/lun0/part1 1262160 488397167 243567504 83 Linux
/dev/ide/host2/bus0/target0/lun0/part2 63 1253069 626503+ 83 Linux

Partition table entries are not in disk order

Command (m for help): q

#

This partition table is correct?

Root of my system is /dev/ide/host2/bus0/target0/lun0/part1:

# mount
/dev/ide/host2/bus0/target0/lun0/part1 on / type cramfs (rw)
and it cannot be erased.

Partition /dev/ide/host2/bus0/target0/lun0/part2 cannot be mount:

# mount /dev/ide/host2/bus0/target0/lun0/part2 /mnt
mount: Mounting /dev/ide/host2/bus0/target0/lun0/part2 on /mnt failed: Invalid argument
#
Maybe I've missed something?

mumsoft
17-03-2008, 22:34
I've tried to use this solution for repairing internal disk of my Asus WL-700gE after unsuccessful installation of Kamikaze. After completing all steps and installing original asus software my disk has look like this:


# fdisk /dev/ide/host2/bus0/target0/lun0/disc
[cut]
Command (m for help): p

Disk /dev/ide/host2/bus0/target0/lun0/disc: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes

Device Boot Start End Blocks Id System
/dev/ide/host2/bus0/target0/lun0/part1 1262160 488397167 243567504 83 Linux
/dev/ide/host2/bus0/target0/lun0/part2 63 1253069 626503+ 83 Linux

Partition table entries are not in disk order
#

This partition table is correct?


Not exactly. That is, my internal disk has an invalid partition table, that simply shows nothing with the p command. And, believe it or not, that is correct.



Root of my system is /dev/ide/host2/bus0/target0/lun0/part1:

# mount
/dev/ide/host2/bus0/target0/lun0/part1 on / type cramfs (rw)
and it cannot be erased.

Partition /dev/ide/host2/bus0/target0/lun0/part2 cannot be mount:

# mount /dev/ide/host2/bus0/target0/lun0/part2 /mnt
mount: Mounting /dev/ide/host2/bus0/target0/lun0/part2 on /mnt failed: Invalid argument
#
Maybe I've missed something?

Well, yes, and me too. I have never installed kamikaze and then tried to get back to the old firmware. So, anything that follows is highly untested and suspicious for errors.
But you might try it.
I won't go in very much detail, for details see my original instructions. I like you to try a new (that is, mine) bootsector for you.
a) First, take the disk out the Asus, and attach it to your Linux-running pc.
b) make a BACKUP of the original bootsector, in case we do something stupid.
c) put the attached bootsector over the original
d) Put the disk in the Asus and see if it will boot now.
No garantees!
If it still fails to work, you can restore the backup bootsector if you wish.

Regards,
Marc

sasha_mn
22-04-2008, 08:22
If you did it right, you can say open sesame with
Код:
mount /dev/sda1 /mnt/asus
here at this time of my mandriva-linux pc said that he could not to mount, incorrect fs.
may have something else do?
(hdd hitachi 500g)

mumsoft
22-04-2008, 21:56
here at this time of my mandriva-linux pc said that he could not to mount, incorrect fs.
may have something else do?
(hdd hitachi 500g)

Try this then :cool::


mount -t reiserfs /dev/sda1 /mnt/asus

Regards,
Marc

robink
23-04-2008, 10:05
This sounds promising...

I have the "same" problem but than for an external USB (750GB!) disk.
Didn't configure it for mirroring, I would assume I don't have the ~600MB "OS" Partition on it!? Therefore the partition with my data probably won't start at 1262160. :confused:

Is there someone who succeeded mounting his WL700gE formated USB disk on some other Linux system? Maybe by using the trick (or a derived version of it) described above?

I want to move my USB Disk to a Linux server (<5w) which has a bit more power and throughput as the WL700gE. But I don't feel like copying the data from the huge disk to an other and back again... :(

mumsoft
23-04-2008, 17:13
This sounds promising...

I have the "same" problem but than for an external USB (750GB!) disk.
Didn't configure it for mirroring, I would assume I don't have the ~600MB "OS" Partition on it!? Therefore the partition with my data probably won't start at 1262160. :confused:

Is there someone who succeeded mounting his WL700gE formated USB disk on some other Linux system? Maybe by using the trick (or a derived version of it) described above?

I want to move my USB Disk to a Linux server (<5w) which has a bit more power and throughput as the WL700gE. But I don't feel like copying the data from the huge disk to an other and back again... :(

I don't think someone will have a solution. Of course you could wait for it, but in the meantime you could easily copy all the files to another disk and back again, and do that twice and again and forever. :eek:
But you never know... and of course there must be some other magic number than 1262160 which is probably much smaller. But I never succeeded to get my files without first 'destroying' the disk. I assume you have read this:
http://wl500g.info/showpost.php?p=48361&postcount=5

Regards
Marc

robink
23-04-2008, 17:26
I don't think someone will have a solution. Of course you could wait for it, but in the meantime you could easily copy all the files to another disk and back again, and do that twice and again and forever. :eek:
But you never know... and of course there must be some other magic number than 1262160 which is probably much smaller. But I never succeeded to get my files without first 'destroying' the disk. I assume you have read this:
http://wl500g.info/showpost.php?p=48361&postcount=5

Regards
Marc

Yes, unfortunately I have read that. I wouldn't want to loose my Files!
I know I could copy the files, but the Problem is that I first need to find a place for those 600GB.. :D

Anyway, I will see what I can do myself but I just hate to reinvent the wheel!

mumsoft
23-04-2008, 17:41
Yes, unfortunately I have read that. I wouldn't want to loose my Files!
I know I could copy the files, but the Problem is that I first need to find a place for those 600GB.. :D

Anyway, I will see what I can do myself but I just hate to reinvent the wheel!

Since you don want to loose your files (who does?) take care!
MAYBE this could work:
- backup the original MBR of this disk. I said BACKUP.
- give it a NEW partition table and define a reiserfs primary partition occupying the whole disk.
- try to mount that.
Success? :D
NO success? :mad: RESTORE the original MBR

This is not reinventing the wheel, but inventing it.
If you make one mistake, you will loose your files.
With the new partition table the Asus will NOT recognize it anymore.
Capice?
It is highly experimental, but, with the original MBR at hand, theoretically not much can go wrong.

Regards en de groeten uit Holland,
Marc

robink
23-04-2008, 18:18
Since you don want to loose your files (who does?) take care!
MAYBE this could work:
- backup the original MBR of this disk. I said BACKUP.
- give it a NEW partition table and define a reiserfs primary partition occupying the whole disk.
- try to mount that.
Success? :D
NO success? :mad: RESTORE the original MBR

This is not reinventing the wheel, but inventing it.
If you make one mistake, you will loose your files.
With the new partition table the Asus will NOT recognize it anymore.
Capice?
It is highly experimental, but, with the original MBR at hand, theoretically not much can go wrong.

Regards en de groeten uit Holland,
Marc

That's what I will try to do, if it doesn't work I'll find one of those file system recover tools... should be able to scan the disk for "filesystems" and their location.

Groetjes uit Bayern (Duitsland) van een hollander,
Robin

robink
23-04-2008, 20:09
Search and thy will find!

I looked at the first sector of the disk and found "Broadcom NAS Version 1.1 MBR Tag".. With the help of Google I found: http://blog.stevecoinc.com/2007_12_01_archive.html

In short, for those who want to recover some information of the disk:
I managed to mount the file system read only or even write only with a few easy steps and no risk of ruining the information! (Do the steps below as root!)

1) Find the location of the Superblock so the filesystem can be mounted.
For me the disk was available under /dev/sda
I installed hexedit (ubuntu: apt-get install hexedit)
Run hexedit on the device: hexedit /dev/sda
Than use TAB to get into the ASCII Part of the Data (otherwise it will search HEX Values) and type "/" (without quotes) to search. Search for "ReIsEr" (again without qoutes).
Note (piece of paper) the HEX value at the start of the line and change the last 2 digits to 00. (For me it was at 0011430, so I noted 0x11400 down)
Change the HEX value to decimal (70656) and subtract 65536 (superblock is 64K before the found value) which leaves 5120 for me.

2) Use a loop device so it looks like it starts at the found location:
losetup -o 5120 /dev/loop0 /dev/sda
(Use "losetup -f" to find the first unused loop device!)

3) Mount the file system read only (or even writing is possible!)
mount -r -t reiserfs /dev/loop1 /mnt/mymountpoint

And behold... your files!!!

(If this was to hard or the one from SteveCo didn't help, try: https://www.blogger.com/comment.g?blogID=8108277809937554792&postID=7410585480231306306 maybe that will explain it better?)

Now I will see if I can change the information on the disk as described with fdisk...

mumsoft
23-04-2008, 21:02
Robin,

I guess this is something worth an own HOW-TO. Not something hidden in this thread here...
Very good job!

Regards,
Marc

Omega24v
31-05-2008, 13:59
Hallo,

have anybody replaced the Harddisk to a larger??? 500GB or better 750GB for example???

Thank you

robink
01-06-2008, 22:17
Hallo,

have anybody replaced the Harddisk to a larger??? 500GB or better 750GB for example???

Thank you

Yes sure, works just fine. Just replace the internal P-ATA Hardrive with something bigger. You'll have to reinstall the firmware to make it work as this will format the drive during the installation process. You should be able to find a guide somethere here.

Better find a drive that doesn't get too hot, there is no need to pick a quick one (5400rpm would just be fine) as the Asus can't handly the IO anyway! On top of that it's probably less noisy.

My 500GB drive broke down, I suspect that overclocking and additionally having a 7200 rpm that gets hot made it cook.

Omega24v
02-06-2008, 22:26
Yes sure, works just fine. Just replace the internal P-ATA Hardrive with something bigger. You'll have to reinstall the firmware to make it work as this will format the drive during the installation process. You should be able to find a guide somethere here.

Better find a drive that doesn't get too hot, there is no need to pick a quick one (5400rpm would just be fine) as the Asus can't handly the IO anyway! On top of that it's probably less noisy.

My 500GB drive broke down, I suspect that overclocking and additionally having a 7200 rpm that gets hot made it cook.

OK Thank you...

I will be look after an HD which would be not to hot.... Do you think that a 750GB will be also supported?? Because I use the Asus as BT Client(rtorrent) and in my opinion 250GB is to small and 750GB will be perfekt...

mumsoft
05-06-2008, 21:55
OK Thank you...

I will be look after an HD which would be not to hot.... Do you think that a 750GB will be also supported?? Because I use the Asus as BT Client(rtorrent) and in my opinion 250GB is to small and 750GB will be perfekt...

Just search this forum for "750" and you'll find your answer.

Marc

Omega24v
10-06-2008, 15:28
Thank you Mark!!

I have found it and order a Seagate 750GB..... I hope it will be work fine... :cool::cool:

Alex


I have testet it - It works fine!!!!!! Thank you

camel_456
10-09-2008, 22:06
I'm a little confused with the How-To. I've messed up my asus drive with 230GB of data on it and am trying to repair it so I can access the files. I have never used linux before or ever done any coding.

I have a LiveCD of Knoppix and have connected the Asus drive inside my computer to an IDE cable. I'm pretty sure Knoppix recognises it as /hdc/.

I've got as far as making the back-up but now I'm stuck. When I enter:

dd if=/dev/hdc of=asus=mbr-original bs=512 count=1
I get this message:

dd: writing asus-mbr-original ' : No space left on device
1+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000687182 seconds, 0.0 kB/s
Does this mean I'm trying to back up the mbr on the wrong driive?

Please help me! I'm a total newb and don't have a clue what I'm doing! :(

EDIT:

OK! Looks like I made a mistake, /hdc/ was ctually the LiveCd itself and the asus drive is actually /hdb/ (I checked this using TestDisk)
Although when I try to access /hdb/ via fdisk it just gives me:


Uable to open /dev/hdb
So, I am back at square 1! Could I be able to acess the drive if I used TestDisk to create a whole new mbr?
Please help I've got a lot of data on there! :o

robink
16-09-2008, 00:01
I'm a little confused with the How-To. I've messed up my asus drive with 230GB of data on it and am trying to repair it so I can access the files. I have never used linux before or ever done any coding.

I have a LiveCD of Knoppix and have connected the Asus drive inside my computer to an IDE cable. I'm pretty sure Knoppix recognises it as /hdc/.

I've got as far as making the back-up but now I'm stuck. When I enter:

dd if=/dev/hdc of=asus=mbr-original bs=512 count=1
I get this message:

dd: writing asus-mbr-original ' : No space left on device
1+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000687182 seconds, 0.0 kB/s
Does this mean I'm trying to back up the mbr on the wrong driive?

Please help me! I'm a total newb and don't have a clue what I'm doing! :(

EDIT:

OK! Looks like I made a mistake, /hdc/ was ctually the LiveCd itself and the asus drive is actually /hdb/ (I checked this using TestDisk)
Although when I try to access /hdb/ via fdisk it just gives me:


Uable to open /dev/hdb
So, I am back at square 1! Could I be able to acess the drive if I used TestDisk to create a whole new mbr?
Please help I've got a lot of data on there! :o

Sorry I couln't reply sooner, forgot my password for this site! :(

The problem might be that your current working directory is not writeable! The "data definition" command of the How-To will try to write a copy of the MBR at your current location, hence the message "No space left on device" -> as the device is not writable it doesn't have any space left. You should change to a location that can be written to!

good luck!
Robin

XYZ
13-02-2009, 17:02
I spent several days trying to upgrade and transfer data from my internal disk (250 GB) to Samsung 750 GB, but unsucesfully. Please, could somebody give me some advice?

Here is what I did after had attached old and new disks to my Windows PC, installed SysRescueCd on my USB stick and booted it:
- mkdir /mnt/c
- mount /dev/sda1 /mnt/c
- ddrescue -s512 /dev/sdb /mnt/c/temp/original-mbr.bin
- fdisk /dev/sdb, then u n p 1 1262160 w
- ddrescue /dev/sdb /dev/sdc
- gparted /dev/sdc, then resized partition to 750 GB
- ddrescue /mnt/c/temp/original-mbr.bin /dev/sdc

/dev/sda1 is the first partition on my PC disk, /dev/sdb is the original disk (250 GB) and /dev/sdc is the new disk (750 GB).

I tried many other commbinations, even with Windows disk imaging and partitioning programs, but without any succes.

In one moment I managed to get copied 250 GB data on my new disk and rest of it was empty, so I could create a new volume on it within Asus itself, but I didn't like that idea - I need one contigous 750 GB volume, because I am using UPnP and media server which recognize only files in Audio and Video folders of the MYSHARE1 folder on the first volume.

Also, in one moment I got one empty 750 GB volume, then mounted old disk attached to my PC with Paragon Partition Manager, but transfer of files through 100 Mbps LAN was horibly slow, so I abandoned that idea. Now, I could not reproduce even that. :(

mumsoft
14-02-2009, 14:34
When you did this:
- gparted /dev/sdc, then resized partition to 750 GB
you got a nice ~750 GB partition,
but when you did this
- ddrescue /mnt/c/temp/original-mbr.bin /dev/sdc
you restored the definition of the original ~250Gb partition.

i think you should do this:
- install the 750 GB disk in the Asus, and install the firmware on it.
- take it out, and make the partition visible. (backup the MBR first)
- make the partition on the 250GB visible, if needed.
- copy the the files someway (cp)
- restore the mbr of the 750GB disk

But I have to say that i never tried to transfer my files to a bigger disk. So I hope for you that Robin or Omega24 will reply with a solution that has proven to work.

Marc

XYZ
14-02-2009, 22:52
you restored the definition of the original ~250Gb partition.
Well, I know that but if I keep a boot sector made by fdisk, Asus would not load at all.

I tried to create first sector with fdisk telling it is 250 GB and saved that, after that created another boot sector telling it is 750 GB and saved that as well. After comparing these two files I got to conclusion that final sector of partition (i.e. size of disk) is at offset 0x1CA. But, original Asus mbr have zeros on that position. Anyway, I entered in that location values from the second generated file (B1 10 41 57), but nothing is happening - Asus still displays disk with a 250 GB volume and rest of it unoccupied.


i think you should do this:
- install the 750 GB disk in the Asus, and install the firmware on it.

Yeah, I tried that as well, but Asus could not load with a blank disk. I tried to upgrade firmware following tutorial on this forum using the Windows software, as well as with the Web setup, but without any success. Now, I blame myself why I dropped idea to copy files through the LAN when I managed to create one 750 GB volume, because I cannot reproduce that anymore. :(

Anyway, thank you very much for your response. I'll keep trying...

mumsoft
14-02-2009, 23:47
Maybe you could try this:

- Copy the content of the first 250GB disk to the 750Gb disk.
- let the asus boot with the 750 Gb disk
- remove volume1 with the webgui
- make a new volume with the webgui
- take it out
- copy the files of the 250GB disk (volume1) to the 750GB disk (volume1)

you also might try to copy only the hidden information to the 750 Gb disk (to make it bootable, try to boot it with Asus, and define a new VoluME1, etc.

But I don't have any experience with a brand new disk. It seems to me that several people other people have... But where are they?

Marc

XYZ
15-02-2009, 01:10
- Copy the content of the first 250GB disk to the 750Gb disk.
- let the asus boot with the 750 Gb disk
- remove volume1 with the webgui
I already tried that (many times). Unfortunately, Asus Web interface doesn't allow to remove the first volume from the disk :(


you also might try to copy only the hidden information to the 750 Gb disk (to make it bootable, try to boot it with Asus, and define a new VoluME1, etc.
Of course I tried that first, but Asus still report that I have one 250 GB volume already defined and rest of disk unoccupied. As I said, in one moment I managed to get empty disk and I have been able to create 750 GB volume, but I don't remember how.

Thanks for suggestions. I just downloaded 400 MB of its source code, maybe I could find in it where is stored information about a disk size. The broadcom.c file is most promising...

Lieta
01-04-2012, 10:44
Router's hard disk partition table is lost. Can anybody send me output of
fdisk -l
?
EDIT: Forget it, I found it: http://wl500g.info/showthread.php?10198-HOW-TO-say-Open-Sesame-to-your-internal-disk