Apple Partitions

Systems running the Apple Macintosh operating system are not as common as those running Microsoft Windows, but they have been increasing in popularity with the introduction of Mac OS X, a UNIX-based operating system. The partitions that we will describe here can be found in the latest Apple laptops and desktops running OS X, older systems that are running Macintosh 9, and even the portable iPod devices that play MP3 audio. The partition map also can be used in the disk image files that a Macintosh system uses to transmit files. The disk image file is similar to a zip file in Windows or a tar file in Unix. The files in the disk image are stored in a file system, and the file system may be in a partition.

The design of the partition system in an Apple system is a nice balance between the complexity of DOS-based partitions and the limited number of partitions that we will see in the BSD disk labels. The Apple partition can describe any number of partitions, and the data structures are in consecutive sectors of the disk. This section will give an overview of the Apple partitions, the details of the data structures, and discuss how to view the details.

General Overview

The Apple partitions are described in the partition map structure, which is located at the beginning of the disk. The firmware contains the code that processes this structure, so the map does not contain boot code like we saw in the DOS partition table. Each entry in the partition map describes the starting sector of the partition, the size, the type, and the volume name. The data structure also contains values about data inside of the partition, such as the location of the data area and the location of any boot code.

The first entry in the partition map is typically an entry for itself, and it shows the maximum size that the partition map can be. Apple creates partitions to store hardware drivers, so the main disk for an Apple system has many partitions that contain drivers and other non-file system content. Figure 5.9 shows an example layout of an Apple disk with three file system partitions and the partition for the partition map.

Figure 5.9. An Apple disk with one partition map partition and three file system partitions.

We will later see that BSD systems have a different partition structure called the disk label. Even though Mac OS X is based on a BSD kernel, it uses an Apple partition map and not a disk label.

Data Structures

Now that we have examined the basic concepts of an Apple partition, we can look at the data structures. As with other data structures in this book, they can be skipped if you are not interested. This section also contains the output of some analysis tools using an example disk image.

Partition Map Entry

The Apple partition map contains several 512-byte data structures, and each partition uses one data structure. The partition map starts in the second sector of the disk and continues until all partitions have been described. The partition data structures are laid out in consecutive sectors, and each map entry has a value for the total number of partitions. The 512-byte data structure is shown in Table 5.7.

Table 5.7. Data structure for Apple partition entries.

Byte Range

Description

Essential

01

Signature value (0x504D)

No

23

Reserved

No

47

Total Number of partitions

Yes

811

Starting sector of partition

Yes

1215

Size of partition in sectors

Yes

1647

Name of partition in ASCII

No

4879

Type of partition in ASCII

No

8083

Starting sector of data area in partition

No

8487

Size of data area in sectors

No

8891

Status of partition (see table 5-8)

No

9295

Starting sector of boot code

No

9699

Size of boot code in sectors

No

100103

Address of boot loader code

No

104107

Reserved

No

108111

Boot code entry point

No

112115

Reserved

No

116119

Boot code checksum

No

120135

Processor type

No

136511

Reserved

No

The type of partition is given in ASCII and not as an integer as other partition schemes use. The status values for each partition apply to both older A/UX systems and modern Macintosh systems. A/UX is an older operating system from Apple. The status value can have one of the values shown in Table 5.8 [Apple 1999].

Table 5.8. Status value for Apple partitions.

Type

Description

0x00000001

Entry is valid (A/UX only)

0x00000002

Entry is allocated (A/UX only)

0x00000004

Entry in use (A/UX only)

0x00000008

Entry contains boot information (A/UX only)

0x00000010

Partition is readable (A/UX only)

0x00000020

Partition is writable (Macintosh & A/UX)

0x00000040

Boot code is position independent (A/UX only)

0x00000100

Partition contains chain-compatible driver (Macintosh only)

0x00000200

Partition contains a real driver (Macintosh only)

0x00000400

Partition contains a chain driver (Macintosh only)

0x40000000

Automatically mount at startup (Macintosh only)

0x80000000

The startup partition (Macintosh only)

The data area fields are used for file systems that have a data area that does not start at the beginning of the disk. The boot code fields are used to locate the boot code when the system is starting.

To identify the partitions in an Apple disk, a tool (or person) reads the data structure from the second sector. It is processed to learn the total number of partitions, and then the other partition information from it is collected. The first entry is usually the entry for the partition map itself. The next sector is then read, and the process continues until all partitions have been read. Here are the contents of the first entry in the partition map:


# dd if=mac-disk.dd bs=512 skip=1 | xxd

0000000: 504d 0000 0000 000a 0000 0001 0000 003f PM.............?

0000016: 4170 706c 6500 0000 0000 0000 0000 0000 Apple...........

0000032: 0000 0000 0000 0000 0000 0000 0000 0000 ................

0000048: 4170 706c 655f 7061 7274 6974 696f 6e5f Apple_partition_

0000064: 6d61 7000 0000 0000 0000 0000 0000 0000 map.............

0000080: 0000 0000 0000 003f 0000 0000 0000 0000 .......?........

0000096: 0000 0000 0000 0000 0000 0000 0000 0000 ................

[REMOVED]

