Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
209 user(s) are online (151 user(s) are browsing Forums)

Members: 1
Guests: 208

jabirulo, more...

Headlines

 
  Register To Post  

.hdf files (diskimage.device 52.x) [solved]
Just can't stay away
Just can't stay away


See User information
I've been trying to mount the gcc.hdf hardfile with diskimage.device using the following mountlist (it's a partition hardfile not a RDB one):

Quote:

Priority = 10
StackSize = 4096
GlobVec = 0
Surfaces = 1
BlocksPerTrack = 32
Reserved = 2
LowCyl = 0
HighCyl = 3905
Buffers = 50
BufMemType = 0
MaxTransfer = 0x7FFFFFFE
Mask = 0xFFFFFFFE
DosType = 0x444F5300


Also tried using:
Quote:

DosType = 0x444F5303

but it didn't help.

Most of the above is grabbed using Makemountlist in E-UAE so should be correct (LoCyl/HighCyl, etc.).

Does the TD_GETGEOMETRY implementation in diskimage.device matter at all in this case? I tried leaving the REMOVABLE flag unset but it didn't help any.

I can't understand why it isn't working...

Or could it be because I am first mounting the device and then "inserting" the disk? Doesn't seem like it to me though since the disk does show up, just that it shows up as "IHDO:Uninitialized" and can't be accessed...

Any help with getting this working would be appreciated.


Edited by salass00 on 2007/8/3 22:52:41
Go to top
Re: .hdf files (diskimage.device 52.x)
Home away from home
Home away from home


See User information
@salass00

BlocksPerTrack is normaly 512 bytes.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: .hdf files (diskimage.device 52.x)
Just can't stay away
Just can't stay away


See User information
@LiveForIt

You're thinking of BlockSize. BlocksPerTrack is usually 32 for harddisk partitions. It is also the same setting as I use in the E-UAE config file.

I've tried explicitly setting BlockSize to 512 but it didn't help any.

Go to top
Re: .hdf files (diskimage.device 52.x)
Home away from home
Home away from home


See User information
@salass00

Just a shot in the dark, got this from the UAE homepage.

Unit = 0
Flags = 0
Surfaces = 1
BlocksPerTrack = 32
Reserved = 1
Interleave = 0
LowCyl = 0
HighCyl = 3905
Buffers = 5
DosType = 0x444F5300
BufMemType = 1


I'd love to see hdf support in diskimage.device, keep on

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: .hdf files (diskimage.device 52.x)
Just can't stay away
Just can't stay away


See User information
@Raziel

I added some of the settings that were missing from my makefile but it didn't help any. Also tried with Reserved=1 (I used 2 with E-UAE though so that should be correct).

One interesting thing I noticed:

If I make a copy of the hardfile and then mount and format it the header looks very different.

Before:

00000000444F5303 00000000 00000000 00000000 DOS.............
0000001000000000 00000000 00000000 00000000 ................
0000002000000000 00000000 00000000 00000000 ................
0000003000000000 00000000 00000000 00000000 ................
0000004000000000 00000000 00000000 00000000 ................
0000005000000000 00000000 00000000 00000000 ................
0000006000000000 00000000 00000000 00000000 ................
0000007000000000 00000000 00000000 00000000 ................
00000080: 
00000000 00000000 00000000 00000000 ................
00000090: 
00000000 00000000 00000000 00000000 ................
000000A000000000 00000000 00000000 00000000 ................
000000B000000000 00000000 00000000 00000000 ................
000000C000000000 00000000 00000000 00000000 ................
000000D000000000 00000000 00000000 00000000 ................
000000E000000000 00000000 00000000 00000000 ................
000000F000000000 00000000 00000000 00000000 ................


After "quick format":

