# SATA on Nforce2

## soccerplayer

Well, i am about to order a new serial ata drive for my computer but before i did, i was wondering how easy they are to set upi and how compatible they are for linux and the nforce2 chipset. i want to make the right choice on this and i dont want something that wont work flawlessly. thanks in advance

----------

## slartibardfast

serial ata works flawlessly for me, I use the libata driver which gives excellent performace and stability. I think there is a backport to 2.4.x somewhere but I prefer much prefer 2.6.x 

I use 2x maxtors in a software raid on and nf7-s, never given any trouble.

----------

## DarrenM

It's easy to setup. The individual drives on the SATA controller just show up as /dev/hde and /dev/hdg. a-d being for your ide controller drives.

I just upgraded from 2.6.2 to 2.6.5 kernel which has a Silicon Image driver in it which is what's on the NF7-S. My raid0 hdparm -t speed went from 58MB/s to 94MB/s and single drive speed went from 40MB/s to 65MB/s. That's with 36GB Raptors.

----------

## lifeform

hi slartibardfast,

i noticed in ur earlier msg that u managed to get ur rig up n running..

i have the similar abit nf7s mainboard and 2 identical harddisks..

don't seem to have a clue on how to proceed to enable a hardware raid0 on my rig.

wld b great to hear some pointers from u.

thanks!!

----------

## slartibardfast

Guess I'll start by describing my kernel (> 2.6), 

```
Device Drivers --->  

   ATA/ATAPI/MFM/RLL support  ---> 

       < > Silicon Image chipset support 
```

I Disable this because I can't get it to play nice on my nfs-7s 1.2, it appers to cause an IRQ storm! 

```
Device Drivers ---> 

    SCSI device support  ---> 

       <*> SCSI device support    

       <*> SCSI disk support    
```

```
Device Drivers ---> 

   SCSI device support  ---> 

      SCSI low-level drivers  --> 

        [*] Serial ATA (SATA) support

        <*>   Silicon Image SATA support
```

Now everything on your two SATA disks will be /dev/sda and /dev/sdb, and your preformance should be nicer! 

```
Device Drivers ---> 

   Multi-device support (RAID and LVM)  --->

     [*] Multiple devices driver support (RAID and LVM)

     <*>   RAID support

     <*>     RAID-0 (striping) mode 

     <*>     RAID-1 (mirroring) mode
```

Build the software raid into the kernel, so we won't have to worry about initrds,

I also build in XFS, and bascially everything not touched by hotplug

Now we can move on to the system 

```
emerge raidtools 

```

Now we need a disks partitioned in prepairation for md building, at this point my gentoo is ***backed up*** on my mp3 server, and I'm booted with a knoppix cd  :Very Happy: 

```
cfdisk /dev/sda

cfdisk /dev/sdb
```

Make the partitions identical, this is my configuration: 

e.g. 100mb /boot (RAID 1)  (

two 20GB /          (RAID 0) (Preformance)

two 20GB /home  (RAID 1) (Reliablity) 

two extended partitions for playing around with

In the extended partition make two swap partitions, I use two 1gb ones.

Now we need a /etc/raidtab file 

This is mine : 

```
       raiddev /dev/md0

           raid-level              1

           nr-raid-disks           2

           nr-spare-disks          0

           chunk-size              128

           device                  /dev/sda1

           raid-disk               0

           device                  /dev/sdb1

           raid-disk               1

       raiddev /dev/md1

           raid-level              0

           nr-raid-disks           2

           persistent-superblock   1

           chunk-size              128

           device                  /dev/sda2

           raid-disk               0

           device                  /dev/sdb2

           raid-disk               1

       raiddev /dev/md2

           raid-level              1

           nr-raid-disks           2

           nr-spare-disks          0

           chunk-size              128

           device                  /dev/sda3

           raid-disk               0

           device                  /dev/sdb3

           raid-disk               1
```

Now we need write the proper magic

```
mkraid /dev/md0 -f 

mkraid /dev/md1 -f 

mkraid /dev/md2 -f 
```

And format the disks, I prefer XFS

```
mkfs.xfs /dev/md0 -f 

mkfs.xfs /dev/md1 -f 

mkfs.xfs /dev/md2 -f 
```

Finally I'd scp back my system, edit the /etc/fstab to reflect your shiney new raid and your two *seperate* swap partitions(No need to raid 'em), and run grub twice as per normal once for both disks. In actual fact we'll be booting from the just first one, and if required the second, but changes will be reflected on both disks, which is nice.

