Quick guide setting up Debian with SATA RAID using grub2 (Squeeze, Lenny, etc)

本文转载于 http://wiki.debian.org/DebianInstaller/SataRaid

 

 

Quick guide setting up Debian with SATA RAID using grub2 (Squeeze, Lenny, etc)

 

This information has been added to serve as solution, where the old guide did not work. Please read the old information below to get an insight in what you are actually doing!

NOTE: This guide shows how to install Debian using SATA RAID (aka. fake/soft/software/firmware/driver-based/BIOS RAID and HostRAID) provided by your SATA disk controller. Not to confuse with Linux SATA RAID facilitated fully by kernel drivers! Linux SATA RAID is the preferable and more reliable way to setup SATA RAID. Use the following method only if you want to have a dual-boot system with Debian and the other OS on the same SATA RAID.

1. Run installer with dmraid:
1.1 boot cd/usb, SELECT (expert) install
1.2 press TAB
1.3 add 'dmraid=true' (without quotes)

2. Install the system on RAID partition

3. When GRUB fails, choose 'continue without bootloader' and reboot

4. Boot from installation media, go to option rescue, press TAB, add option 'dmraid=true'

5. Go through the process, when it asks you to select root partition, choose the partition on which you just installed debian

6. You are now in a shell on the installed system. Execute:
grub-install /dev/dm
grub-mkconfig > /boot/grub/grub.cfg

7. Reboot and enjoy

Also see the "User comments" section bellow!

Setting up Debian on a Serial ATA RAID device

 

This page explains how to use Debian Installer to set up Debian on a Serial ATA (SATA) RAID disk (using dmraid).

Note that support for SATA RAID is experimental and is only available in the Lenny version of the installer.

SATA RAID support has been significantly improved after the Lenny Beta 2 release, especially with regard to partitioning. Users are therefore strongly advised to use either daily built images or Lenny Release Candidate (RC) images.

SATA RAID is only supported for the architectures i386 and amd64.

There have not yet been any tests installing Debian alongside an existing Windows installation. We expect that that is possible, but there is a risk that the Windows partition will become corrupted.

/!\ It is strongly recommended that you make a backup of any data on your system that you do not wish to lose before using this option.

SATA RAID or Software RAID

 

The RAID support offered by most Serial ATA disk controllers is not hardware RAID. Instead it can best be classified as "software RAID provided by the BIOS of the controller".

Various terms are used to refer to this type of RAID support: SATA RAID, BIOS RAID, fake RAID, software RAID. We have decided to use the term SATA RAID. We prefer to reserve the term "software RAID" to refer to the RAID support in the Linux kernel.

The general consensus is that using Linux software RAID is to be preferred over using this relatively cheap, and because of that possibly less reliable, software RAID offered by SATA disk controllers.

However, if your system already has another operating system installed on a SATA RAID disk and you want to install Debian alongside that, using dmraid is basically your only option.

In all other cases we strongly suggest that you use Linux software RAID (using the mdadm package), which is also much better supported by the installer.

Of course, if your system has a SATA-based RAID controller that does offer real hardware RAID, you should just completely ignore the information on this page.

Other resources

 

Translations

 

Translations for this page are available in:

Booting the installer

 

Because the support for SATA RAID is still experimental, you will need to boot the installer with a special boot parameter 'dmraid=true'.

This parameter can be added by first pressing the <TAB> key at the desired option in syslinux menu and then entering the option.

Hardware detection

 

When the boot parameter is passed, the SATA RAID disk should be automatically detected and if it is detected, some additional installer components will be loaded.

If it's not detected, please file an installation report! The syslog can be checked for possible causes of a failure to detect the hardware.

Partitioning

 

Starting with the Lenny RC1 release partitioning of SATA RAID disks is completely supported. The RAID disk can be partitioned just like a normal hard disk, including the use of "guided partitioning", LVM and encryption.

See the installation guide for further details.

Boot loader installation

 

SATA RAID devices are currently not really supported by either grub or lilo, basically because its not possible to probe the BIOS for the device. But it is possible to install grub using a semi-manual method. This method has been implemented in grub-installer.

/!\ Only grub ("grub legacy") is supported, not grub-pc ("grub2").

Using lilo is currently not supported, but it may be possible to set up lilo manually if you prefer.

The installer will automatically detect if /boot is on a dmraid device and will then install grub in the master boot record (MBR) of that device. No other options will be offered.
As the current installation procedure assumes that the SATA RAID device is (hd0), the SATA RAID disk should be listed as the first hard disk in the boot order in your BIOS configuration.

In case of problems, please check the log file /var/log/grub-dmraid.log.

The os-prober component should detect the presence of other operating systems such as Microsoft Windows on the SATA RAID device, but the bootloader may not be correctly configured to boot those. It should be possible to make other operating systems boot correctly with minor changes in the GRUB configuration.

Installing GRUB manually

 

The installer basically runs 'grub' and executes some commands in the GRUB command interface. This example gives an impression of the commands executed by the installer (values between '<>' should be changed according to your situation):

# grub  --device-map=/dev/null
grub> device (hd0,<1>) /dev/mapper/<isw_dhiiedgihc_Volume02>
grub> device (hd0) /dev/mapper/<isw_dhiiedgihc_Volume0>
grub> root (hd0,<1>)
grub> setup (hd0)
grub> quit

 

You can of course perform this procedure manually if you want to change your GRUB installation, or if you need a different setup than the installer currently offers. See Gerte's page for details.

Remember that the GRUB partition number is one less than the actual partition number as GRUB numbers partitions starting at zero.

Testing Serial ATA RAID installations

 

It is possible to test SATA RAID installations in an emulator like qemu or VirtualBox. The reason this works is because dmraid does not actually interact with the BIOS when it detects a SATA RAID array, but just reads the header information on the hard disks.

