Problem
I have installed an additional hard disk using the "mkdev hd" utility. I now need to remove (de-configure) the additional drive.
-or-I followed the instruction in ta105052, "How can I remove and reinstall an additional hard disk on SCO OpenServer 5?", and when I relink I get:
idmkreg : error updating space.c for SdskThe information in this article is based on a two-drive system where you want to remove the second drive. If you have more than two drives, you can still use this information. Simply use the correct number for the last drive on your system when following these steps. For example, if you have a three-drive system, you would replace hd10 with hd20 in the steps listed below, and all other references to 1 would be replaced with 2 to remove the third disk drive.
WARNING:THIS INFORMATION IS FOR REMOVING THE LAST DISK THAT WAS ADDED TO THE SYSTEM. DO NOT USE THIS INFORMATION TO REMOVE DISKS IF THEY ARE NOT THE LAST DISK ADDED TO THE SYSTEM. If you need to remove configuration for more than one disk, follow the steps to remove the last disk first and work your way back (that is, hd3*, then hd2*, then hd1*).
Solution
To remove configuration files for additional hard drives on SCO OpenServer 5.0.4, do the following:
1. Remove the special device files for the additional hard drives:
# rm /dev/hd1*
# rm /dev/rhd1*
# rm /dev/dsk/1s*
# rm /dev/rdsk/1s*NOTE: "hd1*" is the naming convention for the second hard drive and "hd2*" is for the 3rd hard drive and so forth.
For SCSI hard drive, you may need to run:
# mkdev .scsiChoose to Remove a SCSI device.Choose the Hard Disk.Enter the proper Target ID number, Host adapter number and LUN number to remove that SCSI hard disk device.
As an added verification, edit the /etc/conf/cf.d/mscsi file. You
should have only one line item for the hard disk (listed as "Sdsk"
under the attach column). If there are excess entries for Sdsk,
remove these lines.2a. Check the /etc/conf/node.d/Sdsk file for extra entries. Remove all entries of the type listed below:
Sdsk dsk/1s0
Sdsk hd10
Sdsk rdsk/1s1
Sdsk rhd10NOTE: There will not always be an Sdsk entry in the /etc/conf/node.d directory. If you do not have this entry, go to the next step.
2b. Check the /etc/conf/node.d/hd file for extra entries. Remove
all entries of the type listed below:hd dsk/1s0 hd dsk/1s1 hd dsk/1s2 hd dsk/1s3 hd dsk/1s4 hd dsk/1sC hd dsk/1sD hd dsk/1sE hd dsk/1sF hd dsk/1sG hd dsk/1sH hd dsk/1sI hd dsk/1sJ hd dsk/1sa hd dsk/1sd hd hd10 hd hd11 hd hd12 hd hd13 hd hd14 hd hd1a hd hd1d hd rdsk/1s0 hd rdsk/1s1 hd rdsk/1s2 hd rdsk/1s3 hd rdsk/1s4 hd rdsk/1sC hd rdsk/1sD hd rdsk/1sE hd rdsk/1sF hd rdsk/1sG hd rdsk/1sH hd rdsk/1sI hd rdsk/1sJ hd rdsk/1sa hd rdsk/1sd hd rhd10 hd rhd11 hd rhd12 hd rhd13 hd rhd14 hd rhd1a hd rhd1d
3. Modify the Sdsk driver to remove the entries for the additional disk drives. Edit the /etc/conf/pack.d/Sdsk/space.c file and remove the additional disk entries between the lines that contain the word PROBE, located at the bottom of the file.
========================================================
Example of a space.c file with two disk drive entries:
========================================================
/* Probe routine return values, the marker comments must be
kept in place so that the mkdev script can patch up this
file correctly
*//*_PROBE_START_*/#define Sdsk0 155648 /* Sdsk0 */
#define Sdsk1 155649 /* Sdsk1 */
int SdskProbe[] = {Sdsk0,Sdsk1,0};/*_PROBE_STOP_*//* End probe routine return values */Remove the define statement for Sdsk1 or the disk(s) you want to remove from the system, and remove the same entry from the SdskProbe line.
=============================================================
Example of the space.c file after removing the Sdsk entries:
=============================================================/* Probe routine return values, the marker comments must be kept in place so that the mkdev script can patch up this file correctly */
/*_PROBE_START_*/#define Sdsk0 155648 /* Sdsk0 */
int SdskProbe[] = {Sdsk0,0};/*_PROBE_STOP_*/4. Edit the /etc/conf/pack.d/Sdsk/device.dat file to remove the entry for the disk you want to remove from the system.
============================================================
Example of a device.dat file with an additional hard disk:
============================================================FILE_FORMAT:
version=1
Sdsk0:
INDEX=Sdsk0
PATH=node0,node1
node0=D_SUBSYS,SCSI Disk,0,D_HARDDSK_SUBSYS,,NULL
node1=D_UNIT,SCSI Drive 0,0,0,D_RANDOM_ACCESS D_NODE,NULL
D_USER_MSG=SCSI Disk Drive,0,0,,NULL
D_BLOCK_NODE = 0
D_CHAR_NODE = 0Sdsk1:
INDEX=Sdsk1
PATH=node0,node1
node0=D_SUBSYS,SCSI Disk,0,D_HARDDSK_SUBSYS,,NULL
node1=D_UNIT,SCSI Drive 1,0,1,D_RANDOM_ACCESS D_NODE,NULL
D_USER_MSG=SCSI Disk Drive,0,0,,NULL
D_BLOCK_NODE = 64
D_CHAR_NODE = 64===============================================================
Example of a device.dat file after removing the Sdsk1 entries:
===============================================================FILE_FORMAT:
version=1
Sdsk0:
INDEX=Sdsk0
PATH=node0,node1
node0=D_SUBSYS,SCSI Disk,0,D_HARDDSK_SUBSYS,,NULL
node1=D_UNIT,SCSI Drive 0,0,0,D_RANDOM_ACCESS D_NODE,NULL
D_USER_MSG=SCSI Disk Drive,0,0,,NULL
D_BLOCK_NODE = 0
D_CHAR_NODE = 05. Remove the nodes for the filesystems that are on the disk that you want to remove from the system. These nodes are located in the /dev directory and consist of both the character and block node entries. For instance, if the disk you are removing has two filesystems then you would need to remove four nodes. As an example, if the two filesystems are named u1 and u2, you should remove the file nodes u1, ru1, u2 and ru2. For this example, enter the following:
# rm /dev/u1 /dev/ru1 /dev/u2 /dev/ru2While this might be considered an optional step, if you are going to add this disk back to the system and you want to use the same names for the filesystems, divvy will not let you create filesystems with names that already exist on the system. Additionally, it is good administration to keep the /dev directory free of unused entries.
6. Modify the /etc/conf/cf.d/sysRegistry file. Remove the entry corresponding to hard disk(s) you want removed. The entry for a second SCSI hard disk would look something like this:
Sdsk1:INDEX=99328 PATH=node0,node1 node0=15,SCSI Disk,0,4,0,NULL node1=16,SCSI Drive 1,0,1,34,NULL D_USER_MSG=17,SCSI Disk Drive,0,0,0,NULL D_BLOCK_NODE=3,hd10,0,0,0,NULL D_CHAR_NODE=5,rhd10,0,0,0,NULL
Remove all lines and save the file.
NOTE: There will not always be an Sdsk entry in the /etc/conf/cf.d/sysRegistry file. If you do not have this entry, skip this step.
7. Check the /etc/conf/cf.d/hdlist for extra entries and remove as necessary:
=========================================================
Example of a hdlist file with an additional hard disk:
=========================================================0 /etc/conf/node.d/hd 0
1 /etc/conf/node.d/hd 64========================================================
Example of a hdlist file after removing extra entries:
========================================================0 /etc/conf/node.d/hd 08. Relink and reboot.# cd /etc/conf/cf.d
# ./link_unix
# shutdown -g0 -yYour system should now be cleared of the additional hard drive's configuration.