Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Maxtor 160 GB



Ralf Spitzauer wrote:
...
> > A new controller is NOT needed, you only need the 48-bit
> > LBA kernel patch (or a kerner that has 48-bit LBA already).
> > Marco, you wasted your 78 EUR. With the patch, the 160GB
> > disk works full size on most newer controllers.
> >
> I ´haven´t install such a patch but I have full capacity (153GB in
> KdiskFree) with Kernel 2.4.10
> Do I need the patch or a newer kernel?

I do not know. 
The SuSE 2.4.10 kernel may have the patch in it already.
SuSE ships a higly-modified kernel with their distribution,
so I do not know what is in it. The patch is NOT in the
standard <= 2.4.17 kernels. It first showed up in the -ac
series. I am not sure if it made it into standard 2.4.18?

If my disk test below completes a full 153GB write and read pass
on your 153GB disk, you are all set with whatever you have.


> > So I strongly recommend to run a disk test that writes
> > and verifies every byte and uses different contents.
> > badblocks was not able to find these errors, so I wrote
> > my own test which did find the problem.
> >
> Where I can find such a disk test?

Here:

/*  Disk surface test and benchmark.
    Carsten Koch, January 2002.


Compile with 
   g++ disk_test.cpp -o disk_test

Execute as super-user with
   ./disk_test path_to_raw_disk_device

THIS IS A DESTRUCTIVE TEST! IT OVERWRITES YOUR ENTIRE DISK
IF YOU APPLY IT TO SOMETHING LIKE "/dev/hdc"! MAKE SURE YOU
KNOW WHAT YOU ARE DOING BEFORE STARTING IT!
I AM NOT RESPRONSIBLE FOR ANY DATA YOU LOSE BY OVERWRITING
YOUR DISKS USING THIS PROGRAM!

 */

#include <errno.h>
#include <fcntl.h>
#include <malloc.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/times.h>     
#include <sys/stat.h>


main(int argc, char *argv[])

{
   if ((argc != 2) && (argc != 3))
   {
      fprintf(stderr, "Usage: %s path [r|w]\n", argv[0]);
      exit(1);
   }
   
   const unsigned long MB = 1024 * 1024;

   if ((argc == 2) || (argv[2][0] == 'w'))
   {
      int f = open(argv[1], O_WRONLY|O_CREAT);
      if (f < 0)
      {
         perror("Cannot open file");
         exit(1);
      }
      fprintf(stderr, "Writing.\n");
      long long *buffer = (long long *)malloc(MB);
      unsigned long long total_length = 0;
      struct tms dummy_argument;
      const clock_t t_start = times(&dummy_argument);
      for (;;)
      {
         for (int buffer_index = 0; buffer_index < (MB/sizeof(long long)); buffer_index++) 
            buffer[buffer_index] = total_length + buffer_index;
         const int data_length = write(f, buffer, MB);
         if (data_length < 0) break;
         total_length += data_length;
         fprintf(stderr, "\r%llu MB.", total_length / MB);
      }
      close(f);
      const clock_t t_end = times(&dummy_argument);
      free(buffer);
      fprintf(stderr, "\nWrite complete - %s.\n %llu bytes in %g seconds = %g MB/s.\n", 
              strerror(errno), total_length, float(t_end - t_start) / float(CLK_TCK),
              float(total_length/MB) * float(CLK_TCK) / float(t_end - t_start));
      errno = 0;
   }

   if ((argc == 2) || (argv[2][0] == 'r'))
   {
      int f = open(argv[1], O_RDONLY);
      if (f < 0)
      {
         perror("Cannot open file");
         exit(1);
      }
   
      fprintf(stderr, "Reading.\n");
      long long *buffer = (long long *)malloc(MB);
      unsigned long long total_length = 0;
      struct tms dummy_argument;
      const clock_t t_start = times(&dummy_argument);
      for (;;)
      {
         const int data_length = read(f, buffer, MB);
         if (data_length <= 0) break;
         for (int buffer_index = 0; buffer_index < (data_length/sizeof(long long)); buffer_index++) 
            if (buffer[buffer_index] != total_length + buffer_index)
            {
               fprintf(stderr, "\nData error: %lld != %lld. Exit.\n", buffer[buffer_index], total_length + buffer_index);
               exit(2);
            }
         total_length += data_length;
         fprintf(stderr, "\r%llu MB.", total_length / MB);
      }
      close(f);
      const clock_t t_end = times(&dummy_argument);
      free(buffer);
      if (errno == 0)
         fprintf(stderr, "\nRead complete.\n");
      else
         fprintf(stderr, "\nRead aborted - %s.\n", strerror(errno));
         
      fprintf(stderr, "%llu bytes in %g seconds = %g MB/s.\n", 
              total_length, float(t_end - t_start) / float(CLK_TCK),
              float(total_length/MB) * float(CLK_TCK) / float(t_end - t_start));
   }
   
   exit(0);
}



Home | Main Index | Thread Index