Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
32.  Administering Disks (Tasks) Displaying Disk Slices How to Display Disk Slice Information Examples--Displaying Disk Slice Information  Previous   Contents   Next 
   
 

Creating and Examining a Disk Label

The labeling of a disk is usually done during system installation or when you are creating new disk slices. You might need to relabel a disk if the disk label becomes corrupted (for example, from a power failure).

The format utility attempts to automatically configure any unlabeled SCSI disk. If the format utility is able to automatically configure an unlabeled disk, it displays a message like the following:

	c1t0d0:configured with capacity of 404.65MB

Tip - For information on labeling multiple disks with the same disk label, see "Label Multiple Disks by Using the prtvtoc and fmthard Commands".


How to Label a Disk

  1. Become superuser or assume an equivalent role.

  2. Invoke the format utility.

    # format
  3. Type the number of the disk that you want to label from the list displayed on your screen.

    Specify disk (enter its number):1
  4. Select one of the following.

    1. If the disk is unlabeled and was successfully configured, go to step 5 to label the disk.

      The format utility will ask if you want to label the disk.

    2. If the disk is labeled and you want to change the disk type, or if the format utility was not able to automatically configure the disk, follow steps 6-7 to set the disk type and label the disk.

  5. Label the disk by typing y at the Label it now? prompt.

    Disk not labeled. Label it now? y

    The disk is now labeled. Go to step 10 to exit the format utility.

  6. Enter type at the format> prompt.

    format> type

    The Available Drive Types menu is displayed.

  7. Select a disk type from the list of possible disk types.

    Specify disk type (enter its number)[12]: 12

    Or, select 0 to automatically configure a SCSI-2 disk. For more information, see "How to Automatically Configure a SCSI Drive".

  8. Label the disk. If the disk is not labeled, the following message is displayed.

    Disk not labeled. Label it now? y

    Otherwise, you are prompted with this message:

    Ready to label disk, continue? y
  9. Verify the disk label.

    format> verify 
  10. Exit the format utility.

    partition> q
    format> q
    #

Example--Labeling a Disk

The following example shows how to automatically configure and label a 1.05-Gbyte disk.

# format
	c1t0d0: configured with capacity of 1002.09MB
 
AVAILABLE DISK SELECTIONS:
	  0. c0t3d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
     /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@1,0
	  1. c1t0d0 <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
     /iommu@f,e0000000/sbus@f,e0001000/espdma@f,400000/esp@f,800000/sd@1,0
Specify disk (enter its number): 1
Disk not labeled.  Label it now?  yes
format> verify
#

How to Examine a Disk Label

Examine disk label information by using the prtvtoc command. For a detailed description of the disk label and the information that is displayed by the prtvtoc command, see Chapter 31, Managing Disks (Overview).

  1. Become superuser or assume an equivalent role.

  2. Display the disk label information.

    # prtvtoc /dev/rdsk/device-name

    device-name is the raw disk device you want to examine.

Example--Examining a Disk Label

The following example shows the disk label information for disk /dev/rdsk/c0t1d0s0.

# prtvtoc /dev/rdsk/c0t1d0s0
* /dev/rdsk/c0t1d0s0 partition map
*
* Dimensions:
*     512 bytes/sector
*      72 sectors/track
*      14 tracks/cylinder
*    1008 sectors/cylinder
*    2038 cylinders
*    2036 accessible cylinders
*
* Flags:
*   1: unmountable
*  10: read-only
*
*                          First     Sector    Last
* Partition  Tag  Flags    Sector     Count    Sector  Mount Directory
       0      2    00          0    303408    303407   /
       1      3    01     303408    225792    529199
       2      5    00          0   2052288   2052287
       6      4    00     529200   1523088   2052287   /usr
#

Recovering a Corrupted Disk Label

Sometimes, a power or system failure causes a disk's label to become unrecognizable. A corrupted disk label doesn't always mean that the slice information or the disk's data must be recreated or restored.

The first step to recovering a corrupted disk label is to label the disk with the correct geometry and disk type information. You can complete this step through the normal disk labeling method, by using either automatic configuration or manual disk type specification.

If the format utility recognizes the disk type, the next step is to search for a backup label to label the disk. Labeling the disk with the backup label labels the disk with the correct partitioning information, the disk type, and disk geometry.

How to Recover a Corrupted Disk Label

  1. Boot the system to single-user mode.

    If necessary, boot the system from a local CD-ROM or the network in single-user mode to access the disk.

    See Chapter 13, SPARC: Booting a System (Tasks) or Chapter 14, IA: Booting a System (Tasks) for information on booting the system.

  2. Relabel the disk.

    # format

    At this point, the format utility attempts to automatically configure any unlabeled SCSI disk. If the format utility is able to configure the unlabeled and corrupted disk, it will display:

    cwtxdy: configured with capacity of abcMB

    The format utility then displays the list of disks on the system.

  3. Type the number of the disk that you need to recover from the list displayed on your screen.

    Specify disk (enter its number): 1
  4. Select one of the following to determine how to label the disk.

    1. If the disk was configured successfully, follow steps 5 and 6. Then go to step 12.

    2. If the disk was not configured successfully, follow steps 7-11. Then go to step 12.

  5. Search for the backup label.

    format> verify
    Warning: Could not read primary label.
    Warning: Check the current partitioning and 'label' the disk or 
    use the 'backup' command.
    Backup label contents:
    Volume name = <        >
    ascii name  = <SUN1.05 cyl 2036 alt 2 hd 14 sec 72>
    pcyl        = 2038
    ncyl        = 2036
    acyl        =    2
    nhead       =   14
    nsect       =   72
    Part      Tag    Flag     Cylinders        Size            Blocks
      0       root    wm       0 -  300      148.15MB    (301/0/0)   303408
      1       swap    wu     301 -  524      110.25MB    (224/0/0)   225792
      2     backup    wm       0 - 2035     1002.09MB    (2036/0/0) 2052288
      3 unassigned    wm       0               0         (0/0/0)          0
      4 unassigned    wm       0               0         (0/0/0)          0
      5 unassigned    wm       0               0         (0/0/0)          0
      6        usr    wm     525 - 2035      743.70MB    (1511/0/0) 1523088
      7 unassigned    wm       0               0         (0/0/0)          0
  6. If the format utility was able to find a backup label and the backup label contents appear satisfactory, use the backup command to label the disk with the backup label.

    format> backup
    Disk has a primary label, still continue? y
     
    Searching for backup labels...found.
    Restoring primary label

    The disk label has been recovered. Go to step 12.

  7. If the format utility was not able to automatically configure the disk, specify the disk type by using the type command.

    format> type

    The Available Drives Type menu is displayed.

  8. Select 0 to automatically configure the disk, or select a disk type from the list of possible disk types.

    Specify disk type (enter its number)[12]: 12
  9. If the disk was successfully configured, reply with no when the format utility asks if you want to label the disk.

    Disk not labeled.  Label it now?  no
  10. Use the verify command to search for backup labels.

    format> verify
    Warning: Could not read primary label.
    Warning: Check the current partitioning and 'label' the disk
    or use the 'backup' command.
    .
    .
    .
  11. If the format utility was able to find a backup label and the backup label contents appear satisfactory, use the backup command to label the disk with the backup label.

    format> backup
    Disk has a primary label, still continue? y
    Searching for backup labels...found.
    Restoring primary label

    The disk label has been recovered.

  12. Exit the format utility.

    format> q
  13. Verify the file systems on the recovered disk by using the fsck command.

    For information on using the fsck command, see Chapter 42, Checking UFS File System Consistency (Tasks).

 
 
 
  Previous   Contents   Next