Partition Types

From Linux Raid Wiki
(Difference between revisions)
Jump to: navigation, search
(What Partition Type: forgot a link)
(What Partition Type: booting ubuntu doesn't start your raid devices. hotplugging after installing mdadm does.)
Line 27: Line 27:
 
(From the mdadm 2.6.8 man-page) When creating partition-based arrays using mdadm and version-1.x superblocks, the partition type should be set to 0xDA (non fs-data). This type selection allows for greater precision since using any other type [RAID auto-detect (0xFD) or a GNU/Linux partition (0x83)], might create problems in the event of array recovery through a live cdrom.
 
(From the mdadm 2.6.8 man-page) When creating partition-based arrays using mdadm and version-1.x superblocks, the partition type should be set to 0xDA (non fs-data). This type selection allows for greater precision since using any other type [RAID auto-detect (0xFD) or a GNU/Linux partition (0x83)], might create problems in the event of array recovery through a live cdrom.
  
Autodetection was useful before booting an initrd to load kernel modules and set up the real root FS was standard practice.  It allowed booting a kernel with root=/dev/md0 with no initrd.  A RAID-root system these days will handle it by including mdadm with a config file, and all needed kernel modules, in the initrd.  All major distros have used initrd booting for years.
+
Autodetection was useful before booting an initrd to load kernel modules and set up the real root FS was standard practice.  It allowed booting a kernel with root=/dev/md0 with no initrd (with md compiled into the kernel, not as a module).  A RAID-root system these days will handle it by adding all needed things to the initrd (kernel modules, mdadm, and config file).  All major distros have used initrd booting for years.
  
 
For GPT partition tables, the author of gdisk made up some 4-digit partition type codes so users wouldn't have to type the full GPT UUID partition type IDs.  They are similar to the MBR-equivalent numbers, but that's only for ease-of-use.  The on-disk format stores a 16-byte UUID.  Use gdisk's 0xFD00 partition type for RAID partitions on GPT.  gdisk doesn't have a 0xDA00 partition type, as the author wasn't aware of the reasons for 0xFD being deprecated on MBR.  Linux handles the GPT 0xFD00 type the same way as MBR 0xFD, auto-starting arrays.  (checked with Linux 3.16, using <code>partx -u /dev/sdc</code> to re-read the partition table.)
 
For GPT partition tables, the author of gdisk made up some 4-digit partition type codes so users wouldn't have to type the full GPT UUID partition type IDs.  They are similar to the MBR-equivalent numbers, but that's only for ease-of-use.  The on-disk format stores a 16-byte UUID.  Use gdisk's 0xFD00 partition type for RAID partitions on GPT.  gdisk doesn't have a 0xDA00 partition type, as the author wasn't aware of the reasons for 0xFD being deprecated on MBR.  Linux handles the GPT 0xFD00 type the same way as MBR 0xFD, auto-starting arrays.  (checked with Linux 3.16, using <code>partx -u /dev/sdc</code> to re-read the partition table.)
  
(TODO: the auto-starting might have been the result of udev scripts, not kernel behaviour.  See /lib/udev/rules.d/63-md-raid-arrays.rules and /lib/udev/rules.d/64-md-raid-assembly.rules, shipped with mdadm (on Ubuntu 14.10, and probably other distros).)
+
TODO: the auto-starting might have been the result of udev scripts, not kernel behaviour.  See /lib/udev/rules.d/63-md-raid-arrays.rules and /lib/udev/rules.d/64-md-raid-assembly.rules, shipped with mdadm (on Ubuntu 14.10, and probably other distros).
 +
 
 +
However, Ubuntu's live boot image doesn't include mdadm.  Booting won't start md devices on GPT FD00.  Neither will loading the raid10 module, or even installing mdadm.  Re-discovering partition tables (or physically hotplugging devices with md partitions) WILL cause them to be auto-started.
 +
 
  
 
This [https://bbs.archlinux.org/viewtopic.php?pid=1254839#p1254839 post from the gdisk author] explains the situation, and warns against tools that set up RAID partitions with the same type UUID as Windows uses for NTFS.  You're just asking to have your RAID partitions scribbled over with a fresh NTFS if you do that.  (similarly, 0x8300, the code for a Linux filesystem partition, is not recommended.)  If you want to set the type to something other than 0xFD00, make up an unused UUID.  Do NOT use <code>EBD0A0A2-B9E5-4433-87C0-68B6B72699C7</code> -- "Microsoft Basic Data".
 
This [https://bbs.archlinux.org/viewtopic.php?pid=1254839#p1254839 post from the gdisk author] explains the situation, and warns against tools that set up RAID partitions with the same type UUID as Windows uses for NTFS.  You're just asking to have your RAID partitions scribbled over with a fresh NTFS if you do that.  (similarly, 0x8300, the code for a Linux filesystem partition, is not recommended.)  If you want to set the type to something other than 0xFD00, make up an unused UUID.  Do NOT use <code>EBD0A0A2-B9E5-4433-87C0-68B6B72699C7</code> -- "Microsoft Basic Data".
Line 38: Line 41:
  
 
(TODO: investigate using 8301 (Linux reserved) for md array components.)
 
(TODO: investigate using 8301 (Linux reserved) for md array components.)
 
I give up.  Further research is required into what you need to do if you want to boot a live CD of a recent GNU/Linux distro (e.g. Ubuntu 14.10, (nov 2014)) without it automatically starting your MDs when you install mdadm.  Esp. if you're on GPT.  Possibly a custom mdadm config file.
 

Revision as of 04:38, 21 February 2015

Arrays are built on top of block devices; typically disks.

This leads to 2 frequent questions:

  • Should I use entire device or a partition?
  • What partition type?

There is no right answer - you can choose.

Entire Devices or Partitions

Your editor prefers to use partitions that are slightly smaller than a device. This allows:

  • the device has a partition table - no 'partition table not found'
  • replacement disks even of the same model are often slightly smaller and making the partition 100Mb smaller than the device allows some tolerance.
  • no performance impact

Neil, the md/mdadm author, uses whole disks.

What Partition Type

If you are using partitions then there 2 choices for MBR partition tables, and only one for GPT:

  • 0xDA for non-fs data
  • 0xFD for raid autodetect arrays
  • 0xFD00 on GPT
  • (there is no standard type for GPT that won't auto-start)

(From the mdadm 2.6.8 man-page) When creating partition-based arrays using mdadm and version-1.x superblocks, the partition type should be set to 0xDA (non fs-data). This type selection allows for greater precision since using any other type [RAID auto-detect (0xFD) or a GNU/Linux partition (0x83)], might create problems in the event of array recovery through a live cdrom.

Autodetection was useful before booting an initrd to load kernel modules and set up the real root FS was standard practice. It allowed booting a kernel with root=/dev/md0 with no initrd (with md compiled into the kernel, not as a module). A RAID-root system these days will handle it by adding all needed things to the initrd (kernel modules, mdadm, and config file). All major distros have used initrd booting for years.

For GPT partition tables, the author of gdisk made up some 4-digit partition type codes so users wouldn't have to type the full GPT UUID partition type IDs. They are similar to the MBR-equivalent numbers, but that's only for ease-of-use. The on-disk format stores a 16-byte UUID. Use gdisk's 0xFD00 partition type for RAID partitions on GPT. gdisk doesn't have a 0xDA00 partition type, as the author wasn't aware of the reasons for 0xFD being deprecated on MBR. Linux handles the GPT 0xFD00 type the same way as MBR 0xFD, auto-starting arrays. (checked with Linux 3.16, using partx -u /dev/sdc to re-read the partition table.)

TODO: the auto-starting might have been the result of udev scripts, not kernel behaviour. See /lib/udev/rules.d/63-md-raid-arrays.rules and /lib/udev/rules.d/64-md-raid-assembly.rules, shipped with mdadm (on Ubuntu 14.10, and probably other distros).

However, Ubuntu's live boot image doesn't include mdadm. Booting won't start md devices on GPT FD00. Neither will loading the raid10 module, or even installing mdadm. Re-discovering partition tables (or physically hotplugging devices with md partitions) WILL cause them to be auto-started.


This post from the gdisk author explains the situation, and warns against tools that set up RAID partitions with the same type UUID as Windows uses for NTFS. You're just asking to have your RAID partitions scribbled over with a fresh NTFS if you do that. (similarly, 0x8300, the code for a Linux filesystem partition, is not recommended.) If you want to set the type to something other than 0xFD00, make up an unused UUID. Do NOT use EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 -- "Microsoft Basic Data".

See wikipedia's GPT article for a list of existing standard partition GUIDs.

(TODO: investigate using 8301 (Linux reserved) for md array components.)

Personal tools