How to recover corrupted FAT directory?

Advanced Discussions on Programing for & Modifying Beyonwiz Products.

Moderators: Gully, peteru

Post Reply
User avatar
honda_tsx
Newbie
Posts: 4
Joined: Wed Jul 22, 2009 19:57

How to recover corrupted FAT directory?

Post by honda_tsx » Sun Jul 26, 2009 12:17

I was running 280 and the HDD filled to around 98% full on my DP-P2. A message displayed to say the HDD was full, but the unit appeared to have locked up. So I pressed various keys on the remote to get a response, but no luck, so I held the on/off button down on the remote and after about 15 seconds the unit shutdown immediately. (not a clean shutdown).

On startup, the unit asked for a HDD check, which I confirmed, and then once booted, the file browser showed no files!

I have telnet'ed to the box and tried to use 'dosfsck' with various parameters in an attempt to rebuild the directory structure or recover deleted files, but no luck.

Has anyone had success in rebuilding a corrupt directory structure on the DP-P2?

Are there any other utilities that are on the BW or any that can be loaded on the BW to either recover corrupted directory strucutres or undelete files?

prl
Wizard God
Posts: 32705
Joined: Tue Sep 04, 2007 13:49
Location: Canberra; Black Mountain Tower transmitters

Post by prl » Sun Jul 26, 2009 12:47

dosfsck is the only HDD repair tool on the Beyonwiz. It's what's used by the HDD Check through the GUI, so it's not likely to work any better via the telnet interface.

The only alternative would be to remove the HDD and connect it to a PC, and run the Windows repair tools.
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV

User avatar
honda_tsx
Newbie
Posts: 4
Joined: Wed Jul 22, 2009 19:57

Post by honda_tsx » Tue Jul 28, 2009 00:01

I would prefer not to open up the BW and void the warantee.
Are there any utilities that can be installed on the BW to recover the FAT32 directory structure?

User avatar
tonymy01
Uber Wizard
Posts: 6373
Joined: Fri Jun 01, 2007 15:25
Location: Sydney, Australia DP-S1-1TB, DP-P2-2TB, DP-T4-2TB, DP-T4-BB... too many!
Contact:

Post by tonymy01 » Tue Jul 28, 2009 01:27

How big is your PC HDD? You could get a share happening that is the size of your Wiz HDD, and do a "dd if=/dev/ide/host0/bus0/target0/lun0/part1 of=blah bs=1024k" to copy your whole wiz drive to your PC. But it will be SLLLLOW to do 200G.
When you mount a share with the wiz gui, it mounts the filesystem in normal way, so the windows share is mounted to a directory, here is my wiz filesystem after choosing my windows fileshare (called storedToppyCaptures) in the GUI:

Code: Select all

root:/> mount
/dev/root on / type romfs (ro)
none on /dev type devfs (rw)
/dev/blkmem/1 on /flash type romfs (ro)
proc on /proc type proc (rw)
usbfs on /proc/bus/usb type usbfs (rw)
ramfs on /tmp type ramfs (rw)
/dev/ide/host0/bus0/target0/lun0/part1 on /opt type vfat (rw,sync,nosuid)
/dev/ide/host0/bus0/target0/lun0/part1 on /tmp/mnt/idehdd type vfat (rw,sync,nosuid)
//192.168.0.120/storedToppyCaptures on /tmp/mnt/smb/TONYSPC/storedToppyCaptures type smbfs (rw,nosuid,nodev,file_mode=0777,dir_mode=0777,codepage=437)
root:/> df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/root                16160     16160         0 100% /
/dev/blkmem/1             7810      7810         0 100% /flash
/dev/ide/host0/bus0/target0/lun0/part1488376320 324229120 164147200  66% /opt
/dev/ide/host0/bus0/target0/lun0/part1488376320 324229120 164147200  66% /tmp/mnt/idehdd
//192.168.0.120/storedToppyCaptures312565760 294682624  17883136  94% /tmp/mnt/smb/TONYSPC/storedToppyCaptures
Now the /opt is just a bind/mount I do so that a directory on the Wiz HDD can run linux stuff on it with a simple path of /opt/bin etc, so ignore that. And my command prompt is because I am running a nicer busybox when I telnet in.
Anyway, I digress.
Tony