00000000444F5303 3B672C85 416D6967 61205061 DOS.;g,.Amiga Pa
00000010
72746974 696F6E3A 20536563 746F7253 rtitionSectorS
00000020
697A653D 35313220 53757266 61636573 ize=512 Surfaces
00000030
3D312053 6563746F 72735065 72426C6F =1 SectorsPerBlo
00000040
636B3D31 20536563 746F7273 50657254 ck=1 SectorsPerT
00000050
7261636B 3D312052 65736572 7665643D rack=1 Reserved=
0000006032205072 65416C6C 6F633D30 204C6F77 2 PreAlloc=0 Low
00000070
43796C3D 30204869 67684379 6C3D3132 Cyl=0 HighCyl=12
00000080: 34393939 20426F6F 74507269 3D302044 4999 BootPri=0 D
00000090: 6F735479 70653D30 78343434 46353330 osType=0x444F530
000000A0
30204E61 6D653D49 48443020 44617465 0 Name=IHD0 Date
000000B0
3D323030 372D3038 2D303300 00000000 =2007-08-03.....
000000C000000000 00000000 00000000 00000000 ................
000000D000000000 00000000 00000000 00000000 ................
000000E000000000 00000000 00000000 00000000 ................
000000F000000000 00000000 00000000 00000000 ................

Go to top
Re: .hdf files (diskimage.device 52.x)
Home away from home
Home away from home


See User information
@salass00

Well and if you try it with the partition data given after
the format?

(SectorSize=512)
Surfaces=1
(SectorsPerBlock=1)
(SectorsPerTrack=1)
Reserved=2
LowCyl=0
HighCyl=124999

(BootPri=0)
DosType=0x444F530

The HighCyl is interesting here, maybe the Makefile
generator has a bug?

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: .hdf files (diskimage.device 52.x)
Just can't stay away
Just can't stay away


See User information
@salass00

Quote:

salass00 wrote:
@Raziel

If I make a copy of the hardfile and then mount and format it the header looks very different.
FFS2 stores the geometry in the first sector when formatting a partition, recovery tools like the "Find Partitions" option in PartitionWizard can use this data to find lost partitions on a HD with a destroyed RDB. Old versions of FFS didn't do that.

But it shows your mountlist doesn't match the size of the image file:
Mountlist: 63995904 Bytes ((3905+1)*32*512)
Actual size (FFS2 using TD_GETGEOMETRY since LowCyl is 0): 64000000 Bytes ((124999+1)*512)

If the file is 64000000 bytes but you used an old version of FFS in UAE with the parameters from the mountlist it can't work, the old FFS uses the mountlist size, FFS2 the real size.

Either change the size of the file to 63995904 Bytes, or fix the geometry used in UAE to match the file size, for example 2500 Cylinders, 1 Head and 50 Sectors per Track. If you want to read the existing image with FFS2 you have to fix the file size, for example create copy with "dd if=broken_imagefile of=fixed_imagefile bs=512 count=124992".

Edit: Reserved has to match as well, usually it's 2, but if the image file was formatted with Reserved=1 in UAE you have to use that in the diskimage.device mountlist as well.

Go to top
Re: .hdf files (diskimage.device 52.x)
Just can't stay away
Just can't stay away


See User information
@joerg

Thanks for the explanation. So I guess if I modified TD_GETGEOMETRY to return the correct size it would work also. I'll have to try this out.

Go to top
Re: .hdf files (diskimage.device 52.x)
Just can't stay away
Just can't stay away


See User information
@salass00

Quote:

salass00 wrote:
@joerg

Thanks for the explanation. So I guess if I modified TD_GETGEOMETRY to return the correct size it would work also. I'll have to try this out.
No! If the size of the image file is 64000000 bytes you'd have to change TD_GETGEOMETRY to return the wrong size (124992 sectors, 63995904 bytes), that would make it work with this broken image file, but all correct image files would stop working.

Go to top
Re: .hdf files (diskimage.device 52.x)
Just can't stay away
Just can't stay away


See User information
@joerg

It worked . I could even mount the hardfile using "IDFO:" now.

Thanks a lot!

Still not a very ideal solution though. I'll have to think on this.

@all

Currently I'm thinking a command with a template like:

MountHardfile UNIT/K/N,FILE/A,DEVICENAME/K,BLOCKSPERTRACK/N,BLOCKSIZE/N,RESERVED/N,SURFACES/N

where all arguments except for file (and maybe unit and/or device name) are optional (sensible defaults will be used instead).

What do you people think?

Go to top
Re: .hdf files (diskimage.device 52.x)
Just can't stay away
Just can't stay away


See User information
@salass00

Quote:
Still not a very ideal solution though. I'll have to think on this.
If this error is common in UAE hardfiles I'd include a small tool to fix the broken image files.
BPTR fh = IDOS->Open(filename, MODE_OLDFILE);
if (fh)
{
if (!IDOS->ChangeFileSize(fh, correct_size, OFFSET_BEGINNING))
{
IDOS->PrintFault(IDOS->IoErr(), "fixing the size failed");
}
IDOS->Close(fh);
}

