It is currently Sat Mar 06, 2021 5:53 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: HDD crash and int13 questions ...
PostPosted: Tue Mar 05, 2013 11:24 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 06, 2010 10:16 am
Posts: 626
Location: Belgium
Hi,

I'm developing a big 3D software, and I lost already 2 HDD with a lot of data in a 6 months time.

1 x 500 GB of data (IDE PATA)
Here ---> viewtopic.php?f=17&t=50999

After that, I installed a new backup USB HDD

1 x 2 TB of backup data (USB External Case)
Here ---> viewtopic.php?f=7&t=53795

Now I lost also this HDD, with the massage "MFT corrupted..."

I bought and tested a lot of backup/recover software with no good results.

SO... I started my own recover software... ??
and need some help of a ASM guru...

I did some asm programming in the past ?? but with 486 pc ... so long time ago ...


Here we go,
I like to read the important sectors (files) from all my HDD when I stop working at evening
and save it on my USB stick as backup.
c: MBR, MFT main, MFT backup, ...
D: MBR, MFT main, MFT backup, ...
E: MBR, MFT main, MFT backup, ...
F: MBR, MFT main, MFT backup, ...

Step 1: I like to read the MBR on the HDD via BIOS interrupt INT13


First one:

INT 13h AH=02h: Read Sectors From Drive

Parameters:
AH 02h
AL Sectors To Read Count
CX Track / Sector
DH Head
DL Drive
ES:BX Buffer Address Pointer

Results:
CF Set On Error, Clear If No Error
AH Return Code
AL Actual Sectors Read Count

Function = $02 ; 'Read Disk Sector' function
NumberSectors = $01

DiskBuffer = $0000

TrackNumber = $0001 ; Cylinder 0, Sector 1
SectorNumber = $01 ; Sector 1

HeadNumber = $00
;HardDisk = $80 ; value for 1st Hard disk
DriveNumber = $80 ; value for 1st Hard disk



32 bit example:
MOV EAX,0 ; Clear EAX register

MOV AH,Function ; set function 02 of INT13
MOV AL,NumberSectors ; set Number of sectors

LES BX,DiskBuffer ; set Disk Buffer Pointer

MOV CX,TrackNumber ; set Track Number
XCHG CH,CL ; swap data low and high
ROR CL,1 ; shift CL one place to right
ROR CL,1 ; shift CL one place to right
AND CL,SectorNumber ; sector 1
OR CL,(SectorNumber and 03Fh) ; max. 63 sectors

MOV DH,HeadNumber ; Plate 0 / Head 0 /
MOV DL,DriveNumber ; HDD 1

INT 013h


Or this one:

xor ax, ax ; clear ax register
mov es, ax ; ES <- 0
mov cx, 1 ; cylinder 0, sector 1
mov dx, 0080h ; DH = 0 (head), drive = 80h (0th hard disk)
mov bx, 5000h ; segment offset of the buffer
mov ax, 0201h ; AH = 02 (disk read), AL = 01 (number of sectors to read)
int 13h


Q1/ Is this a good asm begin ?

Q2/ How can I bring the data to PB editor gadget ?


thanks in advance,
Greetings,
Marc,

_________________
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...


Top
 Profile  
Reply with quote  
 Post subject: Re: HDD crash and int13 questions ...
PostPosted: Wed Mar 06, 2013 7:11 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 3712
Location: Netherlands
INT13 works for DOS, not for Windows.
PureBasic will be of no help in this case.

_________________
macOS 10.15 Catalina, Windows 10


Top
 Profile  
Reply with quote  
 Post subject: Re: HDD crash and int13 questions ...
PostPosted: Thu Mar 07, 2013 4:04 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 24, 2006 9:40 am
Posts: 314
You would also need the boot sector, the ntldr file and some configuration file which is used by ntldr. But then if some system files become corrupt, you also need to save them - windows does not deal well with corrupt system files ;)

The NTFS file system is quite complex, INT13 is outdated and even extended INT13 does not support the latest HD sizes anymore. It would require a lot work to store the MFT, because it is a (special) file inside the NTFS filesystem. Due to all the different BIOS/Interface problems, it would probably be the easiest to write a linux tool and let linux worry about the physical access layer. You could do that with purebasic and use a live-CD linux like Knoppix to run it from an USB stick.

But IMHO it would make much more sense to simply do file based backups of your sources (changes) onto some remote server (web/ftp/cloud etc.), a local NAS (raid-5 for example) or an USB stick/drive. That way you wouldnt need to worry about complex file system structures (or their inconsistencies) and could even recover your sources if your house burned down ;)

Plus you should once in a while do an image backup with a software like Acronis trueimage.


Top
 Profile  
Reply with quote  
 Post subject: Re: HDD crash and int13 questions ...
PostPosted: Sat Mar 30, 2013 8:18 pm 
Offline
Addict
Addict

Joined: Sat Jul 11, 2009 4:57 am
Posts: 950
Location: United States
You can use BitBucket for verson control. You can also keep your projects private if you want.

_________________
▓▓▓▓▓▒▒▒▒▒░░░░░


Top
 Profile  
Reply with quote  
 Post subject: Re: HDD crash and int13 questions ...
PostPosted: Mon Jul 22, 2013 7:26 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Oct 16, 2003 8:30 pm
Posts: 1998
Location: North Florida
I use Ghost, runs everyday at 10AM to an external HDD. Love it, and I can mount the dailys anytime to retrieve just one file. Or rebuild my entire system with an HDD swap in less than 15 minutes.

** mom always said, "If you fail to plan, you plan to fail..." :D


Top
 Profile  
Reply with quote  
 Post subject: Re: HDD crash and int13 questions ...
PostPosted: Thu Jul 25, 2013 7:34 am 
Offline
Enthusiast
Enthusiast

Joined: Thu May 06, 2010 10:16 am
Posts: 626
Location: Belgium
hi NoahPhense,

thanks for the answer.

Quote:
** mom always said, "If you fail to plan, you plan to fail..." :D


yep, I'ts right

Marc

_________________
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...


Top
 Profile  
Reply with quote  
 Post subject: Re: HDD crash and int13 questions ...
PostPosted: Mon Aug 19, 2013 12:40 pm 
Offline
Always Here
Always Here

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 5293
Location: Germany
Hi, I know I'm late, but...

Have you already tried clonezilla ?
It saves your disk to an image, like 'ghost' but free.

Bernd


Top
 Profile  
Reply with quote  
 Post subject: Re: HDD crash and int13 questions ...
PostPosted: Mon Aug 19, 2013 1:07 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Oct 16, 2003 8:30 pm
Posts: 1998
Location: North Florida
infratec wrote:
Hi, I know I'm late, but...

Have you already tried clonezilla ?
It saves your disk to an image, like 'ghost' but free.

Bernd


I'll have to look that one up for friends and family. I like Ghost cause it runs as a service and creates backups daily, incrementally. While windows is running.

I dual boot with Linux as well and Ghost backs up that partition as well.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye