Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 1998 08:37:13 +1000
From:      Robert Chalmers <robert@chalmers.com.au>
To:        freebsd-questions <freebsd-questions@FreeBSD.ORG>
Subject:   Detailed instructions for new SCSI second disk partitoning
Message-ID:  <357F0A99.CB8E060C@chalmers.com.au>

next in thread | raw e-mail | index | archive | help
Hope this is of some use to some folks.

It's written to fit a full 80 character/column screen.

This is the process I used to set up a dedicated, non-boot second 
SCSI disk. I used an Adaptec 1542 controller. I received some
good advice from Malte Lance <malte@webmore.com> regarding the
formula to use initially to calculate disk size in sectors.
I also discovered that someone else had mentioned that having an #nt 
value greater than 64 on i386 systems could cause incorrect results.
This may be so, however Malte's formula works, and actually 
returns the correct number of sectors. Even though the final process
chenges them to the correct ones.
Malte swears by fdisk, but I prefer not to use it for various reasons.

The business of setting up a SCSI drive this way can seem complex,
but if taken a step at a time goes ok usually. 

If you have a new SCSI drive, there is no need to format it. However,
there is some inforamtion you need to discover, the most important
of which is the total number of cylinders on the disk.

Scsiformat is the only way I know of discovering this. You should
note here that this first comamnd is non-destructive. On a new
drive it should be all you need.

Use the scsiformat command to discover your number of cylinders.
This has a -p, and an ordinary 'd' followed bye the drive id.
sd1 for your second disk. Don't mess with the primary disk, 
which would be sd0. All the man commands use sd0 as examples, so 
don't type them by mistake. You will nuke your operating system!
So,
Command line: scsiformat -p d sd1
Returns; (in my case)
----------------
COMPAQ 
C2490A 
3184 

Mode data length:  35 
Medium type:  0 
Device Specific Parameter:  0 
Block descriptor length:  8 
Density code:  0 
Number of blocks:  0 
Reserved:  0 
Block length:  512 
PS:  0 
Reserved:  0 
Page code:  4 
Page length:  22 
Number of Cylinders:  2630   <------------ this is what you want.
Number of Heads:  18 
Starting Cylinder-Write Precompensation:  0 
Starting Cylinder-Reduced Write Current:  0 
Drive Step Rate:  0 
Landing Zone Cylinder:  0 
Reserved:  0 
RPL:  0 
Rotational Offset:  0 
Reserved:  0 
Medium Rotation Rate:  6400 
Reserved:  0 
Reserved:  0 
--------------------------------
You should redirect this output to the printer. Keep it for future
reference.

If you have a second hand disk, or the above command would not
return the correct information, or any information, you may have
to actually do a low-level format of the drive. This wont hurt, but
can take ...... ages ...... 
When it starts, you get a warning that formatting will take place in
three (3) seconds ahhhhhh. Dont worry, unless you used the wrong
disk id. Make sure you get sd1 right, not sd0!!!!

Commandline: scsiformat -w sd1
Starts in 3 seconds.... (takes about 15 minutes for a 2.1Gb drive)

Write down your total number of cylinders number, or re-issue the
scsiformat -p -d sd1 command and print it out.
--------------------------------
Next step is to set up your disktab entry.

Set up /etc/disktab entry:
 entry for a 2.1Gb Compaq SCSI
 Calculate true size in sectors with this formula;
 sectors/track * tracks/cylinder * cylinders
 Malte suggests #ns=32 #nt=64 and your total cylinder number gleaned from
 the scsiformat -p d sd1 command.
 In my case, the formula gives: 32 * 64 * 2630 = 5386240

--------------------------------
My /etc/disktab entry looks like this;

c2490a|Compaq C2490A SCSI:\
	:ty=winchester:dt=SCSI:ns#32:nt#64:nc#2630:\
	:pa#2055000:oa#0:ta=4.2BSD:\
	:pb#336640:ob#2055000:tb=swap:\
	:pc#5386240:oc#0:\
        :pd#1497300:od#2391640:td=4.2BSD:\
	:pe#1497300:oe#3888940:te=4.2BSD:

This actually states the partiton sizes, and the offsets. That is, where
each partiton starts. Look at the last entry. It starts at
sector 3888940, and is 1497300 in size. adds up to 5386240, the total
size. You cant go past that of course.

------------------------------
Having checked your work, run this little script: it prevents you typing
in the wrong scsi disk number!!!
I called it tabmake.sh, and set it 755.

disklabel -w -r /dev/rsd1c c2490a sd1s1
echo "Done"

This SHOULD run with out error and produce the word "Done"
If you get errors - go back and check your numbers in disktab!

Then, disklabel sd1 should produce your equivelant of this.
I notice also that the RPM is different to thatin the scsiformat 
command line return. Which gives 6400

Also, once you have used disktab, your cant do it this way
again, unless you go back to step 1, and format the drive
to remove the partition information.

Ok, to check you work, do a 

disklabel sd1 

You will notice that the numbers have changed from those in the 
disktab entry. Don't worry. Its a 'best fit' effort by the system 
to round things off on boundaries.

You can actually modify this with the disklabel editing facility,
and write it back to disk. Be careful though.

# /dev/rsd1c:
type: SCSI
disk: c2490a
label: sd1s1
flags:
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 64
sectors/cylinder: 2048
cylinders: 2006
sectors/unit: 4110000
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0		# milliseconds
track-to-track seek: 0	# milliseconds
drivedata: 0 

5 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a:  2055000        0    4.2BSD        0     0     0 	# (Cyl.    0 - 1003*)
  b:   336640  2055000      swap                    	# (Cyl. 1003*- 1167*)
  c:  4110000        0    unused        0     0       	# (Cyl.    0 - 2006*)
  d:  1497300  2391640    4.2BSD        0     0     0 	# (Cyl. 1167*- 1898*)
  e:  1497300  2612700    4.2BSD        0     0     0 	# (Cyl. 1275*- 2006*)

Ok, thats about it. Its an interesting experiment. You get to see
whats going on, and learn how to write a disktab entry into the bargin.

Bob


-- 
  Support Whirled Peas.       Business in China?    China House
  robert@chalmers.com.au      ph:61 7 49440357 fx:61 7 49578425 
   China House Uses Webposition to ensure Top Spot in Searches      
   http://www.chalmers.com.au/ChinaHouse/Business/webposition

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?357F0A99.CB8E060C>