APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds RSS Feeds











(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version
->
-> Adding a harddrive (SCO Unix)


Adding a second hard drive SCO Xenix, Open Desktop, Openserver




This article references SCO SCO Xenix, Open Desktop, Openserver specifically. See Linux/adddrive.html for adding a Linux drive.


You add a hard drive, and configure the file systems on it, by running "mkdev hd".

People used to older Unices may expect more complications, and may expect to have to use "mkfs" after hand editing kernel configuration files to add the appropriate block and character devices. You certainly can do all that if you want, but "mkdev hd" is a front end that makes it much easier. If you are curious as to what goes on behind the scenes, look in /usr/lib/mkdev. The "hd" command there is a shell script, and is fairly self-explanatory.

You generally have to run 'mkdev hd' twice. If I remember correctly, the kernel already has the code for the second IDE drives, so in that case it's only once. But for SCSI drives, the first invocation puts the driver code in, and the second (after a reboot) allows the partitioning and division of the drive.

For SCSI drives, the first pass asks you the name of the SCSI controller. If you don't know, and if your primary drive already is SCSI, look in /etc/conf/cf.d/mscsi. The end of the file might look something like:


wd      Srom    1       0       0       0
asc     Sdsk    0       0       0       0
asc     Sdsk    0       4       0       0
 

(This happens to be a machine with an EIDE cdrom and a scsi disk using an "asc" controller, plus a second scsi disk at ID 4). You'll also be asked about which controller (if you have only one, it's "0"), what bus (probably 0) and the target ID. and the lun (almost always "0").

There are twin-channel controllers: for these, one is controller "0", the other is "1". You can follow the internal cables to see which one your drive is connected to.

If you aren't sure what SCSI devices are present, the "sconf" command can help you on modern systems. Prior to OSR5.0.5, this existed but could crash your system in multiuser mode, but now is safe. Here's the output of "sconf -v" on one of my machines:

Sdsk    alad    0       0       0       0
Sdsk    alad    0       0       1       0
Stp     alad    0       0       3       0
Sdsk    alad    0       0       4       0
Srom    alad    0       0       6       0
 

For example, this tells me that a tape drive (the Stp line) is attached to an alad controller, and (reading left to right), it's alad unit 0, on bus 0, at id 3 and lun 0.

See sconf on 5.0.7.

