Subscribe via RSS
5May/200

Formatting an IDE Drive for use in an Amiga 500

You may have previously seen the IDE Adapters that I'd built for my Amiga 500 over here (internal) and here (external). Whilst they worked very well with FAT32 drives attached, I had no end of trouble trying to work out how to partition, format and mount as a native Amiga disk. For everything below, you'll want to use this bootdisk.

The FastFileSystem

Digging through the blog, I'd remembered that I'd done a bit of this back in the day when mucking around with the Amiga 1200. I had used a CF card internally on the A1200 and installed WB3.9 succesfully on a SmartFileSystem Partition. Unfortunately, we can't use that on the A500, so we'll be basing our partitions on FFS, or FastFileSystem. This comes with Workbench 2.0+, but you'll need the file sitting in your L folder for anything lower.

Connecting a drive

Since we're talking IDE, we'll need an adapter. As per my previous mentions, you can find how to build an internal one here and an external one here. Both work great, but follow the posts there for the caveats and tricks when connecting and powering drives.

DSC00238 DSC00244 DSC04120

Note that this can also apply to SCSI drives. Just disregard the steps to add the driver to the disk and/or HDToolBox in the next section.

Partitioning

We'll use HDToolBox for this. It's on the bootdisk I've provided and it's already configured to use the ide.device driver installed in the devs folder. If you're rolling your own, then you'll need to copy the driver over to your floppy and edit the icon for HDToolBox to specify a SCSI_DEVICE_NAME as such...

DSC00303 DSC00305 DSC00307

This is an important step and you'll need a bit of patience... HDToolBox will sit for around 5 minutes interrogating LUNs with no disks, waiting for a response. If you've only connected one drive as master or slave, then the opposite LUN will pause. Below, I've only connected a master, so I saw the message "Checking ide.device address 0 unit 1..." (IDE slave) for a looooong time... but all came good!

DSC00308 DSC00309 DSC00310

From here, you'll need to change the drive type and read the parameters from the drive. Click Change Drive Type and then choose to add a new drive definition. Hit the Read from drive button on the right and cross your fingers.

DSC00311 DSC00312 DSC00313

The shot below shows where HDToolBox has detected by Disk Smith 32mb CF Card. Unfortunately it then failed when trying to write the actual partition table to the disk.

DSC00314 DSC00315 DSC00316

Partition sizing is important, so make sure you pay careful attention to all parameters. The Amiga 500 format application will error out if you try to make a partition too large. Unless you have an upgraded system with more RAM than the standard, don't try and partition a drive that is too big! For example, my 128mb (yes, megabyte!) CF card with one partition formats fine, but if you try a 2gig or 4gig card, you'll have trouble with the auto-detected settings. Here's an idea of the parameters that I've tried...

DSC00366

Size 4096mb 2048mb 128mb 32mb
brand SanDisk WINTEC Dick Smith
ext.power +5v No
cyl 3970 3970 12000 1002 496
heads 16 4 8 8 4
blocks per track 63 256 32 32 32
blocks per cyl 1008 1008 256 256 128
Part.Size (~mb) 1990 950 650 487 196 97 976 487 196 97 749 128 ??
cyl.start 2 2 2 2 2 2 2 2 2 2 2 2 2
cyl.end 3968 1985 1323 992 400 200 1985 992 400 200 6000 1001 495
Result COULD NOT DETECT DRIVE SIZE CANNOT FIND HANDLER NOT ENOUGH MEMORY SUCCESS SUCCESS DEAD CARD

I read in one of the IDE adapter's instructions that you need to have a low cylinder count, so that's why I started with higher surfaces/heads... but instead it seems that a higher cylinder count works better? There's also talk of making sure that your partition sizes match boundaries of the chips inside your CF cards... but I'm not going to pull one open. All I can recommend is that you detect the settings via HDToolBox and then manipulate them to have a higher cylinder count so that surfaces/heads and blocks are lower.

Anyway, where was I? Creating partitions! After you've adjusted the drive parameters, you can click Partition Drive and set up the partitions. It defaults to two, halving the drive. Note the names and sizes, as you'll need them for the mountlist in the future. I changed the layout by deleting the second partition and stretching the first to the end.