Apple computers use Motorola PowerPC processors and, therefore, store data in big-endian ordering. As a result, we will not need to reverse the order of numbers like we did with DOS partitions. We see the signature value of 0x504d in bytes 0 to 1 and the number of partitions in bytes 4 to 7, which is 10 (0x0000000a). Bytes 8 to 11 show us that the first sector of the disk is the starting sector for this partition and that its size is 63 sectors (0x3f). The name of the partition is "Apple," and the type of partition is "Apple_partition_map." Bytes 88 to 91 show that no flags for this partition are set. Other entries in the partition map that are not for the partition map itself have status values set.

Example Image Tool Output

You can view an Apple partition map with mmls in The Sleuth Kit. The fdisk command in Linux will not show the contents of a partition map. Here are the results from running mmls on a 20GB iBook laptop:


# mmls -t mac mac-disk.dd

MAC Partition Map

Units are in 512-byte sectors





 Slot Start End Length Description

00: ----- 0000000000 0000000000 0000000001 Unallocated

01: 00 0000000001 0000000063 0000000063 Apple_partition_map

02: ----- 0000000001 0000000010 0000000010 Table

03: ----- 0000000011 0000000063 0000000053 Unallocated

04: 01 0000000064 0000000117 0000000054 Apple_Driver43

05: 02 0000000118 0000000191 0000000074 Apple_Driver43

06: 03 0000000192 0000000245 0000000054 Apple_Driver_ATA

07: 04 0000000246 0000000319 0000000074 Apple_Driver_ATA

08: 05 0000000320 0000000519 0000000200 Apple_FWDriver

09: 06 0000000520 0000001031 0000000512 Apple_Driver_IOKit

10: 07 0000001032 0000001543 0000000512 Apple_Patches

11: 08 0000001544 0039070059 0039068516 Apple_HFS

12: 09 0039070060 0039070079 0000000020 Apple_Free

In this output, the entries are sorted by starting sector, and the second column shows in which entry in the partition map the partition was described. In this case, the entries were already in sorted order. We can see in entry 12 that Apple reports the sectors that are not currently allocated. Entries 0, 2, and 3 were added by mmls to show what space the partition map is using and which sectors are free. The drivers listed here are used by the system when it is booting.

An alternative tool that can be used on a raw disk image is the pdisk tool with the -dump flag on OS X:


# pdisk mac-disk.dd -dump

mac-disk.dd map block size=512



 #: type name length base ( size )

 1: Apple_partition_map Apple 63 @ 1

 2: Apple_Driver43*Macintosh 54 @ 64

 3: Apple_Driver43*Macintosh 74 @ 118

 4: Apple_Driver_ATA*Macintosh 54 @ 192

 5: Apple_Driver_ATA*Macintosh 74 @ 246

 6: Apple_FWDriver Macintosh 200 @ 320

 7: Apple_Driver_IOKit Macintosh 512 @ 520

 8: Apple_Patches Patch Partition 512 @ 1032

 9: Apple_HFS untitled 39068516 @ 1544 ( 18.6G)

 10: Apple_Free 0+@ 39070060



Device block size=512, Number of Blocks=10053

DeviceType=0x0, DeviceId=0x0

Drivers-

1: @ 64 for 23, type=0x1

2: @ 118 for 36, type=0xffff

3: @ 192 for 21, type=0x701

4: @ 246 for 34, type=0xf8ff

As was mentioned in the Introduction, Apple disk image files (which are different from forensic disk image files) also can contain a partition map. A disk image file is an archive file that can save several individual files. It is similar to a zip file in Windows or a tar file in Unix. The disk image file can contain a single partition with a file system, or it can contain only a file system and no partitions. The layout of a test disk image file (files with an extension of .dmg) has the following layout:


# mmls -t mac test.dmg

MAC Partition Map

Units are in 512-byte sectors

 Slot Start End Length Description

00: ----- 0000000000 0000000000 0000000001 Unallocated

01: 00 0000000001 0000000063 0000000063 Apple_partition_map

02: ----- 0000000001 0000000003 0000000003 Table

03: ----- 0000000004 0000000063 0000000060 Unallocated

04: 01 0000000064 0000020467 0000020404 Apple_HFS

05: 02 0000020468 0000020479 0000000012 Apple_Free

 

Analysis Considerations

The only unique characteristic of Apple partitions is that there are several unused fields in the data structure that could be used to hide small amounts of data. Also data could be hidden in the sectors between the last partition data structure and the end of the space allocated to the partition map. As with any partitioning scheme, anything could be in the partitions that have an official looking name or that claim to have a given type.

Summary

The Apple partition map is a fairly simple structure and is easy to understand. The data structures are all located in one place, and the maximum number of partitions is based on how the disk was originally partitioned. The mmls tool allows us to easily identify where the partitions are located if we are using a non-Apple system, and the pdisk tool can be used on an OS X system.

Part I: Foundations

Digital Investigation Foundations

Computer Foundations

Hard Disk Data Acquisition

Part II: Volume Analysis

Volume Analysis

PC-based Partitions

Server-based Partitions

Multiple Disk Volumes

Part III: File System Analysis

File System Analysis

FAT Concepts and Analysis

FAT Data Structures

NTFS Concepts

NTFS Analysis

NTFS Data Structures

Ext2 and Ext3 Concepts and Analysis

Ext2 and Ext3 Data Structures

UFS1 and UFS2 Concepts and Analysis

UFS1 and UFS2 Data Structures

Summary

Bibliography

Bibliography

show all menu





File System Forensic Analysis
File System Forensic Analysis
ISBN: 0321268172
EAN: 2147483647
Year: 2006
Pages: 184
Authors: Brian Carrier
Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net