After answering these questions, the kernel is relinked. Be sure to answer "Y" to "Rebuild the Kernel Environment", and be sure you understand what that question means (if you don't, make a copy of /etc/inittab before you begin this process). You do have to reboot before proceeding to the next step. You then run 'mkdev hd' again, and answer the same questions.

If you got it wrong:

Let's be clear what that first invocation does. It's nothing more than to trust you: in other words, you said "there's a scsi disk attached to this controller and it has this id, etc." and mkdev hd said "Kewl- I'll add that to /etc/conf/cf.d/mscsi and build a new kernel which can access that".

But that's all it does. It doesn't even bother to run sconf -v to see if any hardware remotely like what you described is out there.

The second invocation (after rebooting) really goes out and tries to access the physical hardware. Apparently it doesn't find the drive. That could be because (just listing a few things I've done or not done)

  • You forgot to plug in the power
  • You forgot the cable- at one end or the other
  • You forgot the cable completely (ayup, I did that!)
  • You misidentified the adaptor bus, the scsi id, the lun- or all of 'em.
  • You misidentifed which driver to use- arad, alad, what's the difference? Hate to say how many times I've done that..
  • You really installed a tape drive (I didn't actually do that but I came very, very close to it once. But I have, at least twice, installed a tape drive in a hard drive bay where there was no opening to the outside world to put the tape in..)

If this is 5.0.5 or better, run sconf -v and see if it sees your hardware and that it matches what you (or mkdev hd) put in /etc/conf/cf.d/mscsi. If it doesn't, you can just manually edit mscsi, relink, and reboot. Note that the order in which sconf displays info is NOT the order used in mscsi!

If you guessed wrong about the controller, bus, or ID, you won't get the screens that ask about the partitions. If that's the case, don't use mkdev hd, simply go directly to /etc/conf/cf.d/mscsi, make the corrections, and link a new kernel. The controller is the first column after Sdsk, the ID is the second, then lun and bus. Simply change the appropriate column, and then relink.

If you don't feel comfortable with that, at least vi mscsi to remove the line that represents the error. Once you've got that correct, 'mkdev hd' will proceed to the second phase, where you create the Unix partition and then divide it into one or more filesystems.

During that second phase, you are asked if you want "block by block control". If you answer that affirmatively, you get to control everything about the division(s) created, including the name(s).

Also, if you don't say you want interactive fdisk/divvy you never get the chance to name divisions anything memorable. Divvy will use a device name instead like "D1150".

When you run divvy initially, you tell it what device you are working on: scsi id, etc. It writes that information into a "division table" on the disk. The second invocation reads that table and scans through /dev looking for device nodes whose major/minor numbers match the entries in that table. When it finds one, it prints that name.

That means that if you boot from floppy or cd and access divvy, it can only find names that exist in /dev on your boot device.

It also means that when you change the name of a division, all divvy does is delete /dev/oldname and /dev/roldname and creates /dev/newname, /dev/rnewname in /dev. It doesn't write anything to the division table except if you change the size of a division or split the disk into more divisions.

Changing the TYPE of a division does nothing at all except serve as a flag to divvy if you say "New filesystem", in which case it runs mkfs to match the type you said.

If you have existing data

You may want to transfer an existing disk to another system, as for an upgrade. The procedure is the same, but do NOT change the partition info, do NOT change the bad track table, and do NOT create new filesystems. You'll see your divisions; all you need to do is (n)ame them and proceed from there.

If you don't, an arbitrary (e.g. "d1150" ) name is generated. It's not actually completely arbitrary: it is related to the drive number and its id if scsi. I think it's been documented somewhere, but I never pay attention to it because:

  • You can name the divisions sensibly
  • You can always find out what someone else named them

The "finding out" can be accomplished by using 'divvy' on the appropriate device. "man HW hd" gives tables of drive names, and from that it's easy to find out /dev/hd1a will represent the second physical disk. Therefor, 'divvy -P -N /dev/hd1a' will print out info about the divisions, including the names.

Or, you can use divvy interactively, leaving out the -N and -P. By doing this, you can even change the name to something more sensible. I like to use names that are reminiscent of the mount points, so my Jaz drive has a division 'jaz', which creates a /dev/jaz, which I mount at /jaz.

Note here that the second pass of "mkdev hd" will have invoked divvy for you: you don't need these commands unless you need to get back to the divvy tables after this. Note also that if you already know the name of the division (such as /dev/u), you can get there with "divvy /dev/u"

You may want to creat multiple partitions. See Adding disk space for suggestions.

Mount

The final step, of course, is to do the mount. You can manually edit /etc/default/filesys ('man filesys'), or you can use 'mkdev fs'. This does NOTHING TO EXISTING DATA. It only creates /lost+found and adds the drive to /etc/default/filesys. You can safely use this with any drive.

You didn't pay attention to the name of the division and didn't change it from the default? Look at the "Existing Data" section just above this.


For some reason, there is no mention of 'fs' in the man page for 'mkdev', but it's been in /usr/lib/mkdev for a very long time. It asks the appropriate questions, and if you give it appropriate answers, it will create the appropriate entry in /etc/default/filesys.

You get asked for the device name. Answer that with the name of the division. You are then asked for a mount point, and finally you are asked if you want to always mount this filesystem. Generally, you'll answer yes to that.

If you told it to "always mount", you can then mount it by any of "mountall", "mount /mount_point", or by rebooting.

For ideas about what to do with this extra space see Adding disk space.

See also:





If this page was useful to you, please help others find it:  




6 comments




More Articles by - Find me on Google+



Click here to add your comments
- no registration needed!






Tue Nov 17 11:02:40 2009: 7562   JohnPierpoint

gravatar
Thanks for the article. Tried to use it to mount an existing data drive back onto a server that has had to have a new OS drive and SCO re-installed.
All appeared to go reasonably OK, but somewhere along the line, despite taking every precaution, it seems to have wiped the whole lot.
I hate UNIX. . .



Tue Nov 17 11:46:26 2009: 7563   TonyLawrence

gravatar
I'm sorry that happened.

The article that fully deals with that is http://aplawrence.com/SCOFAQ/FAQ_scotec6recoverdrive.html. It's possible that your drive really is not wiped; I suggest reviewing that article,



Tue Nov 17 12:52:11 2009: 7564   JohnPierpoint

gravatar
Tony,
Thanks for (quick!) response and the link to the other article at http://aplawrence.com/SCOFAQ/FAQ_scotec6recoverdrive.html.
I'm reading through that now. . .
I had already given up and started a restore of data from the last backup tape, but that failed with error "No space left on device (error 28)", which suggests that somehow I've managed to mount a FS on the wrong physical disk (presumably the smaller boot HDD), so you are probably right: the data may still be intact on the original data disk. I just need to figure out how to get SCO to see it!
I've practised restores like this during assisted DR sessions on clean servers with very large single HDDs, but this one is on the original hardware with a 2GB boot HDD (which was failing - now replaced) and a 9GB data HDD, both on the same SCSI controller, one on ID 0, the other on 1. All other SCSI settings are 0.
During the OS reinstall to the new boot HDD, I deferred the setup of the 2nd HDD, afraid that it would just wipe the whole lot.
After reading the article, I then ran mkdev hd and quit out of the options to change the partitions. The 2nd disk reported as having a division called hd1a.
mkdev fs didn't succeed (couldn't find /dev/hd1a), and neither did the similar process in SCOadmin, but I found the target mount point (/user/MENTOR) in the filesystem anyway. Not sure how that happened!
mkdev didn't prompt for a kernel re-link (although it did when I put the tape drive on later), so I'm obviously
I might go back to square one and re-install SCO from scratch on the boot HDD. If I did that, are there any settings I could use in the SCO install process to make sure it picks up the data HDD painlessly without overwriting the data?
I still hate UNIX, but at least with sites like this around, us UNIX newbies stand a fighting chance of fixing things!



