⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unx35.htm

📁 Linux Unix揭密.高质量电子书籍.对学习Linux有大帮助,欢迎下载学习.
💻 HTM
📖 第 1 页 / 共 5 页
字号:

<BR></LI>

<LI>Use the disk controller's MS-DOS utility. For PCs, where most UNIX vendors have not provided a utility to format the disk, boot MS-DOS and use the disk controller vendor's format utility to format the disk.

<BR>

<BR></LI></UL>

<HR ALIGN=CENTER>

<NOTE>

<IMG SRC="imp.gif" WIDTH = 68 HEIGHT = 35><B>TIP:</B> Unlike MFM, ESDI, and SMD disks, where it matters what controller did the formatting, SCSI disks can be formatted on any system. If you don't want to take down the UNIX system for an hour or more to 
format the disk, use some other system or PC to do the format. Then just add the disk to the SCSI chain on the UNIX system.

<BR></NOTE>

<HR ALIGN=CENTER>

<HR ALIGN=CENTER>

<NOTE>

<IMG SRC="caution.gif" WIDTH = 37 HEIGHT = 35><B>CAUTION: </B>Unless your disk enclosure came with a Hot Swap tray, do not plug it in while power is applied. SCSI uses a fuse on the terminator power line, and plugging and unplugging the cable while the 
system and drives are powered up can blow this fuse, making the controller, and thus the computer system, unusable until it is repaired.

<BR></NOTE>

<HR ALIGN=CENTER>

<H4 ALIGN="CENTER">

<CENTER><A ID="I13" NAME="I13">

<FONT SIZE=3><B>Dealing with Flawed Sectors</B>

<BR></FONT></A></CENTER></H4>

<P>As I mentioned, UNIX expects the disks to be flawless. However, this is rarely true. It is too expensive to build large disks with no flaws. By allowing for a relatively small number of flaws, the price of drives can be much lower. UNIX can deal with 
flawed sectors in several ways:

<BR></P>

<UL>

<LI>Alternate sectors per track. In this scheme, one or two sectors per track are reserved for use in remapping flawed sectors. If a sector is flawed, its sector ID is instead written to the mapped sector. This reduces the overall storage capacity of the 
drive by some fixed percentage, to allow for flaws. This method has a problem if the track has more than the reserved number of bad sectors. This method is used mostly on SMD disks.

<BR>

<BR></LI>

<LI>Alternate tracks. In this scheme, several tracks are set aside, and whenever a track has a flawed sector, the operating system substitutes one of these tracks for the flawed track. Again, the storage space on all of the alternate tracks is lost. This 
method has a problem in that a single flaw wastes an entire track.

<BR>

<BR></LI>

<LI>Letting the disk controller map out bad blocks. In this scheme, the disk controller handles remapping the blocks, and the disk appears flawless. This is the method used by SCSI disks, where the disk controller is actually on the disk itself and the 
controller in the computer is really a SCSI bus controller.

<BR>

<BR></LI></UL>

<H5 ALIGN="CENTER">

<CENTER><A ID="I14" NAME="I14">

<FONT SIZE=3><B>Factory Flaw Map</B>

<BR></FONT></A></CENTER></H5>

<P>In either of the first two cases, the factory performs tests on the disk and writes to a special location on the disk the list of sectors found to be flawed or weak. This is referred to as the factory flaw map. Every sector on this map should be entered 

as flawed, even if it passes the UNIX bad sector test. This is because some of them might be weak and intermittently change over time. SCSI disks automatically access the factory flaw map when they perform their internal format. For non-SCSI disks, you 
will either access the factory flaw map with the formatting utility or enter it by hand from a table that is either attached to the top of the drive or enclosed with it when it is shipped.

<BR></P>

<H5 ALIGN="CENTER">

<CENTER><A ID="I15" NAME="I15">

<FONT SIZE=3><B>Newly Developed Flaws After Formatting</B>

<BR></FONT></A></CENTER></H5>

<P>Disk sectors can also go bad for several reasons after formatting. Sometimes there is a hardware problem and the formatting information for that sector is ruined. Other times the sector was weak to begin with or gets physically damaged. Either way, the 

disk is no longer flawless. This causes a problem because UNIX expects flawless disks.

<BR></P>

<P>You will see this problem when UNIX reports to the console log that it had an Unrecoverable Read or Unrecoverable Write error on a disk block. A warning about an upcoming problem would be a set of recoverable errors. You will need to map this block 
number to an absolute disk block. UNIX reports the block number, starting with block 0 at the beginning of each logical device. To convert the block number to absolute, you need to add the starting block number to the number reported in the log. To perform 

this conversion, you must meet the following requirements:

<BR></P>

<OL>

<LI>logical disk starting sector = starting cylinder of the logical slice <B>&#180;</B> number of heads <B>&#180;</B> number of sectors/track

<BR>

<BR></LI>

