|
| 以 PDF 格式下载本书
Preparing Media
7
- To prepare a disk drive, you must:
-
- Format a disk
- Partition a disk
- Label a disk
- Create a file system
- Mount a file system
- These tasks are described in the following sections.
Autoconfiguration and the format Utility
- With the format utility you can format, partition, and label a disk. You can also detect and repair bad blocks on a disk.
- If Solaris 2.3.2 system software (or a higher release) is resident on your system, the format utility can automatically configure SCSI disk drives and label them, even if that specific type of drive was not previously described in the /etc/format.dat file. This enables you to format, partition, and label any disk drive compliant with SCSI-2 without having to edit the /etc/format.dat file.
- The format utility performs autoconfiguration by first checking if there is a /etc/format.dat entry that matches the product name it detects for the drive. If the file lacks that information, format will determine the disk's geometry and capacity by issuing SCSI commands to the disk.
- Autoconfiguration will take place at start-up time for a SCSI disk that is not already labeled. You will be prompted for permission to write that label to the disk.
- Also, you can use the format utility to autoconfigure a disk at any time. In that case, when you enter type at the format> prompt, you can enter 0 as the disk type value to specify autoconfiguration.
- In short, if you have Solaris 2.3.2 or a later version of the system software, you can use the procedure in the following section even if your SCSI drive is not already listed in the /etc/format.dat file.
Formatting a Disk
- Formatting your disk drive is optional, because many hard disks have already been formatted at the factory.
-
Note - You must be in superuser mode to use the format utility.
-
-
Type format at the root prompt.
-
-
Select the disk that you want to format from the list displayed on your screen.
If the disks have already been labeled, the system displays the following information.
-
Searching for disks...done
AVAILABLE DISK SELECTIONS:
0. c0t3d0 <SUN0207 cyl 1214 alt 2 hd 9 sec 36>
/sbus@1,f8000000/esp@0,8000000/sd@3,0
1. c0t0d0 <SUN0207 cyl 1214 alt 2 hd 9 sec 36>
/sbus@1,f8000000/esp@0,8000000/sd@0,0
2. c1t1d0 <SUN0207 cyl 1214 alt 2 hd 9 sec 36>
/sbus@1,f8000000/esp@0,8000000/sd@1,0
3. c1t2d0 <SUN0207 cyl 1214 alt 2 hd 9 sec 36>
/sbus@1,f8000000/esp@0,8000000/sd@2,0
Specify disk (enter its number):2
|
- In this example disk drives 2 and 3 have been added. Drive 2 with address c1t1d0 is the first external hard disk that is connected to a SCSI card. Drive 3, with address c1t2d0, is the second external hard disk that is connected to a SCSI card. After you have completed formatting the first external hard disk, you can format the second external hard disk that is connected to the SCSI card.
-
Caution - Do not select item 0, the system disk. Formatting your system disk deletes your operating system and any data that you may have on this disk.
- If the Solaris operating system is unable to find a valid label on drive 2 with address c1t1d0, the following is displayed:
-
Searching for disks...done
c1t1d0: configured with capacity of 198 MB
AVAILABLE DISK SELECTIONS:
0. c0t3d0 <SUN0207 cyl 1214 alt 2 hd 9 sec 36>
/sbus@1,f8000000/esp@0,8000000/sd@3,0
1. c0t0d0 <SUN0207 cyl 1214 alt 2 hd 9 sec 36>
/sbus@1,f8000000/esp@0,8000000/sd@0,0
2. c1t1d0 <SUN0207 cyl 1214 alt 2 hd 9 sec 36>
/sbus@1,f8000000/esp@0,8000000/sd@1,0
3. c1t2d0 <SUN0207 cyl 1214 alt 2 hd 9 sec 36>
/sbus@1,f8000000/esp@0,8000000/sd@2,0
Specify disk (enter its number):2
Selecting c1t1d0
[disk formatted]
Disk not labeled. Label it now? y
|
- The configured with capacity message and the Label it now? prompt are displayed for a disk without a valid label or for a new, unlabeled disk.
- If you already know that the disk drive you are adding has a SCSI interface, go to Step 8.
-
-
Type defect at the format> prompt.
The Defect menu entries that are displayed depend on the type of disk drive that you are trying to format. The menu that your system displays can differ from the one below.
-
format> defect
DEFECT MENU:
primary - extract manufacturer's defect list
print - display working list
dump - dump working list to file
commit - set current list = working list
quit
defect>
|
-
-
Read the Defect menu.
If your disk drive has a SCSI interface, the commit option is not displayed. If this is the case, go to Step 7.
-
At the defect> prompt, type primary.
-
defect> primary
Extracting manufacturer's defect list ... Extraction complete.
Current Defect List updated, total of 20 defects.
|
-
-
Type commit and confirm your choice by typing y.
-
defect> commit
Ready to update Current Defect List, continue? y
Current Defect List updated, total of 20 defects.
Disk must be reformatted for changes to take effect.
|
-
-
Type quit to leave the Defect menu.
-
-
-
At the format> prompt, type format, and confirm the command by typing y.
-
format> format
Ready to format. Formatting cannot be interrupted.
Continue? y
Beginning format. The current time is Fri Sept 11 14:56:51 1993
Formatting ...
done
Verifying media ...
pass 0 - pattern = 0xc6dec6de
pass 1 - pattern = 0x6db6db6d
total of 0 defective blocks repaired.
format>
|
Partitioning a Disk
-
-
Type partition at the format prompt.
The following menu is displayed.
-
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>
|
-
-
Select modify.
The following menu is displayed.
-
Select partitioning base:
0. Default partition for selected drive
1. Current partition table (original sd3)
2. All Free Hog
Choose base (enter number) [0]?
|
-
-
Select 0.
The following message is displayed:
-
Part Tag Flag Cylinders Size Blocks
0 - - 0 - 505 80.05MB (506/0/0)
1 - - 506 - 568 9.97MB (63/0/0)
2 - - 0 - 1253 198.39MB (1254/0/0)
3 - - 0 0 (0/0/0)
4 - - 0 0 (0/0/0)
5 - - 0 0 (0/0/0)
6 - - 569 - 937 58.38MB (369/0/0)
7 - - 938 - 1253 49.99MB (316/0/0)
Do you wish to continue creating a new partition
table based on above table[yes]?
|
-
-
Type y if you wish to change the size of any of the partitions. The following message is displayed:
-
-
-
Select one of the 8 partitions as a "free hog" partition.
This partition cannot be set to 0. In this example, you can use partition 6 as the free hog partition. Do not use partition 2. The following menu is displayed:
-
Enter size of partition '0' [163944b, 506c, 80.05mb]: 0
Enter size of partition '1' [20412b, 63c, 9.97mb]: 0
Enter size of partition '3' [0b, 0c, 0.00mb]: 0
Enter size of partition '4' [0b, 0c, 0.00mb]: 0
Enter size of partition '5' [0b, 0c, 0.00mb]: 0
Enter size of partition '7' [102384b, 316c, 49.99mb]: 80mb
|
- When you use the format utility to change the size of one or more disk partitions, you must designate a temporary partition that can expand and shrink to accommodate the resizing operations. This partition donates or frees space when you expand a partition, and receives or hogs the discarded space when you shrink a partition.
- For this reason, the donor partition is sometimes called the free hog. The donor partition exists only during installation or whenever you execute the format utility. There is no permanent donor partition during day-to-day operations.
-
-
Specify the size of each partition in megabytes by changing any of the displayed sizes.
In this example, the sizes have been changed as displayed:
-
Part Tag Flag Cylinders Size Blocks
0 - - 0 0 (0/0/0)
1 - - 0 0 (0/0/0)
2 - - 0 - 1253 198.39MB (1254/0/0)
3 - - 0 0 (0/0/0)
4 - - 0 0 (0/0/0)
5 - - 0 0 (0/0/0)
6 - - 0 - 747 118.34MB (748/0/0)
7 - - 748 - 1253 80.05MB (506/0/0)
Okay to make this the current partition table [yes]?
|
-
Caution - Partition 2 should never be changed. Reducing the size of partition 2 decreases available disk space.
-
-
Type y to confirm.
The following message is displayed.
-
Enter table name (remember quotes):
|
-
-
Assign a name to this newly created table.
-
Type the new name of the partition table and press Return.
- You are now ready to label your disk.
Labeling a Disk
- To label a disk means to write back to disk the information in the partition table that you have just finished modifying.
-
Note - If you fail to label a disk after you finish partitioning, the operating system will be unable to "know" anything about the partitions that you just created or any changes that you have made.
-
-
Type label at the partition> or format> prompt. The following menu is displayed:
-
-
-
Type y and press Return.
-
Type q.
-
Type q again.
Creating a File System
- You need to create a file system for a partition only when you have:
-
- Added or replaced a disk drive
- Changed the existing partitioning structure
- You must know the device address of the disk drive and partition for which you want to create a file system.
-
Note - The disk for which you plan to create a file system must have already been formatted and partitioned. Be sure that you are in superuser mode before you start to create a file system.
-
-
Type
-
# newfs /dev/rdsk/cxtxdxsx
|
-
Caution - Make sure that you have specified the correct device name for the partition before you create a file system for the next partition. If you specify the wrong partition, you erase the contents of the partition that you specified.
-
-
Press Return.
The operating system asks for confirmation.
-
newfs: construct a new file system /dev/rdsk/cxtxdxsx (y/n)?
|
-
-
Type y to confirm.
Mounting a File System
-
-
Edit the /etc/vfstab file with vi or any text editor.
a. Add the entry by separating each field with a space or a tab. If a field has no entry, enter a dash (-).
b. Save the /etc/vfstab file with the modifications.
-
Note - For more information about writing entries in the /etc/vfstab file, see the man page for vfstab(4) and the File System Administration manual.
-
-
Verify that a mount point directory has been created.
If it does not exist, create it now with the mkdir command.
-
# mkdir /mount_point_directory
|
-
Note - The mount point directory must have been created before you can mount any file system on it.
-
-
Type
-
# mount /dev/dsk/cxtxdxsx /mount_point_directory
|
- Or, if the entry for this file system has already been made in the /etc/vfstab file, type
-
# mount /mount_point_directory
|
- You also can use the mountall(1M) command at this point.
iv>
Displaying Already Mounted File Systems
- It often is helpful to display file systems that have already been mounted.
-
* Type mount and press Return. A list of the currently mounted file systems is displayed.
- You will probably use the ufsdump command to perform periodic backups of either individual files or entire file systems. For a complete explanation of each command, options, and arguments, refer to the Routine System Administration Guide and to the specific man pages for each command.
|
|