User avatar
tonymy01
Uber Wizard
Posts: 6373
Joined: Fri Jun 01, 2007 15:25
Location: Sydney, Australia DP-S1-1TB, DP-P2-2TB, DP-T4-2TB, DP-T4-BB... too many!
Contact:

Post by tonymy01 » Tue Jul 28, 2009 01:34

I wonder if this would do the trick:
http://www.cgsecurity.org/wiki/TestDisk
I will try and compile it some time soon.
Regards
Tony

User avatar
honda_tsx
Newbie
Posts: 4
Joined: Wed Jul 22, 2009 19:57

Post by honda_tsx » Tue Jul 28, 2009 19:33

That would be great if you could compile TestDisk for the Wiz. Funny you should mention that utility because I spoke with Tech support today and they suggested the very same thing!

I'm an Oracle DBA, so it would take me a while to workout how to compile TestDisk for the Wiz.

Thanks in advance.

User avatar
tonymy01
Uber Wizard
Posts: 6373
Joined: Fri Jun 01, 2007 15:25
Location: Sydney, Australia DP-S1-1TB, DP-P2-2TB, DP-T4-2TB, DP-T4-BB... too many!
Contact:

Post by tonymy01 » Sat Aug 01, 2009 22:54

Yes!!! I did it.

Code: Select all

root:/opt> ./testdisk /list /dev/ide/host0/bus0/target0/lun0/disc
TestDisk 6.11, Data Recovery Utility, April 2009
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
Please wait...
Disk /dev/ide/host0/bus0/target0/lun0/disc - 500 GB / 465 GiB - CHS 60801 255 63, sector size=512

Disk /dev/ide/host0/bus0/target0/lun0/disc - 500 GB / 465 GiB - CHS 60801 255 63
     Partition                  Start        End    Size in sectors
check_FAT: Incorrect number of bytes per sector 4096 (FAT) != 512 (HD)
Invalid FAT boot sector
 1 P FAT32 LBA                0   1  1 60800 254 63  976768002
 1 P FAT32 LBA                0   1  1 60800 254 63  976768002
No partition is bootable
Hmm, it bails because of the 4096!=512 I think... I think...
I don't want it to do anything on my drive while the drive is working fine though.
I noticed the wiz dosfsck has an undelete of sorts:

Code: Select all

root:/opt> dosfsck -v
dosfsck 2.11 (12 Mar 2005)
usage: dosfsck [-aAflrtvVwy] [-d path -d ...] [-u path -u ...]
               device
  -a       automatically repair the file system
  -A       toggle Atari file system format
  -d path  drop that file
  -f       salvage unused chains to files
  -l       list path names
  -n       no-op, check non-interactively without changing
  -r       interactively repair the file system
  -t       test for bad clusters
  -u path  try to undelete that (non-directory) file
  -v       verbose mode
  -V       perform a verification pass
  -w       write changes to disk immediately
  -y       same as -a, for compat with other *fsck
Dunno how well it will work, there is a lot of files to undelete from a Wiz drive!
Tony

User avatar
DaveR
Wizard
Posts: 2527
Joined: Tue May 29, 2007 01:24
Location: Sydney

Post by DaveR » Sat Aug 01, 2009 23:50

tonymy01 wrote:Yes!!! I did it.
Nice! This will make a handy recovery tool for more adventurous wiz owners.

I notice it's complaining about the unusual sector size. Is this going to be a problem?
cheers
DaveR

IceTV, T4, T3, T2, P2, S1, FV-L1(P1 fw), TRF-2460, HDR-7500 and Skippa

User avatar
tonymy01
Uber Wizard
Posts: 6373
Joined: Fri Jun 01, 2007 15:25
Location: Sydney, Australia DP-S1-1TB, DP-P2-2TB, DP-T4-2TB, DP-T4-BB... too many!
Contact:

Post by tonymy01 » Sun Aug 02, 2009 00:28

I don't think this tool is the solution now.
I compiled it without ncurses, which the Wiz definitely wouldn't be running, and without that, there is no menu system or options to do anything much???
And reading the testdisk website, it will "undelete" files, but it requires you to copy these files to another drive from what I can tell from the documentation.

Code: Select all

root:/opt> cat testdisk.log
Using locale 'C'.


Sat Aug  1 08:19:27 2009
Command line: TestDisk /debug /dev/ide/host0/bus0/target0/lun0/disc