<LI>logical disk starting block = logical disk starting sector / number of sectors per block

<BR>

<BR></LI>

<LI>absolute block = logical disk starting block + reported block number from error message

<BR>

<BR></LI></OL>

<P>You will then need to repair or map the flawed sector.

<BR></P>

<HR ALIGN=CENTER>

<NOTE>

<IMG SRC="caution.gif" WIDTH = 37 HEIGHT = 35><B>CAUTION: </B>Most repair methods will destroy the data on the block. In addition, the flaw makes the file under the block damaged. Either way, recovery of that file will be necessary. However, if you make a 

mistake, you could damage the data on the entire disk. Therefore, always perform and verify a backup before attempting to repair a disk block.

<BR></NOTE>

<HR ALIGN=CENTER>

<H6 ALIGN="CENTER">

<CENTER>

<FONT SIZE=3><B>Non-SCSI Disks</B>

<BR></FONT></CENTER></H6>

<P>To repair a formatting problem, if your format utility allows it, just reformat the sectors that were damaged. Perform a nondestructive scan for unflawed defective sectors and reformat only those sectors.

<BR></P>

<P>If your format utility does not support repairing a single sector, you can flaw the sector, causing it to remap. Most formatting utilities provide an option to perform this automatically on the nondestructive scan.

<BR></P>

<P>Lastly, you can reformat the entire disk. Of course, this will lose all the data on the disk. You will have to re-install UNIX or restore from backup after this kind of repair.

<BR></P>

<H6 ALIGN="CENTER">

<CENTER>

<FONT SIZE=3><B>SCSI Disks</B>

<BR></FONT></CENTER></H6>

<P>Older SCSI disks required reformatting to add flaws. Newer disks fall into two categories:

<BR></P>

<UL>

<LI>Automatic repair: Most newer SCSI disks automatically detect the problem and remap the sector on the fly. These generally do not even report a problem.

<BR>

<BR></LI>

<LI>Manual Repair: There is a SCSI command to ask the disk to repair the sector. This command is activated by the vendor's disk utility.

<BR>

<BR></LI></UL>

<P>Your last resort is to reformat the entire disk. Of course, this will lose all the data on the disk. You will have to re-install UNIX or restore from backup after this kind of repair.

<BR></P>

<H4 ALIGN="CENTER">

<CENTER><A ID="I16" NAME="I16">

<FONT SIZE=3><B>Labeling the Disk</B>

<BR></FONT></A></CENTER></H4>

<P>Once the disk is formatted, it needs to have a special block, called the label, written to it. This block describes the geometry of the disk (heads, tracks, sectors) and how to split the disk into multiple logical disks (virtual table of contents).

<BR></P>

<P>On UNIX, it is often convenient to use multiple file systems. These provide protection from overruns and changes and can increase performance. However, it is expensive to place each file system on its own disk drive. Some are too small to warrant a 
drive, and requiring eight or ten disk drives would be too expensive. UNIX works around this by splitting the disk into logical disks. The label records how the disk is split.

<BR></P>

<H5 ALIGN="CENTER">

<CENTER><A ID="I17" NAME="I17">

<FONT SIZE=3><B>PC Partitions Versus UNIX Slices</B>

<BR></FONT></A></CENTER></H5>

<P>On a PC-based system, to be compatible with DOS, disks 0 and 1 are first labeled with the DOS fdisk partition table. The UNIX partition is marked NON-DOS and active. The fdisk partition table can be written by the DOS utility fdisk, by the disk 
controller vendor's formatting utility, or during the UNIX disk add sequence (by the UNIX command fdisk).

<BR></P>

<HR ALIGN=CENTER>

<NOTE>

<IMG SRC="imp.gif" WIDTH = 68 HEIGHT = 35><B>TIP:</B> Because PCs often require DOS programs to format disks and use the DOS utility to access the ESDI configuration utility, placing a small DOS partition on the hard disk is very useful. In addition, most 

UNIX systems let you boot from that DOS partition by typing the command DOS during the boot cycle.

<BR></NOTE>

<HR ALIGN=CENTER>

<P>The UNIX label is not the same thing as the DOS fdisk partition table. Instead, it is written to the first block of the UNIX partition along with the UNIX boot block.

<BR></P>

<P>On non-PC systems, the label is written directly to the first block of the disk along with the UNIX boot block.

<BR></P>

<H5 ALIGN="CENTER">

<CENTER><A ID="I18" NAME="I18">

<FONT SIZE=3><B>UNIX Slices</B>

<BR></FONT></A></CENTER></H5>