Go to top
Re: .hdf files (diskimage.device 52.x)
Just can't stay away
Just can't stay away


See User information
@joerg

Of course I would never hardcode such assumptions into the device! I'm not that stupid.

It's still a fact though that it returns the wrong dimensions in this case since it assumes the following:

BlockSize = 512
BlocksPerTrack = 1
Heads = 1
Cylinders = filesize / 512

So some way of letting the device know the correct BlocksPerTrack, Heads and BlockSize would be needed hence the command I propose above.

[edit]

Anyway you're idea for a tool for fixing the files sounds good since that would mean they would still be mountable the usual way. I think I'll go for that. Thanks.

[edit]

Done.


Edited by salass00 on 2007/8/3 22:52:04
Go to top
Re: .hdf files (diskimage.device 52.x)
Home away from home
Home away from home


See User information
@salass00

Heh, i was close to the solution

Maybe the fixing tool isn't needed at all?

Quote from an eMail @evilrich wrote on the E-UAE ml
on Thu, 26 Jul 2007 02:02:13 -0400
Quote:

New source code snapshot:
http://www.rcdrummond.net/uae/test/20070726/

This adds a new tool called make_hdf which can be used from the command-line
to create a blank hard-disk image (it also prints out appropriate config
options which can be appended to or cut-n-pasted into a config file).

Here's an example session:

evilrich@anaximander:~/work/e-uae/uae/build_i386_x11$ ./src/make_hdf
make_hdf <path> <size> [<device>]

<path> = file path to hdf image to create
<size> = size of image to create in MB
follow <size> by G to specify size in GB
<device> = device name to include in config option
defaults to DH0 if omitted
evilrich@anaximander:~/work/e-uae/uae/build_i386_x11$ ./src/make_hdf
~/work/test.hdf 4GB
hardfile2=rw,DH0:/home/evilrich/work/test.hdf,32,5,2,512,0,
hardfile=rw,32,5,2,512,/home/evilrich/work/test.hdf
evilrich@anaximander:~/work/e-uae/uae/build_i386_x11$

You get the idea. Hopefully this will stave off some of the "How do I create a
hard file" questions, and it'll mean users don't have to muck around with
figuring out geometries too much. Plus on Linux it'll create sparse files -
which is nice and really quick. Feedback welcome, but don't get too excited;
I want to keep this simple for right now.

People are dying.
Entire ecosystems are collapsing.
We are in the beginning of a mass extinction.
And all you can talk about is money and fairytales of eternal economic growth.
How dare you!
– Greta Thunberg
Go to top
Re: .hdf files (diskimage.device 52.x)
Just can't stay away
Just can't stay away


See User information
@salass00

Quote:
It's still a fact though that it returns the wrong dimensions in this case since it assumes the following:

BlockSize = 512
BlocksPerTrack = 1
Heads = 1
Cylinders = filesize / 512
Except for dg_SectorSize it's correct even for image files using a different block size since AmigaOS file systems only support block sizes which are a multiple of 512.

Quote:
So some way of letting the device know the correct BlocksPerTrack, Heads and BlockSize would be needed hence the command I propose above.
File systems don't use SectorsPerTrack, Heads or Cylinders, they only use dg_SectorSize and dg_TotalSectors. If LowCyl isn't 0 they calculate the number of sectors themself using the data from struct DosEnvec (totalsectors = (de_HighCyl-de_LowCyl+1) * de_BlocksPerTrack * de_Surfaces) on startup, but never use the number of sectors per track or heads later, only the start offset of the partition, the number of blocks and the blocksize is used. Even image files using a different block size are no problem, you just need a seperate mountlist for each block size you use, but you'd need that anyway even if you'd add support in diskimage.device for different sector sizes. For the file systems for example SectorSize = 2048, SectorPerBlock = 1 is exactely the same as SectorSize = 512, SectorPerBlock = 4 since they only use the block size (SectorSize * SectorsPerBlock).

If there wouldn't be UAE image files with a wrong size, UAE never accesses the spare additional space in them either, there would be no problem and you wouldn't have to add special support for wrong sized image files. IMHO correcting the size of such image files would be better than adding workarounds in diskimage.device.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project