TestDisk 6.11, Data Recovery Utility, April 2009
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
OS: Linux, kernel 2.4.26-em86xx-uc0-sigma (#58 Wed Jul 15 20:53:50 KST 2009)
Compiler: GCC 3.4 - Aug  1 2009 22:53:44
ext2fs lib: none, ntfs lib: none, reiserfs lib: none, ewf lib: none
Hard disk list
Disk /dev/ide/host0/bus0/target0/lun0/disc - 500 GB / 465 GiB - CHS 60801 255 63, sector size=512 - WDC WD5000AAKB-00YSA0


TestDisk exited normally.
Tony

User avatar
DaveR
Wizard
Posts: 2527
Joined: Tue May 29, 2007 01:24
Location: Sydney

Post by DaveR » Sun Aug 02, 2009 20:44

tonymy01 wrote:I compiled it without ncurses, which the Wiz definitely wouldn't be running,
I'm not sure what that all means. Wouldn't compiling it with ncurses do? If the wiz does need to be running ncurses, can we run it from a USB stick?
tonymy01 wrote:And reading the testdisk website, it will "undelete" files, but it requires you to copy these files to another drive from what I can tell from the documentation.
Shouldn't be a problem. Just use a USB HDD as the destination drive.
cheers
DaveR

IceTV, T4, T3, T2, P2, S1, FV-L1(P1 fw), TRF-2460, HDR-7500 and Skippa

User avatar
tonymy01
Uber Wizard
Posts: 6373
Joined: Fri Jun 01, 2007 15:25
Location: Sydney, Australia DP-S1-1TB, DP-P2-2TB, DP-T4-2TB, DP-T4-BB... too many!
Contact:

Post by tonymy01 » Sun Aug 02, 2009 21:26

Yeah, I am trying to get ncurses into the toolchain, with no success. I got ncurses cross compiled no problems, but configuring the testdisk compile environment doesn't seem to want to see it, no matter where I put the ncurses libs & includes, so I am kind of at a stand still right now. I have about 2 months of stuff I need to watch on the Wiz and Toppy right now, so I don't see myself progressing this with any kind of pace (if at all).
Regards
Tony

prl
Wizard God
Posts: 32705
Joined: Tue Sep 04, 2007 13:49
Location: Canberra; Black Mountain Tower transmitters

Post by prl » Sun Aug 02, 2009 22:01

tonymy01 wrote:Yeah, I am trying to get ncurses into the toolchain, with no success. I got ncurses cross compiled no problems, but configuring the testdisk compile environment doesn't seem to want to see it, no matter where I put the ncurses libs & includes, so I am kind of at a stand still right now. I have about 2 months of stuff I need to watch on the Wiz and Toppy right now, so I don't see myself progressing this with any kind of pace (if at all).
Regards
The firmware sometimes has the vi editor in it (a cut-down version); does it use ncurses?
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV

User avatar
DaveR
Wizard
Posts: 2527
Joined: Tue May 29, 2007 01:24
Location: Sydney

Post by DaveR » Sun Aug 02, 2009 22:28

prl wrote:The firmware sometimes has the vi editor in it (a cut-down version); does it use ncurses?
vi predates curses.

http://en.wikipedia.org/wiki/Curses_(pr ... g_library)
cheers
DaveR

IceTV, T4, T3, T2, P2, S1, FV-L1(P1 fw), TRF-2460, HDR-7500 and Skippa

IanSav
Uber Wizard
Posts: 16846
Joined: Tue May 29, 2007 15:00
Location: Melbourne, Australia

Post by IanSav » Mon Aug 03, 2009 10:28

Hi Peter and Dave,
Dave? wrote:
prl wrote:The firmware sometimes has the vi editor in it (a cut-down version); does it use ncurses?
vi predates curses.

http://en.wikipedia.org/wiki/Curses_(pr ... g_library)
I don't believe that VI uses curses, it has it's own internal system. Curses came after VI though it took its functionality and concepts from VI. Curses is just a toolkit for optimising cursor navigation and movement on an older styled character based display (like a VT100).

Regards,
Ian.

Bruiser333
Master
Posts: 260
Joined: Wed Dec 12, 2007 22:10

Re: How to recover corrupted FAT directory?

Post by Bruiser333 » Mon Aug 03, 2009 14:20

honda_tsx wrote:I was running 280 and the HDD filled to around 98% full on my DP-P2. A message displayed to say the HDD was full, but the unit appeared to have locked up. So I pressed various keys on the remote to get a response, but no luck, so I held the on/off button down on the remote and after about 15 seconds the unit shutdown immediately. (not a clean shutdown).

On startup, the unit asked for a HDD check, which I confirmed, and then once booted, the file browser showed no files!

I have telnet'ed to the box and tried to use 'dosfsck' with various parameters in an attempt to rebuild the directory structure or recover deleted files, but no luck.

Has anyone had success in rebuilding a corrupt directory structure on the DP-P2?

Are there any other utilities that are on the BW or any that can be loaded on the BW to either recover corrupted directory strucutres or undelete files?
Please forgive me if I am stating the obvious, but when you telnet'ed to your Wiz did you check whether you had some other directory in existence that contained your recordings? I recently had an HDD issue that either resulted in no Recordings folder being visible on the Wiz, or a blank Recordings folder (I can't remember now). On advice from this forum I took the HDD out and had a look via Ubuntu, and I could see the Recordings folder (albeit renamed to something that rendered it invisible to the Wiz fileplayer), along with all the recordings.