<P>The virtual table of contents in the label is used to split the disk into 8 or 16 logical disks. (Some UNIX vendors allow for 8, some for 16&#151;you don't make the choice yourself.) Once the system boots, each of these logical disks looks like a 
complete disk to UNIX. By convention, one of the slices is used to refer to the entire physical disk drive, and the remaining slices are left for you to configure.

<BR></P>

<H5 ALIGN="CENTER">

<CENTER><A ID="I19" NAME="I19">

<FONT SIZE=3><B>Configuring the Slices</B>

<BR></FONT></A></CENTER></H5>

<P>When you installed the system (see Chapter 33), you were prompted to enter the configuration information for each slice. When adding a disk, you will have to do the same thing. SVR4 will walk you through this using the adddisk option of the System 
Administrator shell (sysadm). Other systems require you to run a command to define the virtual table of contents (format on Solaris or SunOS, disksetup on Unixware).

<BR></P>

<H6 ALIGN="CENTER">

<CENTER>

<FONT SIZE=3><B>Adding a Disk Using the Solaris </B><B><I>format</I></B><B> Command</B>

<BR></FONT></CENTER></H6>

<P>By convention, disk drives on Solaris are set at SCSI target addresses 0&#151;3. Targets 4 and 5 are for tape drives, and target 6 is for the CD-ROM drive. Configure the disk to an unused SCSI, target it, and add it to the SCSI chain. Then reboot the 
system. Once booted, log in and become root. Then run the format command and select the new disk from the list of available disks, as follows:

<BR></P>

<PRE># format

Searching for disks...done

AVAILABLE DISK SELECTIONS:

       0. c0t1d0 &lt;SUN1.05 cyl 2036 alt 2 hd 14 sec 72&gt;

/iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@1,0

       1. c0t2d0 &lt;DEC DSP5350 cyl 2343 alt 2 hd 25 sec 119&gt;

/iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@2,0

       2. c0t3d0 &lt;SUN1.05 cyl 2036 alt 2 hd 14 sec 72&gt;

/iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@3,0

Specify disk (enter its number): 0

selecting c0t1d0

[disk formatted]

FORMAT MENU:

        disk       - select a disk

        type       - select (define) a disk type

        partition  - select (define) a partition table

        current    - describe the current disk

        format     - format and analyze the disk

        repair     - repair a defective sector

        label      - write label to the disk

        analyze    - surface analysis

        defect     - defect list management

        backup     - search for backup labels

        verify     - read and display labels

        save       - save new disk/partition definitions

        inquiry    - show vendor, product and revision

        volname    - set 8-character volume name

        quit</PRE>

<P>If the disk is already labeled, its label type will be show on the selection list. Otherwise, the disk will be shown with the type unknown.

<BR></P>

<PRE>format&gt; <B>type</B>

AVAILABLE DRIVE TYPES:

        0. Auto configure

        1. Quantum ProDrive 80S

        2. Quantum ProDrive 105S

        3. CDC Wren IV 94171-344

        . . .

       16. other

Specify disk type (enter its number)[12]: <B>16</B>

Enter number of data cylinders: <B>2034</B></PRE>

<P>The number of data cylinders is set to the number of cylinders minus the number of alternate cylinders for bad block mapping. The default number of cylinders for bad block mapping in Solaris is 2, so set this to the number of cylinders reported by the 
drive minus 2 cylinders.

<BR></P>

<HR ALIGN=CENTER>

<NOTE>

<IMG SRC="imp.gif" WIDTH = 68 HEIGHT = 35><B>TIP:</B> Many SCSI drives use a variable number of sectors per cylinder. In this case, map the drive to provide an even number of heads and sectors per track. The allocation of data to cylinders works best if a 

cylinder is an integral number of disk blocks. Try to make sectors * heads a multiple of 16 (for 8 KB file systems). Then just divide the number of blocks by this product to get the number of cylinders. However, most disk drive vendors can provide you with 

a Sun format.dat entry for your drive. This will have all of these parameters already listed for you.

<BR></NOTE>

<HR ALIGN=CENTER>

<PRE>Enter number of alternate cylinders[2]:

Enter number of physical cylinders[2036]:

Enter number of heads: <B>14</B>

Enter physical number of heads[default]:

Enter number of data sectors/track: <B>72</B>

Enter number of physical sectors/track[default]:

Enter rpm of drive[3600]:

Enter format time[default]:

Enter cylinder skew[default]:

Enter track skew[default]:

Enter tracks per zone[default]:

Enter alternate tracks[default]:

Enter alternate sectors[default]:

Enter cache control[default]:

Enter prefetch threshold[default]:

Enter minimum prefetch[default]:

Enter maximum prefetch[default]:

Enter disk type name (remember quotes): &quot;New Disk Type&quot;</PRE>

<P>Assign the drive a name that matches the manufacturer and model of the drive. Use the other drive names shown in the selection list as examples. It is best to take the default values for the SCSI parameters&#151;the system will fetch them from the SCSI 

pages in the drive.

<BR></P>

<P>Next you have to define the slices (partitions). This is performed from the partition menu, as follows:

<BR></P>

<PRE>format&gt;  <B>par</B>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -