xboxscene.org forums

Author Topic: Parsing Of Xbpartitioner Style Partition Table From Linux  (Read 532 times)

ldotsfan

  • Archived User
  • Hero Member
  • *
  • Posts: 2072
Parsing Of Xbpartitioner Style Partition Table From Linux
« on: July 03, 2010, 09:09:00 PM »

Here's the command to read the ozpaul_b styled partition table's partition start offsets and sizes and convert to decimal for purpose of disk cloning in xbox linux using shell script and commandline.

In my example, I started from partition 5. For extended partitions, you should start from 6.

CODE

dd if=/dev/hda bs=512 count=1 2> /dev/null | hexdump | grep "0000 8000" | awk '{ if (NR > 4) print $5 $4" "$7 $6; }' | while read PSTART PEND; do echo $((0x$PSTART))" "$((0x$PEND)); done


Notes:
1. Read the first sector.
2. 00008000 is the active partition in use magic value in hex.
3. Use bash 0x to convert hex to decimal.

Cloning example:
CODE

dd if=/dev/hda bs=512 count=1 2> /dev/null | hexdump | grep "0000 8000" | awk '{ if (NR > 4) print $5 $4" "$7 $6; }' | while read PSTART PEND; do /usr/bin/pv /dev/hda | dd of=/dev/null bs=512 seek=$((0x$PSTART)) count=$((0x$PEND)); done
 750MB 0:00:25 [29.5MB/s] [>                                  ]  0%
19.1GB 0:10:42 [30.5MB/s] [=>                                 ]  6% ETA 2:35:51


I used Pipe Viewer to provide progress status of dd.
Logged