Maybe your HDD check created a new (blank) Recordings folder, but if by some the old one is there with a different name, you may be able to copy them back via telnet?

Cheers,


Bruiser

User avatar
honda_tsx
Newbie
Posts: 4
Joined: Wed Jul 22, 2009 19:57

Post by honda_tsx » Mon Aug 03, 2009 19:29

Hi Bruiser,

The Wiz front display shows the HDD as empty, and telnet did not show any other Recordings directories, unfortunately. I know there is a problem with going back from 301 of the firmware, because the Recordings directory changes to Recording or visa virsa, can't recall.

Cheers.

User avatar
DaveR
Wizard
Posts: 2527
Joined: Tue May 29, 2007 01:24
Location: Sydney

Post by DaveR » Mon Aug 03, 2009 21:25

Bruiser333 wrote:On advice from this forum I took the HDD out and had a look via Ubuntu, and I could see the Recordings folder (albeit renamed to something that rendered it invisible to the Wiz fileplayer), along with all the recordings.
This may be honda_tsx's only option. Not Ubuntu, but connecting the HDD to a PC so some diagnostic or disk-recovery tools can be run on it.
honda_tsx wrote:
Bruiser333 wrote:Maybe your HDD check created a new (blank) Recordings folder, but if by some the old one is there with a different name, you may be able to copy them back via telnet?
The Wiz front display shows the HDD as empty, and telnet did not show any other Recordings directories, unfortunately.
I wouldn't trust the front panel display too much. I'd be inclined to have another look just in case there's any folders in idehdd (I think it is) that shouldn't be there.
honda_tsx wrote:I know there is a problem with going back from 301 of the firmware, because the Recordings directory changes to Recording or visa virsa, can't recall.
When upgrading to 301 the firmware renames the 'recording' folder to 'Recordings'. If you go back to any other version the renaming is not reversed... so you have a Recordings folder full of recordings that the old firmware knows nothing about (so any HDD check is going to fail) and the old firmware creates a new 'recording' folder and puts any new recordings in there. You now have 2 folders with recordings in them. If you again upgrade to 301 (or newer?) the firmware will again rename the 'recording' folder to 'Recordings' thus overwriting the existing 'Recordings' folder (and wiping all of it's contents).
cheers
DaveR

IceTV, T4, T3, T2, P2, S1, FV-L1(P1 fw), TRF-2460, HDR-7500 and Skippa

Bruiser333
Master
Posts: 260
Joined: Wed Dec 12, 2007 22:10

Post by Bruiser333 » Mon Aug 03, 2009 21:39

honda_tsx wrote:Hi Bruiser,

The Wiz front display shows the HDD as empty, and telnet did not show any other Recordings directories, unfortunately. I know there is a problem with going back from 301 of the firmware, because the Recordings directory changes to Recording or visa virsa, can't recall.

Cheers.
When I had my issue, the Wiz front display also showed the HDD as empty. But everything was still there (pretty much) when accessed via a USB enclosure under Ubuntu. Initially I thought the renamed Recordings folder was a file because it appeared something like ~Recordings.tvwiz (unfortunately I can't remember exactly, but it had a DOS like extension which confused me).

Anyway, I'm not saying your situation is necessarily the same as mine, I just thought it would be worth it to make sure.

Cheers,


Bruiser

Post Reply

Return to “Software Developers”