System Administration Guide: Devices and File Systems

Chapter 13 x86: Adding a Disk (Tasks)

This chapter describes how to add a disk to an x86 based system.

For information on the procedures associated with adding a disk to an x86 based system, see x86: Adding a System Disk or a Secondary Disk (Task Map).

For overview information about disk management, see Chapter 10, Managing Disks (Overview). For step-by-step instructions on adding a disk to a SPARC based system, see Chapter 12, SPARC: Adding a Disk (Tasks).

x86: Adding a System Disk or a Secondary Disk (Task Map)

The following task map identifies the procedures for adding a disk to an x86 based system.

Task 

Description 

For Instructions 

1. Connect the disk and boot. 

System Disk

Connect the new disk and boot from a local or remote Solaris CD or DVD.  

x86: How to Connect a System Disk

 

Secondary Disk

Connect the new disk and perform a reconfiguration boot so that the system will recognize the disk.  

x86: How to Connect a Secondary Disk and Boot

2. (Optional) Change the fdisk partition identifier.

The Solaris 10 fdisk partition identifier on x86 systems has been changed from 130 (0x82) to 191 (0xbf).

You can use a new fdisk menu option to switch back and forth between the new and old identifier.

How to Change the Solaris fdisk Identifier

3. Create slices and label the disk. 

Create disk slices and label the disk if the disk manufacturer has not already done so.  

x86: How to Create a Solaris fdisk Partition and x86: How to Create Disk Slices and Label a Disk

4. Create file systems. 

Create UFS file systems on the disk slices with the newfs command. You must create the root (/) or /usr file system (or both) for a system disk.

x86: How to Create File Systems

5. Restore file systems. 

Restore the root (/) or /usr file system (or both) on the system disk. If necessary, restore file systems on the secondary disk.

Chapter 27, Restoring UFS Files and File Systems (Tasks)

6. Install boot block. 

System Disk Only. Install the boot block on the root (/) file system so that the system can boot.

x86: How to Install a Boot Block on a System Disk

x86: Adding a System Disk or a Secondary Disk

A system disk contains the root (/) or /usr file systems, or both. If the disk that contains either of these file systems becomes damaged, you have two ways to recover:

A secondary disk doesn't contain the root (/) and /usr file systems. A secondary disk usually contains space for user files. You can add a secondary disk to a system for more disk space. Or, you can replace a damaged secondary disk. If you replace a secondary disk on a system, you can restore the old disk's data on the new disk.

Procedurex86: How to Connect a System Disk