So all that is needed to test a SATA RAID installation in an emulator are images of disks set up as a fake RAID. Such disk images are available on alioth for both qemu and VirtualBox. The images are set up for RAID1 in 'Silicon Image Medley' format with a disk size of 80GB (the image files are compacted and thus much smaller!); the partition table is empty.

If all goes well the system should even boot correctly into the installed system.

Creating your own disk image files

 

If you feel 80GB images are too large, you can create your own ISW (Intel) array with dmraid >= 1.0.0.rc15 (currently in unstable).

  1. Boot with Debian live or with a rescue image
  2. Install dmraid from unstable
  3. Build an Intel ISW array.

# create an ISW volume (raid1) with a name of "Test1" on two disks.
$ dmraid -f isw -C Test1 --type 1 --disk "/dev/sda /dev/sdb"

 

Otherwise you can also create your own using the hpa.dat file, which contains the fakeraid metadata ('Highpoint HPT45X'; RAID1).

1. Determine what size you want your fakeraid disk to be. For a 6GB disk you will need the following numbers:

  • disk size = 6 * 1024 * 1024 * 1024 = 6.442.450.944
  • nr. of sectors = disk size / 512 = 12.582.912; this is 0xC00000 in hexadecimal
  • offset for fakeraid metadata = nr. of secors - 11 = 12.582.901

2. Use a hex editor to change the disk size (total number of sectors) in the hpa.dat file. The disk size is coded in 3 bytes starting at offset 12 of the file. Note that the notation is little endian, so the bytes are in reverse order. The current value in the file is 000080, which corresponds to 0x800000 (for 4GB, 8.388.608 sectors). For this example 000080 needs to be changed to 0000C0.

3. Create a raw disk image file

# Create a sparse disk image file with nr. of sectors as size
$ dd if=/dev/null of=dmraid_hpa.raw seek=12582912
# Copy the metadata sector into the disk image file
$ dd if=hpa.dat of=dmraid_hpa.raw conv=notrunc seek=12582901

 

From the raw image file the (compressed) disk images for qemu or VirtualBox (or for vmware) can be created.

4a. Create disk images for VirtualBox

# Create the full size (!) vbox disk image files
$ VBoxManage convertdd dmraid_hpa.raw dmraid_hpa-1.vdi
$ VBoxManage convertdd dmraid_hpa.raw dmraid_hpa-2.vdi
# Compact the disk image files (requires full path to image)
$ VBoxManage modifyvdi $(pwd)/dmraid_hpa-1.vdi compact
$ VBoxManage modifyvdi $(pwd)/dmraid_hpa-2.vdi compact

 

4b. Create disk images for qemu

$ qemu-img convert -f raw -O qcow2 dmraid_hpa.raw dmraid_hpa-1.qcow2
$ qemu-img convert -f raw -O qcow2 dmraid_hpa.raw dmraid_hpa-2.qcow2

 

User comments

 

If you have tried the SATA RAID support in the installer, you are welcome to list your experiences below.

/!\ /!\ If you find any bugs, then please also file an installation report.


 

(2012-01-28) Successfully installed a Squezee dual-boot system with Intel SATA disk controller (ISW) using the quick quide at the very beginning. The only deviation was in step 6: instead of
grub-install /dev/dm
command I used
grub-install /dev/mapper/isw_<some_character_sequence>_Volume0
Supposedly the exact path of the RAID partition on you system depends on the SATA disk controller you are using. Though it should begin with /dev/mapper/.


 

Tried today (2010-10-14) to install onto RAID0 volume on Dell T3500 workstation from USB stick prepared as described in 'http://kitenet.net/~joey/blog/entry/Debian_USB_install_from_hybrid_iso/'. After first unsuccessful partitioning attempt, figured out that 'dmraid=true' is required. OK, another attempt was more-or-less smooth until grub installation step. Despite the fact that 'grub-legacy' is mentioned above, the installer tried to use 'grub-pc' which failed to find the RAID0 volume. Then I tried manually lilo, grub-legacy, and grub-pc, followed the suggested grub installation procedure, but with no luck. (May be just mistyped or misunderstood something). Ended up with software RAID eventually.


 

  • What is the situation regarding PATA fakeraid cards? are they supported by this same system and if so why did you reffer to it as SATA raid support? -- plugwash
    • Just found that "'PATA"' support for raid chips such as the "promise 378" one is not compiled in the supplied kernel. -- nunix
      • Are there any? If there are, that would be a good reason to reconsider referring to this as "ATA RAID" instead. -- fjp
        • I was under the impression that almost all IDE raid cards were fakeraids. I don't know if any of them are supported by dmraid though. -- plugwash
          • The Intel Server Boards SCB2 and SE7501WV2 with Promise PATA Controller are supported by dmraid. -- drf
  • Trying to install on a fakeraid with raid level 5 hits bug 411172

    • Possible solutions :
    • Use the unofficial dm-raid45 install .iso and instructions from http://ctu.iuculano.it/dm-raid45/

    • wait for/hand-patch dmraid-45 code in the kernel and install kernel
    • wait for/hand-patch mdadm 3.0 (Intel RAID metadata support only)
    • wait for/hand-patch dm2md code
  • Instead of using the boot parameter 'dmraid=true', one can run the install process normally right before the moment when the system disks are detected.

    • Then switch to a virtual console with a shell (e.g. vc/2) and activate it.
      # modprobe dm-mod
      # udpkg -i /cdrom/pool/main/d/dmraid/dmraid-udeb.*.udeb
      # dmraid -ay
      Afterwards, let the installer detect your disks - you should now see a raid instead of multiple physical disks.

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值