Question: Why is the partition table I see for the disk image different from that stated in the handout?
Answer: The partition table listed in the handout does not include an entry for the second extended partition contained in the disk image. An extended partition looks like a linked list. In each extended boot record (EBR), its first entry describes an information about a current partition and the second entry describes a way to find the next extended partition if available.
Complete partition table for disk image provided
Partition # | Type | Start | Length |
---|---|---|---|
1 | 0x83 (ext2) | 63 | 48132 |
2 | 0x0 (unused) | 0 | 0 |
3 | 0x83 (ext2) | 48195 | 48195 |
4 | 0x5 (extended) | 96390 | 64260 |
5 | 0x82 (swap) | 96453 | 16002 |
- | 0x5 (extended) | 112455 | 48195 |
6 | 0x83 (ext2) | 112518 | 48132 |
Question: How to assign a partition number?
Answer: To make sure the assignment consistent with our grader tool, all primary partitions in the master boot record are numbered 1-4 whether it is empty or extended. Then, all logical partitions are numbered starting from 5 and all non-primary extended partitions are excluded.
Question: Where can I find more information about MBR, EBR, EXT2?
Answer: I recommend you to take a look at the following pages: http://en.wikipedia.org/wiki/Master_boot_record, http://en.wikipedia.org/wiki/Extended_boot_record, http://www.nongnu.org/ext2-doc/ext2.html.
Question: How to mount disk image as a normal partition under Linux?
Answer:
If you want to use disk image for debugging, you can do the following steps:
1. extract target partition from the disk image: Take the disk image we provided as an example. In part1, you can find out the starting sector of partition 2 and number of sectors it has. Then extract this partition using the following command:
dd if=disk of=hda.img bs=512 skip=[starting sector] count=[#sectors]
2. Mount the extracted image in a directory (e.g. /mnt/test/)
mount -o loop hda.img /mnt/test/
Then you can access /mnt/test as a normal partition in Linux.