» WIT: Wiimms ISO Tools » Guides » Scrubbing of Wii ISO images

# Scrubbing of Wii ISO images

## 1. Introduction

Scrubbing is a method to remove unneeded data from Wii ISO discs and replace the data with a constant byte value like 0xff or 0x00. This constant value is a good object for compressing (7zip, zip, rar, ...). The WIT tools use the constant 0x00 to support sparse files. The WIT file format WIA is able to compress scrubbed files efficiently using BZIP2 or LZMA compressing algorithms.

All Wii discs are divided into 2 parts. The first 320 KiB are reserved for the disc header (game info, region info, partition tables and more). The WIT tools copy always the whole disc header. The area beginning at offset 0x50000 is reserved for Wii partitions. Data partitions starts usualy at offset 0xf80000 and have mostly a size of about 4GB. The files of the file system (FST) are placed at the end of this 4 GB (outer circles of the DVD) to allow the fastet DVD access. Therefor a data partition has a hole (unused area) at the beginning behind the system files.

There are three scrubbing methods, which can be used alone or in combination:

1. Space in the partition area (starts at offset 0x50000), that is not claimed by any partition, does not held any information. The first scrubbing method is to ignore these non claimed areas. Nearly all tools ignoring these areas if not copying in raw mode.

   For WIT tools this scrubbing method is enabled by default. To disable it (together with all other methods) use the option --raw.

2. The data on Wii discs is divided into partitions. Typical partitions are DATA, UDATE and CHANNEL. For playing a game only the DATA partition is needed. The second scrubbing method is to remove unwanted partitions. If a partition is removed the partition tables must be rewritten.

   For WIT tools this method is disabled by default. To enable it use the option »--psel data«.

3. The third method is to look inside the file system of the partition, find unused sectors and fill them with 0x00 or ignore them while copying the disc.

   For WIT tools this method is enabled by default. To disable it use the option »--psel whole«.

The option »--psel keyword_list« controls the scrubbing method. The option --raw is a shortcut for »--psel raw«.

### 1.1 Sparse files

If a file contains unused blocks, modern file systems like ext2-4 or NTFS can store this files efficiently by managing these unused blocks instead of allocating disc space. For some Wii discs this can save much disk space. But when copying such sparse file with a standard copy programm without special option (like cp --sparse=all ...) the sparse effect is lost.

All WIT tools creates sparse files automatically when writing a new file. The WDF file format is a better solution because it handles such holes directly and independent of any file system.

Read Wiki: Sparse file for more sparse file details.

## 2. --psel list

This option set the scrubbing mode and defines, which disc partitions are handled. It expects a comma separated list of keywords, numbers and names; all together called parameter. All parameters are case insensitive and non ambiguous abbreviations of keywords are allowed. Each parameter becomes a rule and each rule is appended to a rule list. Rules prefixed by a minus sign are DENY rules. Rules prefixed by a plus sign or without a prefix are ALLOW rules. Each partition is compared with each rule until a rule matches the partition. If a match it found, the partition is enabled for a ALLOW rule or disabled for a DENY rule. The allowed keywords are: DATA, UPDATE, CHANNEL, PTAB0 .. PTAB3, ID, ALL, WHOLE and RAW. The following input formats are accepted too: ptype, #index, #<index, #<=index, #>index, #>=index and #tab_index.part_index.
This options expects a comma separated list of keywords, numbers and names; all together called parameter. All parameters are case insensitive and non ambiguous abbreviations of keyword are allowed.

Each parameter becomes a rule and each rule is appended to a rule list. Rules prefixed by a minus sign ('-') are DENY rules. Rules prefixed by a plus sign ('+') or without a prefix are ALLOW rules. Each partition is compared with each rule until a rule matches the partition. If a match it found, the partition is enabled for a ALLOW rule or disabled for a DENY rule.

If no rule matches the partition, than the default rule was used. Is the last rule an ALLOW rule, then the default rule is DENY ALL. Is the last rule a DENY rule, then the default rule is ALLOW ALL.

