Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Thursday, September 23, 2010

Device Mapper RAID howto

There is software RAID, driven/configured by BIOS. You may rethink your Windows & Linux configuration. You have two disks, why not use Windows for one of them and install Linux to the other one?
You can still use Linux software RAID if you want to, just not dmraid which is similar to Windows software RAID and cannot use partitions instead of drives.
  • software RAID using the Linux Multiple Devices driver
  • software RAID using the Device Mapper driver
  • hardware RAID.
If there's no way to turn off RAID then you have to force dmraid, see boot options. There used to be dodmraid option.
To see which SATA drives are seen by the kernel.
cat /proc/scsi/scsi 
it will show up as a module under lsmod
 
(link) Nvidia NForce3 Go120, Go150, 150, 250, 250Gb, and 150 Pro (SATA-I); NForce 4 MCP, SLI, Ultra (SATA-II); and NForce Pro 2200 MCP and 2050 (SATA-II) chips — fakeraid. This motherboard chipset family uses yet another type of fakeraid called nvRAID. libata driver "sata_nv" added as of 2004-07-08 development code, included in kernel 2.6.8, and now production quality. As of 2006-01-25, Nvidia provided provided information (under NDA) that will permit implementation of NCQ support. Note: Nvidia's proprietary Linux i386 binary driver bundles for its chipsets seem to rely on (and in some cases furnish) Garzik's "sata_nv" driver — presumably adding to that Nvidia's own subdriver to support nvRAID disk formatting.
However, as usual, you're probably better off using Linux's own open-source "md" [multiple devices] software-RAID driver for the RAID functionality.
Source
Activate your raid.
dmraid -ay -v
You will see then the existing RAID partitions in /dev/mapper/

dmraid -r
/dev/sdc: nvidia, "nvidia_gcceabdf", mirror, ok, 488397166 sectors, data@ 0
/dev/sdb: nvidia, "nvidia_gcceabdf", mirror, ok, 488397166 sectors, data@ 0
  Ubuntu with the 2.6.8 kernel that ships with warty final already has the device mapper base code!
If you want to use raid-1,5 or append, you will need to apply some kernel patches and build a new kernel.
Apply these patches to your kernel source using something like:
cd /usr/src/linux
sudo cat /*.patch > patch -p1
Then build your kernel following the instructions in the wiki link above.
 

  Install the device mapper userspace. This is located at ftp://sources.redhat.com/pub/dm/
Untar this somewhere and go into the directory tar creates.
then run
./configure
make

sudo make install

  Download the dmraid software
http://people.redhat.com/~heinzm/sw/dmraid/src/dmraid-current.tar.bz2
Untar it, and again go into the directory it creates.
./configure
sudo make install
Almost done!
  Now everything is installed. You just need to make dmraid load on startup and set up the drive mounting.
I didnt make mine load on startup, as i do not need to access my raid drives all that often. So i made a little script to mount them when i need them in my home directory.
Heres how:
You need to find your device name.
ls /dev/mapper/
There will be a few entries that look long and confusing. They are actually just the partitions of your raid drives, prefixed with a complex name. mine looks like
sil_0309402025011
sil_0309402025011_p1
sil_0309402025011_p5
you need to note these down.
make a new file called activateraid in your home directory.
Put this code in it :
dmraid -ay -v
mount -t -o users,owner,ro,umask=000 /dev/mapper/ /
and add another line for every partition you have.
Save the file.
chmod 700 activateraid  Now test it! run
./activateraid and all your drives should mount! 

[ubuntu] dmraid causes other non-raid disk to disappear

Installing GRUB
Boot-partition-is-first Method
This method of installing GRUB will work 99% of the time when your /boot partition is the first partition on the disk. If you have /boot on a partition other than the first, or if this method fails, proceed to Method 2. Do not run grub-install! It will not work properly, and will probably detect the sda1, etc. instead of your actual raid. Make also sure not to start grub inside of an chroot enviroment like you propably do if you install from the Gentoo LiveCD and do it like described in the installation manual of gentoo.org. It doesn't know about /dev/mapper so you would get some errors with grub. In this case just jump into another terminal with ALT+F2. Start grub and make sure that it's pointing to /dev/null as a device map.

  • note* grub is not on the gentoo-am64 live cd, so ALT+F2'ing to another shell will NOT solve your problem of using GRUB outside of a chrooted enviroment. (grub is located at /mnt/gentoo/sbin/grub)
grub
--device-map=/dev/null
Now that you're inside of the grub environment, set up your raid devices and install grub!
grub> device
(hd0,0) /dev/mapper/nvidia_abiccada1
grub> device (hd0) /dev/mapper/nvidia_abiccada
grub> root (hd0,0)
Filesystem is ext2fs, partition type 0x83
grub> setup
(hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"...succeeded
Done.
grub> quit
Use kpartx to map the drive to a partition. I ran into this problem myself using ISW. In /dev/mapper there's the RAID array but no partition to mount, after running kpartx it's there.
kpartx -a /dev/mapper/isw_cidjcaibaf_Images
I added this to /etc/rc.local, along with 'dmraid -ay' and 'mount -a' with the RAID array in my /etc/fstab to ensure it mounted.
I created my RAID array with the ISW built into the BIOS of my motherboard, and created the array using gparted, for the record.
Source
Use kpartx to map the drive to a partition. I ran into this problem myself using ISW. In /dev/mapper there's the RAID array but no partition to mount, after running kpartx it's there.
kpartx -a /dev/mapper/isw_cidjcaibaf_Images
I added this to /etc/rc.local, along with 'dmraid -ay' and 'mount -a' with the RAID array in my /etc/fstab to ensure it mounted.
I created my RAID array with the ISW built into the BIOS of my motherboard, and created the array using gparted, for the record.

Kubuntu recognizing Raid 1
nVidia (nForce) Raid, sata, dmraid, HEADACHE(S)!!!
dmraid - device-mapper RAID tool | LinuxInsight
Linux SATA RAID FAQ
linuxmafia.com/faq/Hardware/sata
[ubuntu] How to get dmraid to rebuild with a new disk?

No comments: