10 March 2016, 10:00 | #1 |
Registered User
Join Date: Oct 2014
Location: Berlin
Posts: 131
|
Simulated Hardfile-Error?
Hi There,
I'm working on a Disk-Monitor/Editor, so I would like to have some Testcase. Does Anybody knows how to prepare a Hardfile that it behaves like a faulty Disk (have some Readerrors or such). Or does Anybody have a Hardfile with some detected BADB-Blocks (the ones that are chained in the Rigid-Disk-Block) ? TIA Sigma63 |
10 March 2016, 19:35 | #2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,026
|
A hardfile cannot have read errors. Just like an ADF it only stores user data, nothing below that level. The only way to get an error when reading from a HDF is to make partitions bigger than the HDF so that it tries to read outside of the disk.
|
10 March 2016, 21:03 | #3 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,570
|
Also returned error can be device driver specific or even semi-random if error reason is real bad block.
|
11 March 2016, 12:18 | #4 |
Registered User
Join Date: Oct 2014
Location: Berlin
Posts: 131
|
|
12 March 2016, 00:00 | #5 |
Global Moderator
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
|
|
12 March 2016, 00:05 | #6 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,026
|
You can flag any block as bad, but you cannot have true bad blocks in a HDF.
|
12 March 2016, 00:14 | #7 |
Global Moderator
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
|
I guess what I'm really asking is would HDTools, for example, actually create a hardfile with sectors flagged as bad from a hard disk with bad sectors? Would it not quit when it encounters a bad sector? (I haven't had any Amiga hard drives with bad sectors, so I really don't know.)
If so, then what the OP wants could be conjured up from a good RDB image and knowledge of how the sectors are mapped as bad in the RDB. In this way I imagine it would only be possible to mark the block as physically unreadable, but might that not be sufficient to test the OP's proposed Disk-Monitor/Editor error-trapping routines? Last edited by prowler; 12 March 2016 at 00:35. Reason: More questions. |
13 March 2016, 02:41 | #8 | |
Global Moderator
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
|
Well, it seems that I've opened a can of worms here!
Paul Overaa only briefly mentions hard disks in his otherwise excellent book Amiga Disks and Drives: Quote:
"RigidDiskBlock- Fields and Implementation The RigidDiskBlock (RDB) standard was borne out of the same development effort as HD_SCSICMD and as a result has a heavy bias towards SCSI. However, there is nothing in the RDB specification that makes it unusable for devices using other bus protocols. The XT style disks used in the A590 also support the RDB standard. The RDB scheme was designed to allow the automatic mounting of all partitions on a hard drive and subsequent booting from the highest priority partition even if it has a soft loaded filing system. Disks can be removed from one controller and plugged into another (supporting the RDB scheme) and will carry with it all the necessary information for mounting and booting with them. The preferred method of creating RigidDiskBlocks is with the HDToolBox program supplied by Commodore. Most controllers include an RDB editor or utility. When a driver is initialized, it uses the information contained in the RDB to mount the required partitions and mark them as bootable if needed. The driver is also responsible for loading any filing systems that are required if they are not already available on the filesystem.resource list. Filesystems are added to the resource according to DosType and version number. The following is a listing of devices/hardblocks.h that describes all the fields in the RDB specification: Code:
/*-------------------------------------------------------------------- * * This file describes blocks of data that exist on a hard disk * to describe that disk. They are not generically accessable to * the user as they do not appear on any DOS drive. The blocks * are tagged with a unique identifier, checksummed, and linked * together. The root of these blocks is the RigidDiskBlock. * * The RigidDiskBlock must exist on the disk within the first * RDB LOCATION LIMIT blocks. This inhibits the use of the zero * cylinder in an AmigaDOS partition: although it is strictly * possible to store the RigidDiskBlock data in the reserved * area of a partition, this practice is discouraged since the * reserved blocks of a partition are overwritten by "Format", * "Install", "DiskCopy", etc. The recommended disk layout, * then, is to use the first cylinder(s) to store all the drive * data specified by these blocks: i.e. partition descriptions, * file system load images, drive bad block maps, spare blocks, * etc. * * Though only 512 byte blocks are currently supported by the * file system, this proposal tries to be forward-looking by * making the block size explicit, and by using only the first * 256 bytes for all blocks but the LoadSeg data. * *------------------------------------------------------------------*/ /* * NOTE * optional block addresses below contain $ffffffff to indicate * a NULL address, as zero is a valid address */ struct RigidDiskBlock { ULONG rdb_ID; /* 4 character identifier */ ULONG rdb_SummedLongs; /* size of this checksummed structure */ LONG rdb_ChkSum; /* block checksum (longword sum to zero) */ ULONG rdb_HostID; /* SCSI Target ID of host */ ULONG rdb_BlockBytes; /* size of disk blocks */ ULONG rdb_Flags; /* see below for defines */ /* block list heads */ ULONG rdb_BadBlockList; /* optional bad block list */ ULONG rdb_PartitionList; /* optional first partition block */ ULONG rdb_FileSysHeaderList; /* optional file system header block */ ULONG rdb_Driveinit; /* optional drive-specific init code */ /* Driveinit(lun,rdb,ior): "C" stk & dO/aO/al */ ULONG rdb_Reservedl[6]; /* set to $ffffffff */ /* physical-drive characteristics */ ULONG rdb_Cylinders; /* number of drive cylinders */ ULONG rdb_Sectors; /* sectors per track */ ULONG rdb_Heads; /* number of drive heads */ ULONG rdb_Interleave; /* interleave */ ULONG rdb_Park; /* landing zone cylinder */ ULONG rdb_Reserved2[3]; ULONG rdb_WritePreComp; /* starting cylinder: write precompensation */ ULONG rdb_ReducedWrite; /* starting cylinder: reduced write current */ ULONG rdb_StepRate; /* drive step rate */ ULONG rdb_Reserved3[5]; /* logical drive characteristics */ ULONG rdb_RDBBlocksLo; /* low block of range reserved for hardblocks */ ULONG rdb_RDBBlocksHi; /* high block of range for these hardblocks */ ULONG rdb_LoCylinder; /* low cylinder of partitionable disk area */ ULONG rdb_HiCylinder; /* high cylinder of partitionable data area */ ULONG rdb_CylBlocks; /* number of blocks available per cylinder */ ULONG rdb_AutoParkSeconds; /* zero for no auto park */ ULONG rdb_Reserved4[2]; /* drive identification */ char rdb_DiskVendor[8]; char rdb_DiskProduct[16]; char rdb_DiskRevision[4]; char rdb_ControllerVendor[8]; char rdb_ControllerProduct[16]; char rdb_ControllerRevision[4]; ULONG rdb_Reserved5[10]; }; #define IDNAME_RIGIDDISK Ox5244534B /* 'RDSK' */ #define RDB_LOCATION LIMIT 16 #define RDBFB_LAST 0 /* no disks exist to be configured after */ #define RDBFF_LAST Ox01L /* this one on this controller */ #define RDBFB_LASTLUN 1 /* no LUNs exist to be configured greater */ #define RDBFF_LASTLUN Ox02L /* than this one at this SCSI Target ID */ #define RDBFB_LASTTID 2 /* no Target IDs exist to be configured */ #define RDBFF_LASTTID Ox04L /* greater than this one on this SCSI bus */ #define RDBFB_NORESELECT 3 /* don't bother trying to perform reselection */ #define RDBFF_NORESELECT Ox08L /* when talking to this drive */ #define RDBFB_DISKID 4 /* rdb Disk ... identification valid*/ #define RDBFF_DISKID Ox10L #define RDBFB_CTRLRID 5 /* rdb Controller ... identification valid */ #define RDBFF_CTRLRID Ox20L /*------------------------------------------------------------------*/ struct BadBlockEntry { ULONG bbe_BadBlock; /* block number of bad block */ ULONG bbe_GoodBlock; /* block number of replacement block */ ); struct BadBlockBlock { ULONG bbb_ID; /* 4 character identifier */ ULONG bbb_SummedLongs; /* size of this checksummed structure */ LONG bbb_ChkSum; /* block checksum (longword sum to zero) */ ULONG bbb_HostID; /* SCSI Target ID of host */ ULONG bbb_Next; /* block number of the next BadBlockBlock */ ULONG bbb_Reserved; struct BadBlockEntry bbb_BlockPairs[61]; /* bad block entry pairs */ /* note [61] assumes 512-byte blocks */ }; #define IDNAME_BADBLOCK Ox42414442 /* 'BADB' */ /*------------------------------------------------------------------*/ struct PartitionBlock { ULONG pb_ID; /* 4 character identifier */ ULONG pb_SummedLongs; /* size of this checksummed structure */ LONG pb_ChkSum; /* block checksum (longword sum to zero) */ ULONG pb_HostID; /* SCSI Target ID of host */ ULONG pb_Next; /* block number of the next PartitionBlock */ ULONG pb_Flags; /* see below for defines */ ULONG pb_Reserved1[2]; ULONG pb_DevFlags; /* preferred flags for OpenDevice */ UBYTE pb_DriveName[32]; /* preferred DOS device name: BSTR form */ /* (not used if this name is in use) */ ULONG pb_Reserved2[15]; /* filler to 32 longwords */ ULONG pb_Environment[17]; /* environment vector for this partition */ ULONG pb_EReserved[15]; /* reserved for future environment vector */ }; #define IDNAME_PARTITION Ox50415254 /* 'PART' */ #define PBFB_BOOTABLE 0 /* this partition is intended to be boatable */ #define PBFF_BOOTABLE 1L /* (expected directories and files exist) */ #define PBFB_NOMOUNT 1 /* do not mount this partition (e.g. manually */ #define PBFF_NOMOUNT 2L /* mounted, but space reserved here) */ /*------------------------------------------------------------------*/ struct FileSysHeaderBlock { ULONG fhb_ID; /* 4 character identifier */ ULONG fhb_SummedLongs; /* size of this checksummed structure */ LONG fhb_ChkSum; /* block checksum (longword sum to zero) */ ULONG fhb_HostID; /* SCSI Target ID of host */ ULONG fhb_Next; /* block number of next FileSysHeaderBlock */ ULONG fhb_Flags; /* see below for defines */ ULONG fhb_Reserved1[2]; ULONG fhb_DosType; /* file system description: match this with */ /* partition environment's DE DOSTYPE entry */ ULONG fhb_Version; /* release version of this code */ ULONG fhb_PatchFlags; /* bits set for those of the following that */ /* need to be substituted into a standard */ /* device node for this file system: e.g. */ /* Ox180 to substitute SegList & GlobalVec */ ULONG fhb_Type; /* device node type: zero */ ULONG fhb_Task; /* standard dos "task" field: zero */ ULONG fhb_Lock; /* not used for devices: zero */ ULONG fhb_Handler; /* filename to loadseg: zero placeholder */ ULONG fhb_StackSize; /* stacksize to use when starting task */ LONG fhb_Priority; /* task priority when starting task */ LONG fhb_Startup; /* startup msg: zero placeholder */ LONG fhb_SegListBlocks; /* first of linked list of LoadSegBlocks: */ /* note that this entry requires some */ /* processing before substitution */ LONG fhb_Global Vec; /* BCPL global vector when starting task */ ULONG fhb_Reserved2[23]; /* (those reserved by PatchFlags) */ ULONG fhb_Reserved3[21]; }; #define IDNAME_FILESYSHEADER Ox46534844 /* 'FSHD' */ /*------------------------------------------------------------------*/ struct LoadSegBlock { ULONG lsb_ID; /* 4 character identifier */ ULONG lsb_SummedLongs; /* size of this checksummed structure */ LONG lsb_ChkSum; /* block checksum (longword sum to zero) */ ULONG lsb_HostID; /* SCSI Target ID of host */ ULONG lsb_Next; /* block number of the next LoadSegBlock */ ULONG lsb_LoadData[123]; /* data for "loadseg" */ /* note [123] assumes 512 byte blocks */ }; #define IDNAME_LOADSEG Ox4C534547 /* 'LSEG' */ Last edited by prowler; 13 March 2016 at 20:56. Reason: The above listing is now accurate. |
|
13 March 2016, 17:51 | #9 | |
Global Moderator
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
|
Quote:
From what I have seen in the RigidDiskBlock explanation, I imagine that if anyone had an RDF image created by HDTools from a hard drive with some BADB-Blocks, then these blocks would have bad block entries in the RDB and been substituted with replacement blocks from the reserved pool of spare disk blocks. Therefore, at the filesystem level, there would indeed be no bad blocks and in that case such a hard file would be of no use as a testcase, unless the OP's proposed Disk Monitor/Editor is also intended for use at the low level. Really, I wish to know whether, in this instance, I'm wasting my time trying to find a way of artificially creating bad sectors on an RDB image where there are none, as far as I yet know. |
|
13 March 2016, 18:06 | #10 | |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,349
|
Quote:
I'm not sure exactly which device drivers (scsi.device etc.) support bad block lists. I know at least one does because I remember looking at its code. The driver has to handle remapping accesses to blocks which are marked as bad. Many/most probably don't because it would significantly complicate the code, and most(?) SCSI drives can be told to remap bad sectors so from then on access is transparent to the host computer. |
|
13 March 2016, 18:15 | #11 | ||
Global Moderator
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
|
Quote:
I have corrected a typo in my listing. It appears to be an earlier version than the one given in your link. However I have left mine as is to match the one in the manual. Quote:
Last edited by prowler; 13 March 2016 at 21:04. Reason: Corrected the listing in my earlier post. |
||
13 March 2016, 21:27 | #12 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,026
|
An RDF is a HDF with an RDB. You cannot have real bad blocks in any type of image format. These images only store user data, 512 bytes per block. There is no way to make such a block bad (unreadable). A real harddrive stores error detection data on the magnetic disk so that it can determine whether the user data is still intact or not. The data in an image file is always intact, there is no way to store a bad block in an image file.
|
13 March 2016, 21:51 | #13 | |
Global Moderator
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
|
Quote:
Nevertheless, what you have written above confirms that an RDF won't, in any event, provide the testcase that the OP is seeking. Last edited by prowler; 13 March 2016 at 22:00. |
|
13 March 2016, 22:18 | #14 |
Registered User
Join Date: Sep 2004
Location: Croatia
Age: 48
Posts: 54
|
This may be stupid idea, but since WinUAE can use real hard drives, why not just use one that is known to have bad blocks?That way you don't have to bother with image files, and can have a real test case.
|
13 March 2016, 22:36 | #15 |
Global Moderator
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
|
That's not a stupid idea at all. At this stage it appears to be the only option left.
|
13 March 2016, 23:18 | #16 | ||
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,026
|
Quote:
Quote:
|
||
13 March 2016, 23:31 | #17 | ||
Global Moderator
Join Date: Aug 2008
Location: Sidcup, England
Posts: 10,300
|
Quote:
Quote:
Last edited by prowler; 14 March 2016 at 18:46. Reason: Typo. |
||
14 March 2016, 08:41 | #18 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,570
|
HDF is exactly same as normal ADF. It can only contain "user" data, neither can have read errors.
UAE has external "geometry" file support (*.geom) that could also include list (or ranges) of blocks that have virtual read error. I'll think about it.. |
14 March 2016, 13:13 | #19 |
Registered User
Join Date: Oct 2014
Location: Berlin
Posts: 131
|
OK, It's time for me to come in again
First i would like to thank you all for your input and apologize for all who "wasted time" or got confused. To clarify some Things: Surely the Idea from Oxygene to use a real drive is great, but unfortunately i (think i) have no such drive, which is known to be weak or have Errors. So there was the idea of having a hardfile. I didn't know the term rdf to be a hdf with embedded RDB, so of cource i'm talking about an rdf! And yes i understand that for now a hardfile could not have "errors". What i want is a rdf, were the RDB contains some linked BADB-Block, regardless if they refer (in the rdf) to readable blocks or not. If anybody knows for sure he has a real drive with such BADB-Blocks, it would be nice to know how they were created (by HDToolbox or other?) and is willing to share a dump of the RDBs only (no need to get the actual data-blocks)! Otherwise i think i create simply a BADB-block by hand and see what will happen. @Toni: i would like to see such "external geometry file support" for hardfiles also, but that has no high priority |
14 March 2016, 13:18 | #20 | |
Registered User
Join Date: Oct 2014
Location: Berlin
Posts: 131
|
Quote:
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
WHDLoad error: error during 'resload_LoadKick' on monkey island & others | jamespstevenson | project.GameBase Amiga | 14 | 20 February 2014 05:33 |
ERROR: Metal Masters (Illegal Instruction / Address Error / Black Screen) | killergorilla | project.Killergorilla's WHD packs | 7 | 25 March 2012 15:32 |
ERROR: Leisure Suit Larry Enhanced (Address Error) | batwinky | project.Killergorilla's WHD packs | 23 | 30 January 2011 13:00 |
Name of simulated BBS intro? | Raizor | support.Demos | 5 | 14 January 2011 17:45 |
Hardfile not being seen | MobbyG | support.WinUAE | 7 | 20 December 2005 22:18 |
|
|