You might want to read up on recovery, but I've never had any real trouble. 

Best of luck! Hope this isn't to long winded   :Laughing: , just want you to get this quick it's really worth it!!!

Edit:  Nicer fomatting I hope  :Smile: 

----------

## lifeform

hi! thanks for the prompt reply.

guess i was too anxious n jumped the gun...

tis what i did.

i made my raidtab:

raiddev /dev/md0

           raid-level              0

           nr-raid-disks           2

           persistent-superblock   0

           chunk-size              32

           device                  /dev/hde

           raid-disk               0

           device                  /dev/hdg

           raid-disk               1

i have my 2 sata drives on /dev/hde and /dev/hdg

i then went on to mkreiserfs /dev/md0

next i mounted /dev/md0 and transferred some data files over..

everything seemed to be working fine..

i went on with other stuff.. and somehow, my system hung up due to some i/o error from my cdrom drive..

didnt manage to do a clean reboot and i think i messed up my stuff there.

i rebooted only to find that i could no longer mount my /dev/md0!

the error i get is:

mount: /dev/md0: can't read superblock

and when i tried fsck.reiserfs --rebuild-sb /dev/md0,

i got

bread: Cannot read the block (2): (Invalid argument).

reiserfs_open: bread failed reading block 2

bread: Cannot read the block (16): (Invalid argument).

reiserfs_open: bread failed reading block 16

i dunno what's my block size.

is there a way to check this out?

i have quite a lot of stuff on /dev/md0,

having deleted away my original source after i presumed the data xfer over to it was without a glitch.

do hope i can get it mounted again.

u might have noticed that i skipped some of the steps in making the raid disk like u mentioned. are there any ill-effects?

i'm quite long-winded myself..  :Razz: 

thanks for taking the time!

----------

## slartibardfast

No problem! I'm not sure but with out the persistant superblock I think you have to use raid0run, after each reboot. I think the disks have no information about themselves and the linux kernel can't automatically detect them.

You could build an initrd with "raid0run -a" on it if you really wanted to boot from it, but I'd just restart with a persistant-superblock!

----------

## lifeform

ooh yeah! i got it back up n running with the raid0run.

what did i miss which resulted in a missing persistant-superblock?

is it coz i had the entire drive in my raidtab instead of partitions?

ie. using /dev/hde instead of /dev/hde1, etc?

----------

## slartibardfast

excellent!

all you missed was setting this persistent-superblock to one in your raidtab, using your full drive is fine, lol who needs partitions! 

```
persistent-superblock 1
```

I'm not aware of a way to generate a superblock, post mkraid, but it might be worth a look.

----------

## lifeform

ah! thanks my man!

hey! i'd like to give ur configuration a shot

some encounters though:

when i tried "mkfs.xfs /dev/md0 -f" it broke:

MD array /dev/md0 not in clean state

also, if we are using the same board,

why is it that my SATA drives are hde and hdg versus ur sda sdb?

is it some kernel tweak?

i'm using gentoo's 2.6.7 kernel  :Smile: 

will i be able to transfer my current entire gentoo stuff on hda over to the new config simply using "cp"?

my other consideration is setting up grub to boot from the new configuration.

no idea as to how about getting grub to come off using this new configuration, having already installed it on my master boot record (hda0 i believe).

think i noticed the bios having a feature which enables booting from the SATA drives?

r u  booting up urs that way as well?

ur advice and inputs on the above wld be greatly appreciated!  :Razz: 

----------

## slartibardfast

The first bit of my howto post describes how to get sata setup as /dev/sda & /dev/sdb. 

libata routes SATA controllers though SCSI command interface (or something). The driver doesn't seem to support SMART atm, but it is slightly faster than the IDE driver   :Cool: 

I'd forgoten about that mkfs.xfs error, off the top of my head I got around it by:

