This will explain how to make a clean HD work with your xboxWhy did I do this?Mostly for fun

I wanted to learn about the layout of the xbox HD and fatx format, but realized that this could be usefull for making a working HD :
- for people who's HD stops working.
- for people who want to have second HD to put in their xbox. Yes, cloning the old one is most likely easier, but maybe people dont like hotswapping and are not comfortable with opening their xbox until they have build their new HD.
- for people who have messed it up so bad doing unsuccesfull exploits that rebuilding it is needed. Often people can restore their HD back to normal by using HDD Driver and removing their soft exploit, but lets face. HDD Driver is buggy. Some people don't even get it running. Others have reported that HDD Driver corrupted their files. Xlinux is another option for uninstalling exploits but sometimes the fatx-filesystem is simply corrupt.
- for people who "forgot" to make an image of their original drive before disaster struck.
Finally I simply find it cool that it is possible to make your xbox work even if the HD should stop working or gets corrupted one day. At least I know of a few people on this forum that will benefit from this...
Things needed :1) Your xbox eeprom, or the passwd for your current drive if you just want to rebuild this. Without a modchip the xbox HD need to be locked with a unique passwd when the xbox boots. If you build a new drive this passwd can be calculated using your xbox eeprom and a little proggy called liveinfo. You can get your eeprom from the backup option in Evox.
The first thing any softmodder should do when they run their very first game save hack is backup system files (C-drive), eeprom and hdd passwd2) A bootable fatx enabled linux with the mkfs.fatx utility - I recommend
Xebian3) Access to xbox system-files. Either from an old backup or from Slayers Evox CD.
4) Unlockx if you are building a new drive.
The xbox HD structureThe xbox HD doesn't have an actual partition table. The partition table is hardcoded in the xbox kernel. The linux driver for xbox fatx harddrives is build in a similar way assigning a given series of sectors to a given partition.
The xbox HD header is one block long and doesn't really contain much of interrest except the magic word 'BRFR' at offset 0x600. The linux kernel identifies a xbox HD by this magic word as well as the occurance of the string FATX in the beginning of the following blocks :
| CODE |
block partition 1 Game Cache X: 1501 Game Cache Y: 3001 Game Cache Z: 4501 System C: 5501 System E:
|
Connect your non-working xbox drive or blank HD
to the secondary master channel on your PC (i will assume this in the following). This should make the xbox drive /dev/hdc. You can verify when in linux by typing :
"Building" the partitions
We will "trick" the linux kernel into thinking we have an xbox drive. This is possible since we don't have to write an actual partition table. Create the header. First make a file 1 block long containing all zeros :
| CODE |
| dd if=/dev/zero of=header count=1 bs=512k |
Now open this file in a hexedit :
hexedit head
and go to offset 0x600. Write BRFR if in ASCII mode or 42 52 46 52 if in hex mode (you toggle modes with TAB). Save the file : CTRL+x
Now write this to the xbox drive. Note! Be sure by now that the xbox is /dev/hdc. If you write the header to another drive you will distroy this drives partition table.
| CODE |
| dd if=header of=/dev/hdc bs=512k |
Now we "build" the fatx partitions knowing where they are located on the drive :
| CODE |
echo "FATX" | dd of=/dev/hdc seek=1 bs=512k echo "FATX" | dd of=/dev/hdc seek=1501 bs=512k echo "FATX" | dd of=/dev/hdc seek=3001 bs=512k echo "FATX" | dd of=/dev/hdc seek=4501 bs=512k echo "FATX" | dd of=/dev/hdc seek=5501 bs=512k
|
Edit : It has been brought to my attention that Xebian sometimes has a screwed up keymapping. The "|" character is sometimes not available. As a quick fix you can remap "Shift+Space" to this character by doing :
| CODE |
xmodmap -e "keycode 65 = space bar"
|
Now you must reboot to let linux recognize the drive as fatx.
Formatting the drive
Once rebooted verify that linux has recognized the drive as fatx. The command : ls /dev/hdc* should produce :
/dev/hdc /dev/hdc50 /dev/hdc51 /dev/hdc52 /dev/hdc53 /dev/hdc54
Now format the fatx partitions :
| CODE |
mkfs.fatx /dev/hdc50 mkfs.fatx /dev/hdc51 mkfs.fatx /dev/hdc52 mkfs.fatx /dev/hdc53 mkfs.fatx /dev/hdc54 |
Copying files on the drive
Here you have a choice.
1) You could have your xbox system files on another harddrive attached to a different IDE channel in which case you can mount that drive (if first partition on primary master and if NTFS filesystem) :
| CODE |
mkdir /backupdrive mount -t ntfs /dev/hda1 /backupdrive |
2) You could have the system files in a second CD-drive or you could have packed the systemfiles
in a folder together witht the xebian iso before burning it. Mount that :
| CODE |
mount -t iso9660 /dev/cdrom /backupdrive |
Now you can mount the xbox E-drive and make the UDATA and TDATA folder. Don't know if that's needed?
| CODE |
mkdir /xbox mount -t fatx /dev/hdc50 /xbox mkdir /xbox/UDATA mkdir /xbox/TDATA umount /xbox |
Now rebuild the xbox C-drive :
| CODE |
mount -t fatx /dev/hdc51 /xbox cp -r /backupdrive/path_to_systemfiles/* /xbox umount /xbox
|
Edit : Before unmounting the C-drive it might be needed give all files on the C-drive the correct permissions (these could be wrong depending on how they were stored/backed-up). Do the following before the unmount command :
| CODE |
chmod -R 755 /xbox/*
|
Finishing up
All done. The rest is basic knowledge. Boot your PC to windows and use liveinfo and your xbox eeprom to generate the correct passwd for the drive. Reboot with a DOS floppy with unlockx to lock the drive. Reassemble your xbox and be happy!
Saving a broken C-drive
A much simpler version of this can be used to save a broken C-drive. Boot Xebian with your xbox drive on secondary master. Reformat the C-drive:
mkfs.fatx /dev/hdc51
mount the C-drive and restore system files like above.
Comments :
8/4-2004 :
I have built a small (9Mb) linux distro that has all the needed features (plus some extra stuff) to do this HD making. It includes a small program that will automate the process of building a working HD drive. It's currently being tested.