The command »wit test --psel list« will print many options together with the partiton selector rule list.

### 2.1 Keywords

The following table explains all allowed keywords:

Keywords
Parameter | Description
--- | ---
DATA | GAME | Allow (-DATA: deny) partition type 0.
UPDATE INSTALLER | Allow (-UPDATE: deny) partition type 1.
CHANNEL | Allow (-CHANNEL: deny) partition type 2.
PTAB0 | T0 | Allow (-PTAB0: deny) all partitions of partition table 0, which is the standard partition table.
PTAB1 | T1 | Allow (-PTAB1: deny) all partitions of partition table 1. Only Super Smash Bros. Brawl uses this table for the VC channel partitions.
PTAB2 | T2 | Allow (-PTAB2: deny) all partitions of partition table 2. No known disc uses this partition table.
PTAB3 | T3 | Allow (-PTAB3: deny) all partitions of partition table 3. No known disc uses this partition table.
ID | Allow (-ID: deny) the class of ID partition types. ID partitions can be interpreted as a string with 4 alpha numeric characters. Such partitions types are only seen on the Super Smash Bros. Brawl disc.
ALL | Allow (-ALL: deny) all partitions.
WHOLE | This is a special flag: Don't analyse the partition filesystems to find unused sectors. Use the whole partition instead. This flags disables the third scrubbing method. The keyword WHOLE is ignored for overlayed partitions.
RAW | 1:1 | Ignore all other settings and copy the whole disc. This disables scrubbing at all.

### 2.2 Input Formats

Not only keywords are allowed. If a keyword is not found then the parameter is scanned for the following formats:

Input Formats
Parameter | Description
--- | ---
number | Allow (-number: deny) all partitions with the partition type =number.
id4 | id4 is a sequence of exact 4 alphanumeric characters. Letters are converted to upper case. Allow (-id4: deny) all partitions with the partition type =id4.
#number | Allow (-#number: deny) the partition with index =number. The very first partition has index #0.
#<number #<=number | Allow (-#<number: deny) all partitions with an index <number or <=number. The very first partition has index #0.
#>number #>=number | Allow (-#>number: deny) all partition with an index >number or >=number. The very first partition has index #0.
#num1.num2 | Allow (-#num1.num2: deny) the partition in partition table =num1 with partition index =num2. The very first partition table and the first partition in each table have index #0.

Hint: In most shells the characters '<', '>' and '#' must be escaped, because the shell interprete them as special characters.

### Command reference

»wit convert«, »wit copy«, »wit diff«, »wit dump«, »wit edit«, »wit extract«, »wit fdiff«, »wit files«, »wit files-l«, »wit files-ll«, »wit isosize«, »wit skeleton«, »wit verify«, »wwt add«, »wwt extract«, »wwt new«, »wwt scrub«, »wwt skeleton«, »wwt sync«, »wwt update«, »wwt verify«.

## 3. --raw

Abbreviation of »--psel RAW«.

### Command reference

»wit convert«, »wit copy«, »wit diff«, »wit dump«, »wit edit«, »wit extract«, »wit fdiff«, »wit files«, »wit files-l«, »wit files-ll«, »wit isosize«, »wit skeleton«, »wit verify«, »wwt add«, »wwt extract«, »wwt new«, »wwt scrub«, »wwt skeleton«, »wwt sync«, »wwt update«, »wwt verify«.

## 4. Examples

Without using one of the options --psel or --raw all partitions are copied and scrubbed.

- --psel data
  Copy only the DATA partition.
- --psel -update
  Copy all partitions but not the UPDATE partition.
- --psel -update,ptab0
  Copy all partitions of partition table #0, but not the UPDATE partition.
- --psel data,chan
  Copy only the DATA and CHANNEL partitions (if available).
- --psel abcd
  Copy only the partition named 'ABCD'.
- --psel ptab0
  Copy only partitions of partition table 0.
- --psel '#<2'
  Copy only the first two partitions.
- --psel +#1.0
  Copy only the first partition of partition table #1.
- --psel raw
  Copy the whole disc and do not scrub anything.