From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <1613261886d78e775094388286433339.axp-list@archive.invalid> X-Archive-Original-Message-ID: <3.0.1.32.19970511163326.006bba00@ellpspace.math.ualberta.ca> Date: Sun, 11 May 1997 19:59:31 -0400 (EDT) From: Paul B. Brown Subject: SCSI Disk Partition - Revisited In-Reply-To: Hi Gang, I want to thank all the people who responded to my question about Heads/Cylinders/Sectors on a Maxtor 7345S running in a UDB. If anyone is interested: H/C/S = 71/863/11 I figured it out after having read the pertinent parts of the SCSI-HOWTO and the Large Disks Mini-HOWTO. If anyone else wants to figure out what H/C/S to use on a SCSI disk under Linux, simply cut out the program below, update the DISK_SIZE parameter to the size in bytes of the formatted disk, compile it and run it. It will give you what you need. Odviously, there is no warrantee/garrantee expressed or implied that this program will even work. Yada, yada, yada . . . You know the drill . . . . Anyway, thanks again all . . . . Paul -- CUT HERE -- #include /****************************************************************************** * * Source Code: calc_hcs.c * * Compile/Link Statement: gcc -o calc_hcs calc_hcs.c * * Run Statement: calc_hcs * * Description: This program will calculate the heads/cylinders/sectors on * a Linux SCSI drive. Simply change the define statement * below, DISK_SIZE, specifying the size, in bytes, of the * formatted SCSI drive, compile it, run it, and your done! * Any Future version will need to be updated based on the * info given in the SCSI HOWTO and the Large Disks * Mini-HOWTO. * * History: * * Who Date Comment * ----------- ------ --------------------------------------------------- * Paul Brown 970511 Initial version 0.1b * ******************************************************************************/ /* * Change this setting when you wish to calculate a new drive. It should be * the size of the formatted drive in bytes. */ #define DISK_SIZE (long) 345090000 /* Maxtor 7345S - 342 MB */ /* * Standard setting - DO NOT TOUCH */ #define BYTES_PER_SECTOR (long) 512 /* * These settings are right out of the SCSI HOWTO. These are the max settings * Linux will understand for SCSI drives. With these settings you cannot have * a SCSI drive more than 8 formatted Gigabytes in size. Bummer! */ #define MAX_HEADS (long) 256 #define MAX_CYLINDERS (long) 1024 #define MAX_SECTORS (long) 63 main() { long disk_size; long cur_guess; long heads; long cylinders; long sectors; long best_heads; long best_cylinders = (long) 0; long best_sectors = (long) 0; long best_guess = (long) 0; best_guess = disk_size = DISK_SIZE / BYTES_PER_SECTOR; for (heads = (long) 1; heads <= MAX_HEADS; heads++) { for (cylinders = (long) 1; cylinders <= MAX_CYLINDERS; cylinders++) { for (sectors = (long) 1; sectors <= MAX_SECTORS; sectors++) { cur_guess = disk_size - (heads * cylinders * sectors); if (cur_guess < (long) 0) break; if (cur_guess == (long) 0) printf("DIRECT HIT -> %ld/%ld/%ld (heads/cylinders/sectors)\n", heads, cylinders, sectors); if (cur_guess < best_guess) { best_heads = heads; best_cylinders = cylinders; best_sectors = sectors; best_guess = cur_guess; } } } } /* * I pick the first direct hit to be the best guess because I have a preference * for the lowest number of heads. Just a quirk of mine . . . . ;-> */ printf("BEST GUESS -> %ld/%ld/%ld (heads/cylinders/sectors)\n", best_heads, best_cylinders, best_sectors); exit(0); } -- CUT HERE -- --------------------------------------------------------------------------- Paul B. Brown "Sailing is a state of mind . . . ." pbrown@btechnet.com Unix Systems Administration --------------------------------------------------------------------------- -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com