This procedure assumes that the operating system is shutdown.

  1. Disconnect the damaged system disk from the system.

  2. Ensure that the disk you are adding has a different target number than the other devices on the system.

    Typically, a small switch is located at the back of the disk for this purpose.

  3. Connect the replacement system disk to the system, and check the physical connections.

    Refer to the disk's hardware installation guide for details.

  4. Boot the system.

    This procedure assumes that you are booting from GRUB's Solaris failsafe boot option.

    1. Press any key to reboot the system if the system displays the Press any key to reboot prompt. Or, use the reset button to restart the system if the system is shut down.

      The GRUB menu is displayed after a few minutes.

    2. Use the arrow keys to select the Solaris failsafe boot option.

    3. Press return.

    4. At the Do you wish to automatically update boot archives? prompt answer no.

      The root prompt (#) is displayed.


      Note –

      You must reboot the system when you want to exit Solaris failsafe boot mode. You cannot reboot the system to multiuser mode until the system disk is successfully added, the data is restored, and the bootblocks are installed.


After You Connect a System Disk ...

You can create an fdisk partition if the disk is less than 1 terabyte size. Go to x86: How to Create a Solaris fdisk Partition.

Changing the fdisk Partition Identifier

The Solaris fdisk partition identifier on x86 systems has been changed from 130 (0x82) to 191 (0xbf). All Solaris commands, utilities, and drivers have been updated to work with either fdisk identifier. There is no change in fdisk functionality.

ProcedureHow to Change the Solaris fdisk Identifier

A new fdisk menu option enables you to switch back and forth between the new and old identifier. The fdisk identifier can be changed even when the file system that is contained in the partition is mounted.

Two type values in the fdisk menu reflect the old and new identifiers as follows:

  1. Become superuser.

  2. Display the current fdisk identifier.

    For example:


                Total disk size is 39890 cylinders
                Cylinder size is 4032 (512 byte) blocks
    
                                                  Cylinders
         Partition   Status    Type          Start   End   Length    %
         =========   ======    ============  =====   ===   ======   ===
             1       Active    x86 Boot          1     6       6      0
             2                 Solaris2          7  39889    39883    100
  3. Select option 4 from the fdisk menu to change the fdisk partition identifier back to 0x82


    SELECT ONE OF THE FOLLOWING:
      1. Create a partition
      2. Specify the active partition
      3. Delete a partition
      4. Change between Solaris and Solaris2 Partition IDs
      5. Exit (update disk configuration and exit)
      6. Cancel (exit without updating disk configuration)
    Enter Selection: 4
    
  4. Select option 5 to update your disk configuration and exit.

  5. If necessary, select option 4 from the fdisk menu to change the fdisk partition identifier back to 0xbf.

    For example:


    Total disk size is 39890 cylinders
                Cylinder size is 4032 (512 byte) blocks
    
                                                  Cylinders
         Partition   Status    Type          Start   End   Length    %
         =========   ======    ============  =====   ===   ======   ===
             1       Active    x86 Boot          1     6       6      0
             2                 Solaris           7  39889    39883    100
    
    SELECT ONE OF THE FOLLOWING:
      1. Create a partition
      2. Specify the active partition
      3. Delete a partition
      4. Change between Solaris and Solaris2 Partition IDs
      5. Exit (update disk configuration and exit)
      6. Cancel (exit without updating disk configuration)
    Enter Selection: 4
    
  6. Select option 5 to update your disk configuration and exit.

Procedurex86: How to Connect a Secondary Disk and Boot

If you are adding a disk with an EFI disk label on an x64 system, see EFI Disk Label for more information.

For more information about hot-plugging devices, see Chapter 6, Dynamically Configuring Devices (Tasks).

  1. Become superuser or assume an equivalent role.

  2. (Optional) If the disk is unsupported by the Solaris software, add the device driver for the disk by following the instructions included with the hardware.

  3. Shut down the system.


    # shutdown -i0 -gn -y
    
    -i0

    Brings the system down to run level 0, the power-down state.

    -gn

    Notifies logged-in users that they have n seconds before the system begins to shut down.

    -y

    Specifies that the command should run without user intervention.

    The Press any key to reboot prompt is displayed.

  4. Turn off the power to the system and all external peripheral devices.

  5. Ensure that the disk you are adding has a different target number than the other devices on the system.

    Typically, a small switch is located at the back of the disk for this purpose.

  6. Connect the disk to the system and check the physical connections.

    Refer to the disk's hardware installation guide for details.

  7. Turn on the power to all external peripheral devices.

  8. Turn on the power to the system.

    The system boots and displays the login prompt.

After You Connect a Secondary Disk and Boot ...

After the system is booted, you can create an fdisk partition if the disk is less than 1 terabyte in size. Go to x86: How to Create a Solaris fdisk Partition.

x86: Guidelines for Creating an fdisk Partition

Follow these guidelines when you set up one or more fdisk partitions.


x86 only –

Solaris slices are also called partitions. Certain interfaces might refer to a slice as a partition.

fdisk partitions are supported only on x86 based systems. To avoid confusion, Solaris documentation tries to distinguish between fdisk partitions and the entities within the Solaris fdisk partition. These entities might be called slices or partitions.


Procedurex86: How to Create a Solaris fdisk Partition

Before You Begin

If you need information about fdisk partitions, see x86: Guidelines for Creating an fdisk Partition.

  1. Become superuser or assume an equivalent role.

  2. Invoke the format utility.


    # format
    

    A numbered list of disks is displayed.

    For more information, see format(1M).

  3. Type the number of the disk on which to create a Solaris fdisk partition.


    Specify disk (enter its number): disk-number
    

    where disk-number is the number of the disk on which you want to create a Solaris fdisk partition.

  4. Select the fdisk menu.


    format> fdisk
    

    The fdisk menu that is displayed depends upon whether the disk has existing fdisk partitions. Determine the next step by using the following table.

    Task 

    Go To 

    For More Information 

    Create a Solaris fdisk partition to span the entire disk.

    Step 5 

    Example 13–1

    Create a Solaris fdisk partition and preserve one or more existing non Solaris fdisk partitions.

    Step 6 

    Example 13–2

    Create a Solaris fdisk partition and one or more additional non Solaris fdisk partition.

    Step 6 

    Example 13–3

  5. Create and activate a Solaris fdisk partition that spans the entire disk by specifying y at the prompt. Then, go to step 13.


    No fdisk table exists. The default partition for the disk is:
    
    a 100% "SOLARIS System" partition
    
    Type "y" to accept the default partition, otherwise type "n" to edit the
    partition table.
    y
    
  6. Specify n at the prompt if you do not want the Solaris fdisk partition to span the entire disk.


    Type "y" to accept the default partition, otherwise type "n" to edit the
     partition table.
    n
                 Total disk size is 3498 cylinders
                 Cylinder size is 1199 (512 byte) blocks
                                             Cylinders
        Partition   Status    Type      Start   End   Length    %
        =========   ======    ========  =====   ===   ======   ===
    SELECT ONE OF THE FOLLOWING:
         
      1. Create a partition
      2. Specify the active partition
      3. Delete a partition
      4. Change between Solaris and Solaris2 Partition IDs
      5. Exit (update disk configuration and exit)
      6. Cancel (exit without updating disk configuration)
    Enter Selection:
  7. Select option 1, Create a partition, to create an fdisk partition.


    Enter Selection: 1
    
  8. Create a Solaris fdisk partition by selecting 1(=Solaris2).


    Indicate the type of partition you want to create
      1=SOLARIS2   2=UNIX        3=PCIXOS     4=Other
      5=DOS12      6=DOS16       7=DOSEXT     8=DOSBIG
      9=DOS16LBA   A=x86 Boot    B=Diagnostic C=FAT32
      D=FAT32LBA   E=DOSEXTLBA   F=EFI        0=Exit? 1
    
  9. Identify the percentage of the disk to be reserved for the Solaris fdisk partition. Keep in mind the size of any existing fdisk partitions when you calculate this percentage.


    Specify the percentage of disk to use for this partition
    (or type "c" to specify the size in cylinders). nn
    
  10. Activate the Solaris fdisk partition by typing y at the prompt.


    Should this to become the active partition? If yes, it will be 
    activated each time the computer is reset or turned on.
    Please type "y" or "n". y
    

    The Enter Selection prompt is displayed after the fdisk partition is activated.

  11. Select option 1, Create a partition, to create another fdisk partition.

    See steps 8–10 for instructions on creating an fdisk partition.

  12. Update the disk configuration, and exit the fdisk menu from the selection menu.


    Selection: 5 
    
  13. Relabel the disk by using the label command.


    format> label
    Ready to label disk, continue? yes
    format> 
  14. Quit the format utility.


    format> quit
    

Example 13–1 x86: Creating a Solaris fdisk Partition That Spans the Entire Drive

The following example uses the format utility's fdisk option to create a Solaris fdisk partition that spans the entire drive.


# format
Searching for disks...done
AVAILABLE DISK SELECTIONS:
       0. c0d0 <DEFAULT cyl 2466 alt 2 hd 16 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@0,0
       1. c0d1 <DEFAULT cyl 522 alt 2 hd 32 sec 63>
          /pci@0,0/pci-ide@7,1/ide@0/cmdk@1,0
       2. c1d0 <DEFAULT cyl 13102 alt 2 hd 16 sec 63>
          /pci@0,0/pci-ide@7,1/ide@1/cmdk@0,0
Specify disk (enter its number): 0
selecting c0d0
Controller working list found
[disk formatted]
format> fdisk
No fdisk table exists. The default partitioning for your disk is:
 
  a 100% "SOLARIS System" partition.
 
Type "y" to accept the default partition, otherwise type "n" to edit the
partition table. y

format> label
Ready to label disk, continue? yes
format> quit


Example 13–2 x86: Creating a Solaris fdisk Partition While Preserving an Existing fdisk Partition

The following example shows how to create a Solaris fdisk partition on a disk that has an existing DOS-BIG fdisk partition.


format> fdisk
             Total disk size is 3498 cylinders
             Cylinder size is 1199 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1       Active    DOS-BIG           1   699     699     20
SELECT ONE OF THE FOLLOWING:
  1. Create a partition
  2. Specify the active partition
  3. Delete a partition
  4. Change between Solaris and Solaris2 Partition IDs
  5. Exit (update disk configuration and exit)
  6. Cancel (exit without updating disk configuration)  
Enter Selection: 1
Indicate the type of partition you want to create
  1=SOLARIS2  2=UNIX        3=PCIXOS     4=Other
  5=DOS12     6=DOS16       7=DOSEXT     8=DOSBIG
  9=DOS16LBA  A=x86 Boot    B=Diagnostic C=FAT32
  D=FAT32LBA  E=DOSEXTLBA   F=EFI        0=Exit?1
Indicate the percentage of the disk you want this partition
to use (or enter "c" to specify in cylinders). 80
Should this become the active partition? If yes, it will be 
activated each time the computer is or turned on. 
Please type "y" or "n". y
             Total disk size is 3498 cylinders
             Cylinder size is 1199 (512 byte) blocks
                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1                 DOS-BIG           1   699     699     20
          2       Active    Solaris2        700  3497    2798     80
    
SELECT ONE OF THE FOLLOWING:
  1. Create a partition
  2. Specify the active partition
  3. Delete a partition
  4. Change between Solaris and Solaris2 Partition IDs
  5. Exit (update disk configuration and exit)
  6. Cancel (exit without updating disk configuration)   
Enter Selection:5
Partition 2 is now the active partition 
format> label
Ready to label disk, continue? yes
format> q


Example 13–3 x86: Creating a Solaris fdisk Partition and an Additional fdisk Partition

This following example shows how to create a Solaris fdisk partition and a DOSBIG fdisk partition.


format> fdisk
No fdisk table exists. The default partitioning for your disk is:
   a 100% "SOLARIS System" partition.
Type "y" to accept the default partition, otherwise type "n" to edit the
partition table.
n
             Total disk size is 3498 cylinders
             Cylinder size is 1199 (512 byte) blocks
                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
SELECT ONE OF THE FOLLOWING:
  1. Create a partition
  2. Specify the active partition
  3. Delete a partition
  4. Change between Solaris and Solaris2 Partition IDs
  5. Exit (update disk configuration and exit)
  6. Cancel (exit without updating disk configuration)  
Enter Selection: 1
Indicate the type of partition you want to create
1=SOLARIS2   2=UNIX        3=PCIXOS     4=Other
5=DOS12      6=DOS16       7=DOSEXT     8=DOSBIG
9=DOS16LBA   A=x86 Boot    B=Diagnostic C=FAT32
D=FAT32LBA   E=DOSEXTLBA   F=EFI        0=Exit?  8
Specify the percentage of disk to use for this partition
(or type "c" to specify the size in cylinders)20
Should this to become the Active partition? If yes, it will be 
activated each time the computer is reset or turned on. 
again. Please type "y" or "n". n
             Total disk size is 3498 cylinders
             Cylinder size is 1199 (512 byte) blocks
                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1                 DOS-BIG           1   699     699     20
  SELECT ONE OF THE FOLLOWING:
  1. Create a partition
  2. Specify the active partition
  3. Delete a partition
  4. Change between Solaris and Solaris2 Partition IDs
  5. Exit (update disk configuration and exit)
  6. Cancel (exit without updating disk configuration)  
Enter Selection: 1
Indicate the type of partition you want to create
1=SOLARIS2   2=UNIX        3=PCIXOS     4=Other
5=DOS12      6=DOS16       7=DOSEXT     8=DOSBIG
9=DOS16LBA   A=x86 Boot    B=Diagnostic C=FAT32
D=FAT32LBA   E=DOSEXTLBA   F=EFI        0=Exit? 1
Indicate the percentage of the disk you want this partition
to use (or enter "c" to specify in cylinders). 80
Should this become the active partition? If yes, it will be 
activated each time the computer is reset or turned on.
Please type "y" or "n". y
             Total disk size is 3498 cylinders
             Cylinder size is 1199 (512 byte) blocks
                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1                 DOS-BIG           1   699     699     20
          2       Active    Solaris2         700  3497    2798     80
SELECT ONE OF THE FOLLOWING:
  1. Create a partition
  2. Specify the active partition
  3. Delete a partition
  4. Change between Solaris and Solaris2 Partition IDs
  5. Exit (update disk configuration and exit)
  6. Cancel (exit without updating disk configuration)  
Enter Selection: 5
Partition 2 is now the Active partition 
format> q

After You Create a Solaris fdisk Partition ...

After you create a Solaris fdisk partition on the disk, you can create slices on the disk. Go to x86: How to Create Disk Slices and Label a Disk

Procedurex86: How to Create Disk Slices and Label a Disk

  1. Become superuser or assume an equivalent role.

  2. Invoke the format utility.


    # format
    

    A numbered list of disks is displayed.

  3. Type the number of the disk that you want to repartition.


    Specify disk (enter its number): disk-number
    

    where disk-number is the number of the disk that you want to repartition.

  4. Select the partition menu.


    format> partition
    
  5. Display the current partition (slice) table.


    partition> print
    
  6. Start the modification process.


    partition> modify
    
  7. Set the disk to all free hog.


    Choose base (enter number) [0]? 1
    

    For more information about the free hog slice, see Using the Free Hog Slice.

  8. Create a new partition table by answering yes when prompted to continue.


    Do you wish to continue creating a new partition
    table based on above table[yes]? yes
    
  9. Identify the free hog partition (slice) and the sizes of the slices when prompted.

    When adding a system disk, you must set up slices for the following:

    • root (slice 0) and swap (slice 1) and/or

    • /usr (slice 6)

    After you identify the slices, the new partition table is displayed.

  10. Make the displayed partition table the current partition table by answering yes when prompted.


    Okay to make this the current partition table[yes]? yes
    

    If you don't want the current partition table and you want to change it, answer no and go to Step 6.

  11. Name the partition table.


    Enter table name (remember quotes): "partition-name"
    

    where partition-name is the name for the new partition table.

  12. Label the disk with the new partition table after you have finished allocating slices on the new disk.


    Ready to label disk, continue? yes
    
  13. Quit the partition menu.


    partition> quit
    
  14. Verify the new disk label.


    format> verify
    
  15. Exit the format utility.


    format> quit
    
After You Create Disk Slices and Label a Disk ...

After you create disk slices and label the disk, you can create file systems on the disk. Go to x86: How to Create File Systems.

Procedurex86: How to Create File Systems

  1. Become superuser or assume an equivalent role.

  2. Create a file system for each slice.


    # newfs /dev/rdsk/cwtxdysz
    

    where /dev/rdsk/cwtxdysz is the raw device for the file system to be created.

    For more information about the newfs command, see Chapter 18, Creating UFS, TMPFS, and LOFS File Systems (Tasks) or newfs(1M).

  3. Verify the new file system by mounting.


    # mount /dev/dsk/cwtxdysz /mnt
    # ls /mnt
    lost+found
After You Create File Systems ...

Procedurex86: How to Install a Boot Block on a System Disk

  1. Become superuser or assume an equivalent role.

  2. Install the boot blocks on the system disk.


    # /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/cwtxdysz
    
    /boot/grub/stage1

    Is the partition boot file.

    /boot/grub/stage2

    Is the boot block code.

    /dev/rdsk/cwtxdysz

    Is the raw device name that represents the location of the GRUB menu, /boot/grub/menu.lst on the Solaris root slice.

    For more information, see installgrub(1M).

  3. Verify that the boot blocks are installed by rebooting the system to run level 3.


    # init 6
    

Example 13–4 x86: Installing a Boot Block on a System Disk

The following example shows how to install the boot blocks on an x86 system.


# /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c1d0s0
stage1 written to partition 0 sector 0 (abs 2016)
stage2 written to to partition 0, 227 sectors starting 50 (abs 2066)