Announcement

Collapse
No announcement yet.

Hard Drive Stats

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Joep van Steen
    replied
    Well Linux would be nice to run from, waiting for PB for Linux

    Still, I have several DOS utilities written with revovery in mind, and
    DOS is still fine. I use int13h ext disk access similar to the code
    posted in this thread.

    I deliver the tools on preconfigured FreeDOS bootdiskette images.
    Newest FreeDOS kernel offers FAT32 support. I have tested this and
    so far didn't run in to problems.

    I really like PB and I wouldn't want to do this in C, never tried it
    anyway...

    ------------------
    Joep

    http://www.diydatarecovery.nl

    Leave a comment:


  • Daryl Lock
    replied
    Originally posted by Peter Lameijn:
    One version of DR-Dos (build 7.05, made for OnTrack diskmanager) should work with
    Fat32 / LBA disks > 8GB. (Never tried it though...)
    DR-DOS 7.03 has a native FAT32 driver...BUT...while it can see a HDD at least up to my own limit of 40Gb..it won't allow read/write access to partitions larger than 2Gb because it is limited to a cluster size of 16k and FAT32 clusters get incrementaly larger over that size - ie <2Gb =16k <8gb = 32k and anything over that, 64k clusters.

    ------------------

    Leave a comment:


  • Michael Torrie
    replied
    Don't want to sound zealous or fanatical, but with today's hardware, recovery operations are probably best done from linux. It wouldn't be too hard to build a boot disk or cd with a basic linux kernel on it and some vfat utilities. Linux has no problems with most ide drives (scsi too if you made a boot cd with extra drivers). If you have the skills to do disk recovery using powerbasic, then you could probably handle C to make up some utilities. A text-only shell would be quite compact.

    Anyway, I've purchased a box of 3 inch CDRs and I'm going to make 2 rescue disks (maybe even cut them to business card size). One rescue disk will be dos-based, and have basic partitioning utilities on it (like partition magic, maybe a free one too). This would also be of help to fix hosed windows fat32 systems.

    The other disk would be a linux kernel, generic drivers, and utilities for fixing linux systems, resetting win nt/2000 passwords, fixing things generally.

    cheers,
    Michael

    Leave a comment:


  • Guest's Avatar
    Guest replied
    All,

    Here is another way that you might try. It is a little cleaner
    than the last piece that I sent out to you to attempt.


    DIM DriveNum AS INTEGER
    DIM Segment AS WORD
    DIM Offset AS WORD

    DriveNum% = ASCII(UCASE$(Drive$)) - 64

    IF DriveNum% < 3 THEN
    DriveNum% = 3
    ELSE
    DriveNum% = DriveNum% + 125
    END IF

    AXRegister% = X13Command? + &H40
    SHIFT LEFT AXRegister%, 8

    SELECT CASE X13Command?
    CASE %CMD_INSTALLED
    REG %BX,&H55AA

    CASE %CMD_READ_SECTOR, %CMD_WRITE_SECTOR
    IF (NumberOfSectors?? = 0) OR (NumberOfSectors?? = 1) THEN
    DIM SectorBuffer AS X13Buffer
    ELSE
    DIM SectorBuffer(NumberOfSectors - 1) AS X13Buffer
    END IF

    SectorBuffer.PacketSize? = &H10
    SectorBuffer.Reserved? = 0
    SectorBuffer.BlocksToTransfer?? = NumberOfSectors??
    SectorBuffer.TransferBuffer = Buffer
    SectorBuffer.StartingBlock&& = StartingSector&&

    REG %DS,VARSEG(SectorBuffer)
    REG %SI,VARPTR(SectorBuffer)

    CASE %CMD_GET_PARAMETERS
    Offset?? = BITS??(Buffer???)
    ROTATE RIGHT Buffer???, 16
    Segment?? = BITS??(Buffer???)

    REG %DS,Segment??
    REG %SI,Offset??

    CASE %CMD_SET_HARDWARE_CONFIG
    AXRegister% = X13Command + &H5E
    SHIFT LEFT AXRegister%, 16

    CASE ELSE
    END SELECT

    REG %DX,DriveNum%
    REG %AX,AXRegister%

    CALL INTERRUPT %INT13

    CarryFlag% = REG(%FLAGS)
    AXRegister% = REG(%AX)
    BXRegister% = REG(%BX)
    CarryFlag% = BIT(CarryFlag%, 0)
    IF CarryFlag% THEN
    IF (X13Command = %CMD_INSTALLED) AND (BXRegister% <> &HAA55) THEN
    FUNCTION = %False
    ELSE
    IF INSTR(UCASE$(COMMAND$), "DEBUG") THEN
    SHIFT RIGHT AXRegister%, 8
    CALL DiskStatus(ByCopy Register%)
    END IF
    END IF
    FUNCTION = %False
    END IF

    END

    'hey it ain't pretty, but it works...'

    ------------------

    Leave a comment:


  • Guest's Avatar
    Guest replied
    I worked on this a couple of years back and thought this might
    be of help. In order to address the drive (over 8.4GB which
    is possible provided that you r BIOS supports LBA addressing)
    directly you must use low level Int13 routines (actually Int13
    ext). I have a couple routines/structures that I wrote that
    should help you out. Please understand that you must read the
    MBR (physical sector 0) from the disk and then use the QUAD
    number of sectors to do sector by sector read/writes. ANyway,
    here is the base code and the TYPE DEFS for each of the necessary
    structures: (yes, I know it could be done cleaner but I am not
    into making it pretty I am into making it work)

    Mark

    Type DriveParameters
    Size AS WORD
    InformationFlagTable AS WORD
    CylindersTotal AS DWORD
    HeadsTotal AS DWORD
    SectorsPerTrack AS DWORD
    SectorsTotal AS QUAD
    BytesPerSector AS WORD
    End Type

    TYPE XInt13BufferStructure
    PacketSize AS BYTE
    Reserved AS BYTE
    BlocksToTransfer AS WORD
    TransferBuffer AS BYTE PTR
    StartingBlock AS QUAD
    END TYPE

    FUNCTION I13_48 (DriveInfo AS DriveParameters) As QUAD

    DriveInfo.size = SIZEOF(DriveInfo)

    REG %AX, &H4800
    REG %DX, &H0080
    REG %DS, VARSEG(DriveInfo)
    REG %SI, VARPTR(DriveInfo)
    CALL INTERRUPT %INT13

    IF UCASE$(COMMAND$) = "DRIVEINFO" THEN
    PRINT
    PRINT DriveInfo.Size;" Buffer Size"
    PRINT DriveInfo.InformationFlagTable;" Flag Table"
    PRINT DriveInfo.CylindersTotal;" Total Cylinders"
    PRINT DriveInfo.HeadsTotal;" Heads Total "
    PRINT DriveInfo.SectorsPerTrack;" SectorsPerTrack"
    PRINT DriveInfo.BytesPerSector;" BytesPerSector"
    PRINT
    END IF

    FUNCTION = CQUD(DriveInfo.SectorsTotal)

    END FUNCTION

    SUB I13_43(SectorNumber AS QUAD)
    DIM XInt13Buffer AS XInt13BufferStructure

    'Initialize Buffer Information For Write
    XInt13Buffer.PacketSize? = &H10
    XInt13Buffer.Reserved? = &H00
    XInt13Buffer.BlocksToTransfer?? = 1
    XInt13Buffer.TransferBuffer = VARPTR32(Sector)
    XInt13Buffer.StartingBlock&& = SectorNumber&&

    REG %AX,&H4300
    REG %DX,&H0080
    'Load Segment Pointer For Disk Address Packet Buffer Into DS Register
    REG %DS,VARSEG(XInt13Buffer)
    'Load Offset Pointer For Disk Address Packet Buffer Into SI Register
    REG %SI,VARPTR(XInt13Buffer)
    CALL INTERRUPT %INT13

    END SUB

    SUB I13_42(SectorNumber AS QUAD)
    DIM XInt13Buffer AS XInt13BufferStructure

    'Initialize Buffer Information For Write
    XInt13Buffer.PacketSize? = &H10
    XInt13Buffer.Reserved? = &H00
    XInt13Buffer.BlocksToTransfer?? = 1
    XInt13Buffer.TransferBuffer = VARPTR32(Sector)
    XInt13Buffer.StartingBlock&& = SectorNumber&&

    REG %AX,&H4200
    REG %DX,&H0080
    'Load Segment Pointer For Disk Address Packet Buffer Into DS Register
    REG %DS,VARSEG(XInt13Buffer)
    'Load Offset Pointer For Disk Address Packet Buffer Into SI Register
    REG %SI,VARPTR(XInt13Buffer)
    CALL INTERRUPT %INT13

    END SUB

    Leave a comment:


  • Peter Lameijn
    replied
    One version of DR-Dos (build 7.05, made for OnTrack diskmanager) should work with
    Fat32 / LBA disks > 8GB. (Never tried it though...)

    ------------------
    Peter.
    mailto[email protected][email protected]</A>

    [This message has been edited by Peter Lameijn (edited March 19, 2002).]

    Leave a comment:


  • Mike Doty
    replied
    Steve Gibson's Spinrite is DOS based
    so it might be possible. http://www.grc.com

    ------------------

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Originally posted by Matthew Berg:
    As for information on the INT 13h extensions, try Ralf Brown's Interrupt List.[/B]
    Try Going here http://www.pvv.ntnu.no/~steinarh/grub/prog-ref.html

    ------------------

    Leave a comment:


  • Matthew Berg
    replied
    As Tom said "I don't think this can be done from DOS...", I was just trying to point out that there is such a known limitation with respect to DOS.

    As for information on the INT 13h extensions, try Ralf Brown's Interrupt List.

    Leave a comment:


  • Mel Bishop
    replied
    Thanks for the info Matthew. Didn't help much. Didn't really
    expect it to tho' .

    I have a routine that uses int13 to read/write absolute sectors
    on a hard/floppy drive. They use the CHS so I can access a
    maximum of 1023 (0-1023) tracks, 255 (0-255) heads and 63 (1-63)
    sectors per track. That gives me a total of 8MB.

    I am trying to experiment with LBA addressing to access drives
    larger than 8mb but don't seem to be able to get the hang of it.

    BTW, what I am trying to accompish is a DOS based drive repair /
    file recovery program so when a drive goes south, the user may
    have a chance of recovering important files. This is, of course,
    assuming he/she doesn't have a current backup.

    I got it going pretty well for drives <= 8GB using CHS but I am
    going to need LBA capabilities as well. This is what I am after
    now.

    ------------------


    [This message has been edited by Mel Bishop (edited March 18, 2002).]

    Leave a comment:


  • Matthew Berg
    replied
    Read the Knowledge Base articles Q153550 and Q69912. Basically, it is impossible for DOS itself to have knowledge of HDD capacities larger than 8GB, because it is limited to using the CHS drive geometry. You may be able to take advantage of the INT 13h extensions in your own programs to overcome this limitation.

    Leave a comment:


  • Mel Bishop
    replied
    I wuz afraid you wuz gonna say sum'thin like that. Thanks I
    would prefer not to shell out but if that's what it takes....


    ------------------

    Leave a comment:


  • Tom Hanlin
    replied
    I don't think this can be done from DOS. It's not even supported in all
    versions of Windows. Your best bet, though, would probably be to SHELL
    to a Windows program that returns the results (or an error code).

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Mel Bishop
    started a topic Hard Drive Stats

    Hard Drive Stats

    I think this has been queried before but I can't seem to find it
    anywhere in the PB/DOS forum. I need to get drive stats on a
    hard drive over 8GB (total capacity, space-a, etc).

    Thanks
    Cheers


    ------------------
Working...
X