Tue Nov 17 13:10:51 2009: 7565   TonyLawrence

gravatar
It's not going to wipe it out unless you tell it to, so don't worry about that.

You may be seeing geometry issues - pay attention to that part.


I am on my way out to a customer so won't be able to respond again until late today or tomorrow.



Fri Jun 18 17:24:35 2010: 8721   anonymous

gravatar


Please excuse my lack of knowledge it has been 10 years since working with SCO Unixware 7 and a couple years since working with Linux distributions. I seem to recall four or five years ago adding a second hard disk for a client running out disk space, mounting it to the file system, but then creating a symbolic link to it so the newly mounted drive would be used for the partition running out of space. I am probably mistaken, but that is what I seem to recall. Is this possible?



Fri Jun 18 17:27:36 2010: 8722   TonyLawrence

gravatar


Yes, you can. See http://aplawrence.com/Unixart/moredisk.html for more on that.

Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar

Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

I am a Kerio reseller. Articles here related to Kerio products reflect my honest opinion, but I do have an obvious interest in selling those products also.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.

pavatar.jpg

This post tagged:

       - Administration
       - Disks/Filesystems
       - Install/Upgrade
       - SCO_OSR5















My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!


book graphic unix and linux troubleshooting guide



Buy Kerio from a dealer
who knows tech:
I sell and support

Kerio Connect Mail server, Control, Workspace and Operator licenses and subscription renewals



Click and enter your name and phone number to call me about Kerio® products right now (Flash required)