Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jun 2004 15:48:42 +0900
From:      Simon McCorkindale <simon@unixinside.com>
To:        freebsd-amd64@freebsd.org
Subject:   box freezes with RAID 1 with onboard PDC20376 SATA RAID controller
Message-ID:  <40DFBF4A.6080806@unixinside.com>

next in thread | raw e-mail | index | archive | help
hi,

i'm not sure whether the problem i had is hardware related or something
to do with the related drivers in FreeBSD but i thought i'd post a
message of my experience.

i'm running 5.2.1-RELEASE-p8 on box which has a Asus K8V (standard) mb,
2x512MB PC3200 RAM sticks, 2x160GB Seagate Baracuda ST3160023AS
harddrives hooked up in a RAID 1 (mirror) mode array on the onboard
Promise Technologies PDC20376 SATA RAID controller card, an Athlon64
2800+ CPU and a 13GB Seagate Baracuda ST313620A harddrive connected to
the other onboard SATA interface (the VIA 8237 one). all the hardware
about from the 13GB drive is brand new.

/usr is on the RAID 1 array on the 2 160GB drives
/, /var and /tmp are on to the 13GB drive

i did an out-of-the-box install of FreeBSD, recompiled the kernel after
removing some of the unnecessary drivers (but keeping all the relevant
ata* drivers in the config file).

i ran a little C hack (pasted below) i made to see how the RAID system
would cope under a heavy workload. it simply does a rigourous and
continuous read/write to a file on the drive. i did this because i've
had problems with other RAID systems in the past. i ran the program on
the /usr drive but then the machine just froze after the file reached
about 54GB in size. the RAID volume was nowhere near full at that time.
there were no errors to dmesg/syslog so i can't give much more
information that what i've written already.

i've run the same program on the 13GB drive and with just one of the
160GB SATA drives connected to the Promise RAID controller (i found just
to have 1 SATA drive on the interface i needed to configure a RAID 0
array to get BIOS to boot off it) and the machine doesn't freeze. the
harddrive just gets filled up so this led me to conclude it must be
something to do with RAID 1 and/or 2 harddrives running off the interface.

if anyone has had any similar problems (and maybe found a solution) or
can explain this i'd be happy to hear from you. otherwise i just hope
this information can be helpful for any developers working on FreeBSD.

-Simon

if you want to run the program below, make sure there is a writable file
called "hddtest.txt" (a simple touch hddtest.txt should do the trick) in
the same directory as the compiled executable.

----
/*
 * hddtest.c - constant read and write to a file to test hdd durability
 */


#include <stdio.h>
#include <stdlib.h>
#include <time.h>


#define MAX 1000000000000000
//#define MAX 10


int main(int argc, char **argv) {
    int pid, *writing, status, i, j = 0;
    long max = MAX;
    time_t atime;
    char c;
    writing = malloc(sizeof(int));
    if (writing == NULL) {
        fprintf(stderr, "Error malloc()ing for writing\n");
        exit(1);
    }
    *writing = 1;
    FILE *fp1, *fp2;
    if ((pid = fork()) < 0) {
        perror("fork");
        exit(1);
    }
    if (pid != 0) {
        /* the parent code */
        while (*writing) {
            fp1 = fopen("hddtest.txt", "r");
            if (!fp1) {
                fprintf(stderr,
                    "Error opening file for reading\n");
                exit(1);
            }
            printf("%dst/nd/rd/th reading\n", ++j);
            while (!feof(fp1)) {
                c = fgetc(fp1);
                //printf("child %d: %c\n", pid, c);
                //printf("%c", c);
            }
            fclose(fp1);
        }
        exit(0);
    } else {
        /* the child code */
        time(&atime);
        srand(atime);
        fp2 = fopen("hddtest.txt", "w");
        if (!fp1) {
            fprintf(stderr, "Error opening file for writing\n");
            exit(1);
        }
        for (i = 0; i < max; i++) {
            j = rand() % 2000;
            //printf("rand number is %d\n", j);
            fputc(j, fp2);
            //printf("parent: putting %c\n", i);
        }
        fclose(fp2);
        *writing = 0;
    }
    waitpid(pid, &status);
    return 0;
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40DFBF4A.6080806>