```
mkswap /dev/md0

and then 

mkfs.xfs /dev/md0 -f

```

I think it is less strict, compared with xfsprogs, if this fails also try mkfs.ext3 or mkfs.reiserfs first, one of them will get it!

Setup grub for the two partitions of the /boot md independently(twice) but otherwise as normal. Grub isn't working with the raid when it boots, but when you change something on /boot it happens to both partitions etc.

For the copying over of stuff just use 'cp -av', I usually don't copy /mnt to avoid recursion. 

I can email my kernel config if you like? It's a bit module heavy because I'm both lazy and a distcc user,   :Laughing: 

P.S. My nf7-s v1.2 has no problem booting from SATA, usually it even maps it properly to HD0, if I set the bios order correctly!

Edit: I totally forgot, you should set the partition types of the elements of your raids' to 'FD' with cfdisk, the kernel also needs that to autorun raids, sorry about that  :Embarassed: 

----------

## lifeform

managed to get ard the mkfs error by using a newer version of xfsprogs  :Smile: 

set my partition types to FDs but still to no avail.

set my bios to "boot from SATA"

setup grub on both sda1 and sdb1

by running root (hd1,0) then setup (hd1)

and root (hd2,0), then setup (hd2)

i've even turned on my boot flag on both sda1 and sdb1

my present gentoo is on hd0

i've set my fstab to use

/dev/md0,1 and 2 respectively

upon reboot, i disconnect my present gentoo,

so that the my SATA boot up will be detected as hd0

being the only harddrives on the system

i'm getting an error at grub stage 1.5

error 17

did i miss out something?

 :Razz: 

----------

## slartibardfast

I didn't mention, you only should set your root /

to type 'FD', grub expects its partition to be type '83'. 

Everything else gets setup fine by raidtools from your /etc/raidtab

you'll have to run grub again, sorry 

hope you get it this time!

----------

## lifeform

hm.. let's see..  :Smile: 

there's 3 partitions

/dev/md0 (/dev/sda1 and /dev/sdb1) mounted as /boot

/dev/md1 (/dev/sda2 and /dev/sdb2) mounted as /

/dev/md2 (/dev/sda3 and /dev/sdb3) mounted as /home

u mean to set /dev/md1 (ie. sda2 and sdb2) to type FD

and the rest (ie. sda1+sdb1 and sda3+sdb3) to type 83?

as u mentioned, if grub expects a type 83,

i shld be setting my boot partition (ie md0=sda1 and sdb1) to type 83 then?

does grub specifically support only specific FSs? XFS's alrite?

how about the boot flags in the partitions? is it necessary to set them?

in my case, i've set the boot flags to on in both sda1 and sdb1

doesn't seem to make any significant difference though

will try agian n keep ya posted.

thanks very much!

----------

## slartibardfast

I've found evidence of people using type FD no problem with grub  :Sad: , but it can't hurt to change just the boot partitions to 83.

What FD does is get the kernel to automatically assemble the array, only / is critical to booting, it is the only thing that really requires FD

You are making your boot RAID1? Grub can't deal with anything else!

Seen as grub is giving us error messages the boot flags are working fine!

----------

## lifeform

yep. i'm making my boot RAID1.

hm.. u mean i shldn't b doing that?

how abt raid for swap?

----------

## slartibardfast

grub is only able to handle RAID1, just checking!

no need have raid for swap, just have them at the same prioity

----------

## lifeform

yesh! finally!

everything is up n running smoothly (no hiccups yet  :Smile:  )

problem was, i had set my BIOS' SATA raid setting to do a RAID0

i guess i'm running full software RAID now..

i've read some posts which state that software raids are faster than hardware ones..

haven't caught the gist of that though...

thanks for all the help!

----------

## slartibardfast

with the sil3112a, I wouldn't exactly call it *hardware* raid, it is more like *bios* raid   :Laughing: , it is handy for dual booting, other than that performace is fairly similar to software raid. 

I haven't really looked into bios/hardware 2.6 support, but I think it is usable, but not very automatic, and it is as yet risky because one can take out the bios superblock information. Much safer with software!!!

anytime,

----------