DSC00320 DSC00321 DSC00322

Again, write down those start and end cylinder offsets! You can now hit ok-ok-ok-finish and save all settings. The Amiga will probably reboot.

Mountlist

So, remember how I told you to remember those parameters above? You wrote them all down, didn't you? If you didn't, please open up HDToolBox again and record the numbers from the Drive Type screen and the Advanced area in the Partitioning screen. Once you've noted it all down, you're ready to edit ide.ml. On the bootdisk provided, this is located in the devs folder. If you've booted this disk, then just open Shell and type ed devs/ide.ml and press enter.

DSC00349

Once you're in here, you just need to manipulate the fields to match your partition. Starting on the very first line, make sure the name is correct. Change DH0 to whatever you've called yours. Note, there's a bunch of example partition mappings in this file. If you want to use one of the below versions, you can press CTRL-B to delete lines from the text file. For example, you could start at the very top row, hit CTRL-B 17+ times and wipe the top example. Just for fun, here's a reproduction with comments of what you need to change.

IDH0:
FileSystem   = L:FastFileSystem    ; If you want FAT32, then scroll down
Device = ide.device

Unit = 0                   ; 0 = MASTER, 1 = SLAVE

Flags = 0

Surfaces = 4               ; From HDToolBox (HEADS)
BlocksPerTrack = 63        ; From HDToolBox (Blocks Per Track)

Reserved = 2
Interleave = 0

                           ; For the next two values, you'll need
                           ;    to have opened the advanced area when
                           ;    creating partitions in HDToolBox
LowCyl = 2                 ; Start Cyl from Advanced Options
HighCyl = 256              ; End Cyl from Advanced Options
Buffers = 30
GlobVec = -1
BufMemType = 1
DosType = 0x444F5301   ; FFS Dos Type, leave as-is.
Mount = 1
#

Apologies that the photo above doesn't match the final file that is on the bootdisk! I made the final file match the rest of the examples here as much as possible. Either way, just make sure you get the details in correctly and that there's no other duplicate partition name/definition in ide.ml.

Mounting and Formatting

Before you can do anything with the drive, you'll need to make it available to the system. The low-level tools, as per HDToolBox above, can use the drivers to find and interrogate drives, but they don't make them available to the system directly. To do this, we'll need to use the mount command, pointing it to the mountlist we've created above. Type in the following from a Shell.

mount DH0: from devs/ide.ml

Make sure that you've replaced DH0 with your partition name and leave the colon at the end. The from operator tells mount not to use the standard mountlist and instead use the file that we specify afterwards. Hit enter and you should be put back to the command prompt without any messages or warnings. The only thing that might happen is that you get a drive visible on the workbench... if this happens, then somehow the partition you've mapped is already formatted and ready-to-go. If this is a surprise, then don't try and open it... anything could happen.

From here we'll want to format the drive. The format command is used here with the DRIVE and NAME parameters. We then specify the disk format at the end.

format DRIVE dh0: NAME CFCARD0 ffs

Above, you can see the partition name is DH0:. As per usual, replace this with your partition name, leaving the colon at the end. After NAME you can type a friendly name for your partition. This is the name that'll show under the icon on your workbench. It's also the name that you can use in Shell.

DSC00359

Do you like the name I gave it? You'll see it's legit as it's in the screenshots below when copying files. I'd gotten pretty desperate after a miriad of partition size permutations, trying to get a format session not to fail. Finally, as per above, one worked... but not before I started typing stupid names for the formatted partition name!

Note that you can add the term quick to the end if you just want to quick format, but I recommend to do a full format the first time!

Workbench

With the drive totally prepared, it should be visible on the workbench with a single Trashcan inside of it. From here, we'll want to transfer the OS onto it, so go ahead and purchase the Floppy & Hard Disk Image Pack from Amiga Forever. In the kit you'll have two ADF images: one for Workbench 1.3 and another is the Extras 1.3 disk. You'll need to insert these one at a time and copy the entire contents of each onto your new partition.

