Managing RAID on Linux - Derek Vadala [48]
Some GUI partitioning utilities might not allow you to set a drive to this nonstandard type. If, for some reason, you are unable to make these changes using GUI partitioning software, I recommend downloading the current version of fdisk and following the examples below. The latest version of fdisk will support the Linux Raid Auto partition type. (Older versions may not have this option.) You must create partitions on each drive that you plan to use in your array. If you don't want the kernel to automatically start arrays, you can use an unpartitioned block device instead, such as /dev/sda or /dev/hda, instead of /dev/sda1 or /dev/hda1.
Partitioning for autodetection
The example that follows creates a single partition (/dev/sdb1) on the second SCSI drive (/dev/sdb) and marks it as an automatically detectable RAID partition:
# fdisk /dev/sdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1116, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-1116, default 1116): 1116
Change the drive type of /dev/sdb1 to Linux Raid Auto (0xFD) so it can be detected automatically at boot time:
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)
When the partitions that are part of an array are all set to Linux Raid Auto, the kernel will automatically start that array when the system boots. Autodetection works only with MS-DOS style partition tables. So if you're using Sun, Amiga, or another architecture that has its own partition type, you will have to start arrays manually or use system initialization scripts. The kernel starts arrays before rc scripts run. So if you need to defer array startup until after you have performed other functions, then it's important to not set the type to Linux Raid Auto.
Partitioning without autodetection
If you don't want to use autodetection, but still plan to partition your disks, set partitions to type Linux (0x83). This is the default partition type, but to be certain the proper type is assigned, set the type manually:
# fdisk /dev/sdb
Command (m for help): tPartition number (1-4): 1
Hex code (type L to list codes): 83
Changed system type of partition 1 to 83 (Linux)
Write the new partition table to the disk and exit fdisk.
Command (m for help): w
The partition table has been altered!
Calling ioctl( ) to re-read partition table.
Syncing disks.
You should follow the process shown here to create partitions on each disk you plan to use in an array. If you create a new partition on a disk that is in use (that is, a disk that contains a mounted partition), fdisk will complain. You must then restart your system before using the new partition. In the following example, /dev/sda contains mounted partitions, but /dev/sda13 is currently set to type Linux (0x83) instead of Linux Raid Auto (0xFD):
# fdisk /dev/sda13
Command (m for help): t
Partition number (1-13): 13
Hex code (type L to list codes): fd
Changed system type of partition 13 to fd (Linux raid autodetect)
Command (m for help): w
The partition table has been altered!
Calling ioctl( ) to re-read partition table.
Re-read table failed with error 16: Device or resource busy.
Reboot your system to ensure the partition table is updated.
* * *
Important Rules for Partitioning
Here are some points to remember when you are partitioning.
If you don't require autodetection and plan to use whole disks as array members, you