Copyright (c) 2012-2016 Hyperion Entertainment and contributors.

RDB

From AmigaOS Documentation Wiki
Jump to: navigation, search

Introduction

The Rigid Disk Block (RDB) is the Amiga way to store information about mass storage geometries and partitioning. Compared to the old, but still widely in used PC standard Master Boot Record (MBR) its a flexible structure with a linked list for the partitions.

It is also able to store complete file system binaries and boot code, though this is not used on AmigaOS 4 anymore.

See also:

Physical versus logical sizes

Traditionally the RDB stores physical size values like cylinders, heads and sectors. But since a long time these values do not resemble the exact physical layout of a hard disk. Instead a partitioning software like Media Toolbox chooses values that multiply to the disk size. What matters for file system etc. is the logical size, i.e. the amount of sectors a partition has and the sector size.

Limits

It can store as much partitions as can fit in the reserved area for the RDB. There is no distinction between primary and logical partitions like in the Master Boot Record (MBR) standard for the PC platform.

Disk size

The RDB has a quite high limit on the maximum device size, but note that currently each file system interprets the partition layout by itself.

The raw, theoretical limit on the maximum device capacity is about 2^105 bytes:

32 bit rdb_Cylinders * 32 bit rdb_Heads * 32 bit rdb_Sectors * 512 bytes/sector for the HD size in struct RigidDiskBlock

It's even much more if the sector size (rdb_BlockBytes and de_SizeBlock) is larger than 512 bytes, but AmigaOS 4.1 doesn't support anything but 512 bytes/sector HDs yet.

Partition size

For the partitions the maximum size is:

32 bit (de_HighCyl + 1 - de_LowCyl) (to get the partition size) * 32 bit de_Surfaces * 32 bit de_SectorsPerTrack * 512 bytes/sector in struct DosEnvec (=pb_Environment[]) in struct PartitionBlock.

That's from the physical drive part, the actual disk size limit for the partitions may be much smaller depending on the partitioning software, if it's only using the logical sizes instead, which is likely the case, it's only 8 ZiB with 512 bytes/sector: 32 bit rdb_HiCylinder * 32 bit rdb_CylBlocks * 512 bytes/sector = 2^73 bytes. For using the logical sizes using simple uint64 calculations (with some overflow checks) should be enough, for more a math library with support for larger integers needs to be used which probably no partitioning software does.

Note: Nothing in struct RigiDiskBlock is used by the file systems for mounting the partitions, they only get the information from the struct PartitionBlock blocks, it's only a problem for the partitioning software creating the partitions correctly - as soon as there are HDs larger than 8 ZB while still using 512 bytes/sector if that ever happens.