A quick note on copying disks on the A500: Regardless if you're using real floppies or a Gotek, floppy-switcheroo is the name of the game when trying to get Workbench copied over onto the IDE HDD. Firstly, understand that the copy command is an executable that lives in the c folder of your bootdisk. You can easily copy files around when the bootdisk is inserted. Issues start to arise when you switch disks and try to call copy or any other executables that 'exist' on the bootdisk. Workbench will ask you to insert the bootdisk first to find the executable and then actually run the requested command with its parameters.

This is all fine and well, until you try the following command:

copy DF0: DH0: ALL

It looks simple enough... I've swapped the Workbench 1.3 disk in and asked it to copy. Of course, when it started to execute, it asked me for the disk which contains the actual copy executable:

DSC00365

Yeah, I know, it says A590Setup... a good hint as to what disk I created this IDE Boot Disk off. Anyway, the point is that that was my boot disk and that's where copy lived. Once you switch the disk in, it'll start to execute copy... and copy from DF0 to DH0. Sounds good? It wasn't! As I wanted Workbench 1.3 to copy over, not my boot disk! Because I had DF0: in the copy command, and not workbench1.3:, it's just copying from the drive after swapping the bootdisk in and hasn't checked the name!

To solve this, we have two options. If you're using my bootdisk, then I've already solved it for you with the first option: make the copy program resident. In startup-sequence, I've called the resident command with copy as an argument, making Workbench copy the copy executable to system RAM (not the RAM: disk!) and persist it there during floppy disk changes. This means that it's always available whenever you need to call it.

The second option is shown below. Copy copy to RAM: (the actual RAM disk) and call it from there via RAM:copy.

DSC00363

... copy ... copy ... copy ...

DSC00364

Note that the Workbench 1.3 floppy has a space in its name and that the copy command can't handle this without special formatting. I guessed and tried to reference it as workbench1.3: without the space and somehow this worked fine? I then tried the same method with the Extras 1.3 disk, but that failed entirely. Due to not knowing how to reference it, I used DF0: instead and hence wound up with the situation above where I copied over the wrong disk. After a quick bit of googlin' now, it seems that you simply have to double-quote things:

copy "extras 1.3:" dh0: all

I'll try that at a later date.

Bootable disk

The bootdisk mentioned throughout this article can be converted to an actual bootdisk. I suppose I should've called it a setup disk at first, but it is actually still a standalone bootdisk. Or something. Anyway, it'll now be a bootstrapdisk, mapping the relevant OS drives and folders to the HDD and then kicking WB off from there. The startup-sequence files to do this are all ready to go. Open a shell and switch to the s folder. From there, ed startup-sequence.hd.

; Startup sequence for Hard Disk users...checks for hard disk, then
; transfers control if it is present. (The script assumes DH0:)
; TO USE: copy your normal startup-sequence files (Startup-Sequence,
; and StartupII to the S: directory of your hard disk.
; Then rename your normal Startup-Sequence file
; as Startup-Sequence.f in the S: directory of the floppy, just in case.
; Now replace the Startup-Sequence file on the floppy with this file.
;
Setpatch >NIL:
SYS:System/FastMemFirst
binddrivers

;The line below needs to be edited to match your partition name
;You also then need to make sure that ide.ml has the correct
; parameters for your partition!
mount IDH0: from devs/ide.ml
assign >NIL: IDH0: exists

IF NOT WARN
; hard disk is present
assign sys: IDH0:
assign c: SYS:c
assign L: SYS:l
assign FONTS: SYS:fonts
assign S: SYS:s
assign DEVS: SYS:devs
assign LIBS: SYS:libs
makedir ram:tr
assign t: ram:tr
execute s:Startup-Sequence
ENDIF
execute df0:s/Startup-Sequence.f

Simply make sure that IDH0 in all three places is changed to whatever your HDD partition name is and then rename the files:

rename startup-sequence startup-sequence.f
rename startup-sequence.hd startup-sequence

From here... reboot!

Filed under: C64/Amiga Leave a comment
Comments (0) Trackbacks (1)

No comments yet.


Leave a comment


*