OneGeekArmy / Disk-Jockey-Community

19 stars 0 forks source link

Help: Fixing large image #21

Closed Grieverheart closed 8 months ago

Grieverheart commented 8 months ago

I have a large image (30GB) which somehow got corrupted when running on a Quadra 840AV. I used dd and formatted the image with Drive Setup 1.7.3 and then installed a large number of games.

The drive image works fine on Basilisk II so that got me thinking that it might have something to do with the SCSI driver since Basilisk doesn't use SCSI. My idea now was to use the driver partitions generated by Disk Jockey. Unfortunately Disk-o-Matic reads the whole image in memory, so a 30GB image is never going to fit in my 8GB RAM. Instead I learned a bit about how apple disks are structured, and HFS and built a parser for boot0 and apple partition maps. Then, I parsed these from a Disk Jockey image, modified the number of blocks and appended to the modified boot0, partition maps, and driver partition, the data partition from the problematic image. Finally, I loaded the image on my BlueSCSI but the image failed to mount. The drive can certainly be seen, but it fails to mount. Do you know if there are other things I also need to modify, perhaps in the actual data volume to make it work with the Disk Jockey partitions?

EDIT: Maybe it's useful to add, that the way I installed games was using Basilisk and copying the SITs on the Desktop folder, expanding and moving the contents to the disk image. I thought this process might be flawed, but I tried it on two empty drives, one created with Drive Setup and one with Disk Jockey, and didn't have any problems.

Maybe the problem is somehow caused by Basilisk, since it crashed sometimes while installing games. But again, I wonder if I can find out why it's fine under Basilisk.

OneGeekArmy commented 8 months ago

Couple of things: Are you sure Disk-O-Matic is not be able to load your 30 GB image? It should map your file into virtual memory and keep physical RAM consumption to a minimum. It won't be fast, but it shouldn't kill your system.

It's hard to say what's missing because there are a few interconnected pieces here. However:

Hope this helps a bit

Grieverheart commented 8 months ago

About Disk-O-Matic, maybe then I had an issue because there is not enough free space on my hard drive for the virtual memory+output image. Hopefully if you can specify the output directory in a future release it might work.

I hope you don't mind, but I'll dump the contents of the partition information before and after the editing. Note that I also compared the hex output with a file generated by Disk Jockey, and it looked like it should, with only the number of blocks changed. The only other thing I found weird, is that Drive Setup made the volume bootable, and added 2 boot blocks (signature LK). I also tried zeroing out these two blocks, but that didn't have an effect either.

Before: ``` Block0( sbSigsbSig = ER sbBlkSize = 512 sbBlkCount = 62914560 sbDevType = 0 sbDevId = 0 sbDrvrData = 0 sbDrvrCount = 2 sbDrvrMap = [ DDMap( ddBlock = 64 ddSize = 22 ddType = 1 ), DDMap( ddBlock = 118 ddSize = 36 ddType = 65535 ), DDMap( ddBlock = 0 ddSize = 0 ddType = 0 ), DDMap( ddBlock = 0 ddSize = 0 ddType = 0 ), DDMap( ddBlock = 0 ddSize = 0 ddType = 0 ), DDMap( ddBlock = 0 ddSize = 0 ddType = 0 ), DDMap( ddBlock = 0 ddSize = 0 ddType = 0 ), DDMap( ddBlock = 0 ddSize = 0 ddType = 0 ) ] ) ApplePartitionMap( dpme_signature = PM dpme_map_entries = 6 dpme_pblock_start = 1 dpme_pblocks = 63 dpme_name = Apple dpme_type = Apple_partition_map dpme_lblock_start = 0 dpme_lblocks = 63 dpme_flags = dpme_boot_block = 0 dpme_boot_bytes = 0 dpme_load_addr = 0 dpme_load_addr_2 = 0 dpme_goto_addr = 0 dpme_goto_addr_2 = 0 dpme_checksum = 0 dpme_process_id = ) ApplePartitionMap( dpme_signature = PM dpme_map_entries = 6 dpme_pblock_start = 64 dpme_pblocks = 54 dpme_name = Macintosh dpme_type = Apple_Driver43 dpme_lblock_start = 0 dpme_lblocks = 54 dpme_flags = VALID, ALLOCATED, IN_USE, BOOTABLE, READABLE, WRITABLE, OS_PIC_CODE, OS_SPECIFIC_1 dpme_boot_block = 0 dpme_boot_bytes = 11264 dpme_load_addr = 0 dpme_load_addr_2 = 0 dpme_goto_addr = 0 dpme_goto_addr_2 = 0 dpme_checksum = 15872 dpme_process_id = 68000 ) ApplePartitionMap( dpme_signature = PM dpme_map_entries = 6 dpme_pblock_start = 118 dpme_pblocks = 74 dpme_name = Macintosh dpme_type = Apple_Driver43 dpme_lblock_start = 0 dpme_lblocks = 74 dpme_flags = VALID, ALLOCATED, IN_USE, BOOTABLE, READABLE, WRITABLE, OS_PIC_CODE, OS_SPECIFIC_1 dpme_boot_block = 0 dpme_boot_bytes = 18432 dpme_load_addr = 0 dpme_load_addr_2 = 0 dpme_goto_addr = 0 dpme_goto_addr_2 = 0 dpme_checksum = 27562 dpme_process_id = 68000 ) ApplePartitionMap( dpme_signature = PM dpme_map_entries = 6 dpme_pblock_start = 192 dpme_pblocks = 512 dpme_name = Patch Partition dpme_type = Apple_Patches dpme_lblock_start = 0 dpme_lblocks = 512 dpme_flags = dpme_boot_block = 0 dpme_boot_bytes = 0 dpme_load_addr = 0 dpme_load_addr_2 = 0 dpme_goto_addr = 0 dpme_goto_addr_2 = 0 dpme_checksum = 0 dpme_process_id = ) ApplePartitionMap( dpme_signature = PM dpme_map_entries = 6 dpme_pblock_start = 704 dpme_pblocks = 62913847 dpme_name = untitled dpme_type = Apple_HFS dpme_lblock_start = 0 dpme_lblocks = 62913847 dpme_flags = VALID, ALLOCATED, IN_USE, BOOTABLE, READABLE, WRITABLE, OS_PIC_CODE, OS_SPECIFIC_1 dpme_boot_block = 0 dpme_boot_bytes = 0 dpme_load_addr = 0 dpme_load_addr_2 = 0 dpme_goto_addr = 0 dpme_goto_addr_2 = 0 dpme_checksum = 0 dpme_process_id = ) ApplePartitionMap( dpme_signature = PM dpme_map_entries = 6 dpme_pblock_start = 62914551 dpme_pblocks = 10 dpme_name = Extra dpme_type = Apple_Free dpme_lblock_start = 0 dpme_lblocks = 10 dpme_flags = dpme_boot_block = 0 dpme_boot_bytes = 0 dpme_load_addr = 0 dpme_load_addr_2 = 0 dpme_goto_addr = 0 dpme_goto_addr_2 = 0 dpme_checksum = 0 dpme_process_id = ) ```
After: ``` Block0( sbSigsbSig = ER sbBlkSize = 512 sbBlkCount = 62913943 sbDevType = 1 sbDevId = 1 sbDrvrData = 0 sbDrvrCount = 1 sbDrvrMap = [ DDMap( ddBlock = 64 ddSize = 19 ddType = 1 ), DDMap( ddBlock = 0 ddSize = 0 ddType = 0 ), DDMap( ddBlock = 0 ddSize = 0 ddType = 0 ), DDMap( ddBlock = 0 ddSize = 0 ddType = 0 ), DDMap( ddBlock = 0 ddSize = 0 ddType = 0 ), DDMap( ddBlock = 0 ddSize = 0 ddType = 0 ), DDMap( ddBlock = 0 ddSize = 0 ddType = 0 ), DDMap( ddBlock = 0 ddSize = 0 ddType = 0 ) ] ) ApplePartitionMap( dpme_signature = PM dpme_map_entries = 3 dpme_pblock_start = 1 dpme_pblocks = 63 dpme_name = Apple dpme_type = Apple_partition_map dpme_lblock_start = 0 dpme_lblocks = 63 dpme_flags = VALID, ALLOCATED, IN_USE, READABLE, WRITABLE dpme_boot_block = 0 dpme_boot_bytes = 0 dpme_load_addr = 0 dpme_load_addr_2 = 0 dpme_goto_addr = 0 dpme_goto_addr_2 = 0 dpme_checksum = 0 dpme_process_id = ) ApplePartitionMap( dpme_signature = PM dpme_map_entries = 3 dpme_pblock_start = 64 dpme_pblocks = 32 dpme_name = Macintosh dpme_type = Apple_Driver43 dpme_lblock_start = 0 dpme_lblocks = 32 dpme_flags = VALID, ALLOCATED, IN_USE, BOOTABLE, READABLE, WRITABLE, OS_PIC_CODE dpme_boot_block = 0 dpme_boot_bytes = 9392 dpme_load_addr = 0 dpme_load_addr_2 = 0 dpme_goto_addr = 0 dpme_goto_addr_2 = 0 dpme_checksum = 63012 dpme_process_id = 68000 ) ApplePartitionMap( dpme_signature = PM dpme_map_entries = 3 dpme_pblock_start = 96 dpme_pblocks = 62913847 dpme_name = MacOS dpme_type = Apple_HFS dpme_lblock_start = 0 dpme_lblocks = 62913847 dpme_flags = VALID, ALLOCATED, IN_USE, READABLE, WRITABLE, OS_SPECIFIC_2 dpme_boot_block = 0 dpme_boot_bytes = 0 dpme_load_addr = 0 dpme_load_addr_2 = 0 dpme_goto_addr = 0 dpme_goto_addr_2 = 0 dpme_checksum = 0 dpme_process_id = ) ```
Grieverheart commented 8 months ago

I compared the binary output again, and found a discrepancy. It was in the reserved fields of the partition map, i.e. the fields after the processor type id. I didn't expect there to be data, so after I parsed/copied that properly, the drive was found! I cannot find any information online about these fields. Do you have any idea what they are used for? They seem to be populated only for the Driver PMs.

Unfortunately that didn't fix the drive corruption I see when I load it on my Quadra. Also, Finder is having a real hard time with the drive, so perhaps it's best if I make a big drive image with just all SIT/CDs and a smaller drive image ~4GB for installing just a few games I'm currently playing.