Since my last report on xdftool I have updated a few things:
- added support for RBD/RDSK hdf images
- changed repack command to be more flexible
- added open/create commands for better control of disk image geometry
In the following I give you a short round up of all new features by giving you some examples…
1. RDB Support
One very nasty thing when working with HDF image files is the fact that the extension .hdf is actually used for two types of different disk images in the context of Amiga emulation.
The first type is a disk image like a big floppy disk dump, i.e. it only contains a number of blocks and on these blocks an Amiga file system (like OFS or FFS) is located. Thats the way a floppy handles data. But in comparison with a floppy disk, a HDF has no pre-defined or fixed size. You can use every size for a HDF if you like. Now the drawback with these images is that you do not know the disk geometry (given in cylinders, heads, and sectors) directly but only the total size in bytes or blocks. You have to apply some magic (here: algorithms) to deduce the correct geometry. So this type of disk image is only fully useable if you know the disk geometry as external information. I call this type a partition HDF image because this type of image can be created by extracting the contents of a disk partition into an image file.
The other type I call a whole disk HDF image because it stores the whole contents of the disk. This includes some blocks describing the paritions found on this disk. This information starts with a RDISK/RDB (Rigid Disk Block) and thus images containing paritioning informations on an Amiga called like this first block RDB. The RDB references information on all partitions and knowns how large they are, what disk geometry the use locally and what file systems reside on them. Additionally, each partition has a AmigaOS device name associated so you can address them on your Amiga (e.g. dh0, dh1, …). An RDB is typically set up on a blank disk with the HDToolBox program on AmigaOS (soon you can use amitools’ rdbtool for that – but thats another story/blog post ;)).
I distuingish these two types by naming my images differently: partition HDFs with *.hdf and disk images with *.rdsk, but thats my personal approach and unfortonately not widely used.
I added support of these RDB images to xdftool fully transparently, i.e. you simply specify a *.hdf file of any of the two types and xdftool will do the right thing. If its a partition HDF then there is only one file system and you can work with this one immediately:
> xdftool wb31.hdf blkdev cylinders:Â Â 1280 heads:Â Â Â Â Â Â 1 sectors:Â Â Â Â 32 block_bytes: 512 reserved:Â Â Â 2 bootblocks:Â 2
This command prints the disk geometry detected from the byte size of the disk image. If the detection went wrong you can specify the new open command and give the missing parameters:
> xdftool wb31.hdf open chs=640,2,32 + blkdev cylinders:Â Â 640 heads:Â Â Â Â Â Â 2 sectors:Â Â Â Â 32 block_bytes: 512 reserved:Â Â Â 2 bootblocks:Â 2
This forces a disk geometry of 10 cylinders, 2 heads and 32 sectors. Another approach is to still use auto-detection but guide it by giving the heads or/and sectors count:
> xdftool wb31.hdf open h=2 + blkdev cylinders:Â Â 640 heads:Â Â Â Â Â Â 2 sectors:Â Â Â Â 32 block_bytes: 512 reserved:Â Â Â 2 bootblocks:Â 2
With a RDB/RDSK whole disk image you do not need to specify any geometry as this information is stored in the RDB structure. The only thing you have to specify is what partition shall xdftool work on. As xdftool only works on file system level you have to choose the partition either by giving the device name of AmigaOS (e.g. dh0, dh1) or the index number (starting with 0 for the first partition):
> xdftool wb31.rdsk open part=dh1 + list
This list the contents of the second partition on my wb31 whole disk image (being dh0 the first partition). If you do not specify a partition then xdftool automatically takes the first partition:
> xdftool wb31.rdsk list
2. New Create Command
With the new open command in place I added a new create command to create empty disk images of a given size. For ADFs the size is pre-defined so you need no extra arguments:
> xdftool empty.adf create  # create empty (and unformatted) floppy disk image
but for a (partition) HDF you have to give the size. You can either give a size in bytes (with short cuts for M)ega G)iga… and ‘i’ for KiBi units) and use the internal algorithm for disk geometry or directly specify “chs” (cylinder, heads, and sectors):
> xdftool empty.hdf create size=10Mi > xdftool empty.hdf create chs=10,1,32 > xdftool empty.hdf create size=10Mi h=2
In the last example you see that you can also hint the disk geometry algorithm and specify the heads count (similar to the open command above).
Note: you will need to format this image before usage
2nd Note: you cannot create a full RDB/RDSK image with xdftool. Use HDToolBox on your Amiga (or soon: rdbtool) for that!
Typically You use a create command followed by a format command to create a file system you can work with:
> xdftool new.adf create + format MyDisk > xdftool work.hdf create size=10Mi + format Work ffs
As this is used very often the format can do an implicit create if you simply omit the create command. Then you have to specify the options for create with the format command:
> xdftool new.adf format MyDisk > xdftool work.hdf format Work size=10Mi ffs
3. Repack Command Changed
With the rework done handling rdisk and hdf I had to change the existing repack command. In older xdftool version you specify a new image as argument and the given image on the xdftool command line was the source. This is now flipped:
> xdftool old.hdf repack new.hdf  # OLD syntax > xdftool new.hdf repack old.hdf # NEW syntax
I changed it to make its usage more versatile: You can give open like options (see above) in the repack command to specify the source image:
> xdftool new.hdf repack old.rdsk part=dh0Â # repack first partition into new partition image > xdftool new.hdf repack old.hdf chs=10,2,32Â Â # repack old image with given geometry
(Note: if you get an error that the new image can’t created then either remove the existing file first or specify the -f force option). Now you can also create a new image with different size or layout and repack all data into it:
> xdftool new.hdf create size=10Mi + repack wb31.hdf # move my wb disk into a larger image > xdftool disk.rdsk open part=dh0 + repack wb31.hdf # move my wb disk into a partition
That’s it! Have Fun!