|[ Team LiB ]|
The following sections describe the Solaris disk-naming conventions, commands for finding disk information (du, prtvtoc), and ways to repair or replace a bad disk.
Solaris disks have both block and raw (character) device files. The device name is the same, regardless of whether the command requires the block or raw device file.
Each type of device file has its own subdirectory in /dev: /dev/dsk (the block interface) or /dev/rdsk (the raw interface).
Some commands, such as mount, use the block interface device name from the /dev/dsk directory to specify the disk device. Other commands, such as newfs, require the raw interface device name from the /dev/rdsk directory to specify the disk device.
The device name you use to identify a specific disk with either type of interface depends on the controller type: bus-oriented (SCSI) or direct. You refer to a disk device by specifying the subdirectory to which it is symbolically linked (either /dev/dsk or /dev/rdsk) followed by a string identifying the particular controller, disk, and slice.
cw is the controller number, tx is the target number, dy is the drive number, and sz is the slice identifier. For SCSI drives, the drive number is the equivalent of the Logical Unit Number (LUN) of the drive.
Table 69 shows which interface to use for a few frequently used disk and file system commands.
Using Disks with Bus Controllers
Figure 15 shows the device-naming convention for SPARC disks with bus controllers.
Figure 16 shows naming conventions for IA disks with SCSI controllers.
Each file system on a disk is assigned to a slice—a group of cylinders set aside for use by that file system. To specify a slice (partition) on a disk with a bus controller (either SCSI or IPI), use a device name with these conventions: /dev/dsk/cWtXdYsZ (the block interface) or /dev/rdsk/cWtXdYsZ (the raw interface).
NOTE. Solaris disk device names use the term slice (and the letter s in the device name) to refer to the slice number. Slice is simply another name for a disk partition.
Use the following guidelines to determine the values for the device file name.
Table 71 shows some examples of raw device names for disks with bus-oriented controllers.
NOTE. In releases before the Solaris 7 Operating Environment, SCSI support on the Intel platform was handled by the cmdk driver. Starting with the Solaris 7 release, this support is handled by the sd driver. This driver is similar to the SCSI disk driver on Solaris SPARC platforms, which is also named sd.
There is no change in the administration of these devices. You will see references to sd instead of cmdk in the output of the prtconf, sysdef, dmesg, and format commands.
Features and functionality are a superset of the features supplied by cmdk, so applications that use logical disk names in /dev/dsk are not affected by the driver change. IA systems with IDE devices still use the cmdk driver.
Using Disks with Direct Controllers
Disks with direct controllers do not have a target entry as part of the device name. To specify a slice (partition) on a disk with a direct controller, use a device name with the following conventions: /dev/dsk/cXdYsZ (the block interface) or /dev/rdsk/cXdY s Z (the raw interface).
Figure 17 shows the naming convention for SPARC-based disks with direct controllers. If you have only one controller on your system, X is always 0. Slice 2 is a guide to the size of the entire disk.
Figure 18 shows the naming convention for IA-based disks with direct controllers.
Use slice 2 (s2) to specify the entire Solaris fdisk partition.
Setting Up Disk Slices
Files are stored within file systems. Each disk slice is treated as a separate disk drive both by the operating system and by the system administrator. When setting up slices, be aware of the following constraints.
You set up slices differently on SPARC and IA platforms, as described in Table 72.
SPARC Disk Slices
IA Disk Slices
On IA-based systems, you divide disks into fdisk partitions. Each fdisk partition is a section of the disk reserved for a particular operating environment. For a Solaris fdisk partition, you can define 10 slices, numbered from 0 through 9 and assign each to a conventional use. The uses for slices 0–2 and 5–7 are the same as on Solaris systems, described in Table 73. Table 74 describes slices 8 and 9.
Determining Which Slices to Use
When you set up file systems for a disk, you choose not only the size of each slice but also which slices to use. Your decisions depend on the configuration of the system and the software you want to install on the disk. System types are defined by how they access the root (/) and /usr file systems, including the swap area. For example, stand-alone and server systems mount these file systems from a local disk; other clients mount the file system remotely.
In previous releases, you could set up the following five system configurations.
With the Solaris 8 release, the system configurations are simplified to servers, stand-alone systems, and JavaStations. The JavaStation is a client designed for zero administration. It optimizes Java technology and takes full advantage of the network to deliver everything from Java applications and services to complete, integrated system and network management. You do no local administration for a JavaStation. The server handles booting, administration, and data storage.
Table 75 summarizes the three system types.
Disks and SMC
SMC provides two tools in the Storage category, described in Table 76, that you can use to display and format disks.
Disk Use Check (du)
To find the number of 512-byte disk blocks used per file or directory, type du and press Return. When directories contain subdirectories, the subdirectories and their contents are included in the block count, as shown in the following example.
oak% du 2913 ./3.0templates 639 ./Art 347 ./Howto 1998 ./Clipart 607 ./Newtemplates 38 ./Modemstuff 2004 ./Config/Art 6593 ./Config 13280 . oak%
The output is displayed in 512-byte blocks. To convert to megabytes, divide by 2048. In the preceding example, 13280/2048 = 6.48 Mbytes.
mopoke% du -h 2K ./.dt/sessionlogs 1K ./.dt/types/fp_dynamic 2K ./.dt/types 1K ./.dt/icons 1K ./.dt/appmanager 19K ./.dt/help/winsor-mopoke-0 20K ./.dt/help 11K ./.dt/sessions/current 17K ./.dt/sessions 1K ./.dt/tmp 1K ./.dt/Trash 1K ./.dt/Desktop 1K ./.dt/palettes 2K ./.dt/.Printers 56K ./.dt 1K ./.java/.userPrefs 2K ./.java 2K ./.solregis 17K ./.netscape/cache 1K ./.netscape/archive 1K ./.netscape/xover-cache/host-news 2K ./.netscape/xover-cache 331K ./.netscape 1K ./nsmail 1.1G . mopoke%
Disk Information Check (prtvtoc)
Use the prtvtoc (print volume table of contents) command to display information about disk partitioning. If you use the standard slice-naming conventions, specifying slice 2 displays the contents of the entire disk.
Use the following steps to display information about disk partitioning.
paperbark% su Password: # prtvtoc /dev/rdsk/c0t0d0s2 * /dev/rdsk/c0t0d0s2 partition map * * Dimensions: * 512 bytes/sector * 80 sectors/track * 19 tracks/cylinder * 1520 sectors/cylinder * 3500 cylinders * 2733 accessible cylinders * * Flags: * 1: unmountable * 10: read-only * * First Sector Last * Partition Tag Flags Sector Count Sector Mount Directory 0 2 00 1048800 2865200 3913999 / 1 3 01 0 1048800 1048799 2 5 00 0 4154160 4154159 7 8 00 3914000 240160 4154159 /export/home
The following sections describe the steps for repairing a bad disk or reinstalling a new one.
Try Archiving the Files
If you can access the drive, do a ufsdump of all the file systems on the disk. See "Backing Up and Restoring File Systems" on page 211 for information on how to use the ufsdump command.
Try Copying Data from the Disk
If you cannot run ufsdump on the disk, find another disk of the same type, connect it to the system, and use either the dd or volcopy commands to copy the data from the bad disk. See the dd(1M) and volcopy(1M) manual pages for complete information on how to use these commands.
The dd command makes a literal (block) copy of a complete UFS file system to another file system or to a tape. By default, the dd command copies its standard input to its standard output.
NOTE. Do not use the dd command with variable-length tape drives.
You can specify a device name in place of the standard input, the standard output, or both. The following example copies contents of a diskette to a file in the /tmp directory.
oak% dd < /floppy/floppy0 > /tmp/output.file 2400+0 records in 2400+0 records out oak%
The dd command reports on the number of blocks it reads and writes. The number after the + is a count of the partial blocks that were copied.
The dd command syntax is different from most other commands. You specify options as keyword=value pairs, where keyword is the option you want to set and value is the argument for that option. For example, you can replace the standard input and output with the following syntax.
dd if=input-file of=output-file
The following example uses the keyword=value pairs instead of the redirect symbols in the previous example.
oak% dd if=/floppy/floppy0 of=/tmp/output.file
Use the following steps to clone a disk with the dd command.
oak% su Password # dd < /floppy/floppy0 > /tmp/output.file # boot (Boot messages) # dd if=/dev/dsk/c0t0d0s2 of=/dev/dsk/c0t2d0s2 bs=100k # fsck /dev/rdsk/c0t2d0s2 # mount /dev/dsk/c0t2d0s2 /mnt # cd /mnt/etc # vi vfstab (Modify entries for the new disk) # cd / # umount /mnt # init 0 (Shutdown messages) # boot disk2 -s (Boot messages) # sys-unconfig # boot disk2
Try Repairing Any Bad Blocks
If the disk has bad blocks, you may be able to repair them with the format command. See the format(1M) manual page for more information.
Try Reformatting the Disk
If the disk is bad, reformatting it may fix the problem. Use the format command to reformat a disk. See the format(1M) manual page for more information.
CAUTION. Remember that formatting the disk destroys all data.
Replacing the Bad Disk
If reformatting and repairing bad blocks do not work, replace the disk. See the disk installation manual for more information.
Adding Defect List, Format, Partition, and Label Disk (format)
Use the following steps to put a defect list on a new disk and to format, partition, and label it.
CAUTION. You must format the disk after you add the defect list. Any data on the disk is destroyed by formatting. If the disk is not new, be sure the data is backed up before you proceed. See "Backing Up and Restoring File Systems" on page 211 for complete information on how to back up and restore file systems.
oak% su Password: # format Searching for disks...done AVAILABLE DISK SELECTIONS: 0. sd0 at esp0 slave 24 sd0: <SUN0207 cyl 1254 alt 2 hd 9 sec 36> 1. sd2 at esp0 slave 16 sd2: <SUN0207 cyl 1254 alt 2 hd 9 sec 36> Specify disk (enter its number): 1 selecting c0t0d0 [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 format > defect defect > primary Extracting primary defect list . . . Extraction complete. Current Defect List updated, total of 30 defects. defect > quit format > format format> partition PARTITION MENU: 0 - change '0' partition 1 - change '1' partition 2 - change '2' partition 3 - change '3' partition 4 - change '4' partition 5 - change '5' partition 6 - change '6' partition 7 - change '7' partition select - select a predefined table modify - modify a predefined partition table name - name the current table print - display the current table label - write partition map and label to the disk quit partition> <partition the disk> partition> label partition> quit format > quit #
Remaking the File Systems (newfs)
A disk must be formatted, partitioned, and labeled before you can create UFS file systems on it. If you are re-creating an existing UFS file system, unmount the file system before performing the following steps.
The following example creates a file system on /dev/rdsk/c0t3d0s7.
oak% su Password: # newfs /dev/rdsk/c0t3d0s7 newfs: construct a new file system /dev/rdsk/c0t3d0s7 (y/n)? y /dev/rdsk/c0t3d0s7: 163944 sectors in 506 cylinders of 9 tracks, 36 sectors 83.9MB in 32 cyl groups (16 c/g, 2.65MB/g, 1216 i/g) super-block backups (for fsck -b #) at: 32, 5264, 10496, 15728, 20960, 26192, 31424, 36656, 41888, 47120, 52352, 57584, 62816, 68048, 73280, 78512, 82976, 88208, 93440, 98672, 103904, 109136, 114368, 119600, 124832, 130064, 135296, 140528, 145760, 150992, 156224, 161456, #
Mounting the File System on a Temporary Mount Point (mount)
Type mount /dev/dsk/ cntndnsn /mnt and press Return. The file system is mounted on the /mnt temporary mount point. To mount the disk, specify the block device directory (/dev/dsk), not the raw device directory.
Restoring Files to the File System (ufsrestore)
Restore the contents of the latest full backup, and then restore subsequent incremental backups from lowest to highest level (ufsrestore), by using the following steps.
Unmounting the File System from Its Temporary Mount Point (umount)
Use the following steps to unmount the file system from its temporary mount point.
Checking the File System for Inconsistencies (fsck)
Type fsck /dev/rdsk/cntndnsn and press Return. The file system is checked for consistency.
Performing a Level 0 Backup of the Restored File System (ufsdump)
You always should do an immediate backup of a newly created file system because ufsrestore repositions the files and changes the inode allocation.
Use the following steps to perform a level 0 backup of the restored file system.
Mounting the File System at Its Permanent Mount Point (mount)
Type mount /dev/dsk/cntndnsn and press Return. The restored file system is mounted and available for use.
|[ Team LiB ]|