2.3 增加硬盘
将硬盘正确的连接到主机系统上,并且连接硬盘的适配器(或者通道或者卡)的驱动程序已经正确安装,则操作系统在启动的时候能够正确的检测到硬盘,并由VTOC驱动程序创建了21个与slice对应的设备文件/dev/[r]dsk/cXbXtXdXp0-4和/dev/[r]dsk/cXbXtXdXs0-f,只有发现系统正确的检测到了硬盘时我们才能够通过命令diskadd增加硬盘,否则无法进行。举个例子,在我们的学习环境中,磁盘阵列柜是通过SCSI Ultra29160卡连接到主机上的,如果在UnixWare7.1.x操作系统中没有正确的安装此SCSI卡的驱动程序,将无法进行增加硬盘,因为系统根本无法在启动时自动检测到该磁盘阵列柜并为其创建设备文件,所以不可能正确的执行命令diskadd。
2.3.1 第一个例子
增加磁盘阵列柜第一个逻辑分区/dev/[r]dsk/c2b0t5d0,这个例子详细列出整个过程,目的是让大家有一个较为详细的了解。
1 # diskadd c2b0t5d0
2 UX:diskadd: INFO: You have invoked the System V disk management (s5dm) diskadd .
3 The purpose of this utility is to set up additional disk drives.
4 This utility can destroy the existing data on the disk.
5 Do you wish to continue?
6 (Type y for yes or n for no followed by ENTER):
注释:
1)第1行是增加硬盘的命令,它是建立在系统启动时检测到该硬盘并正确的创立了/dev/[r]dsk/目录下的设备文件的基础之上的。
2)第2行的提示可以看出,当我们省略了参数-F时,缺省调用s5dm交互界面。
3)第4行有一个该操作可能破坏硬盘上存在数据的提示。
4)第5、6两行询问你是否继续,如果可以回答y,如果不想继续则回答n。
7 y
8 The recommended default partitioning for your disk is:
0. a 100% "UNIX System" partition.
9 To select this, please type "y". To partition your disk
10 differently, type "n" and the "fdisk" program will let you
11 select other partitions. y
12 Surface analysis of your disk is recommended
13 but not required.
注释:
1)第7行就是我们的回答”y”,是由我们手动输入的。
2)第8到11行提示我们是用缺省的将该逻辑分区100%的划分为UNIX分区还是手动用fdisk自己进行分区,我们在11行回答的是”y”。
14 Do you wish to skip surface analysis? (y/n) y
15 You will now be queried on the setup of your disk.After you
16 have determined which slices will be created, you will be
17 queried to designate the sizes of the various slices.
18 How many slices/filesystems do you want created on the disk (1 - 13)? 2
注释:创建两个slices。
19 Please enter the absolute pathname (e.g., /home3) for
20 slice/filesystem 1 (1 - 32 chars)? /home/s1
注释:输入文件系统的挂接点目录/home/s1。
21 Enter the filesystem type for this slice (vxfs,ufs,s5,sfs),
22 type 'na' if no filesystem is needed, or press
23 <ENTER> to use the default (vxfs):
注释:使用缺省的文件系统类型vxfs,如果使用其它的文件系统可以手动输入后确认。
24 Specify the block size from the the following list
25 (1024, 2048, 4096, 8192), or press <ENTER> to use the first one:
注释:指定slice的块(block)大小,此处缺省。
26 Should /home/s1 be automatically mounted during a reboot?
27 Type "no" to override auto-mount or press <ENTER> to enable the option: no
注释:询问是否在系统启动时自动mount该文件系统。
28 Please enter the absolute pathname (e.g., /home3) for
29 slice/filesystem 2 (1 - 32 chars)? /home/s2
30 Enter the filesystem type for this slice (vxfs,ufs,s5,sfs),
31 type 'na' if no filesystem is needed, or press
32 <ENTER> to use the default (vxfs):
33 Specify the block size from the the following list
34 (1024, 2048, 4096, 8192), or press <ENTER> to use the first one:
35 Should /home/s2 be automatically mounted during a reboot?
36 Type "no" to override auto-mount or press <ENTER> to enable the option: no
注释:28-36行定义第二个slice,步骤和内容和第一个slice相同。
37 You will now specify the size in cylinders of each slice.
38 (One cylinder is approximately 2 megabytes of disk space.)
39 There are now 17542 cylinders available on your disk.
40 The filesystem type you have chosen is limited to 541064 cylinders.
41 How many cylinders would you like for /home/s1 (0 - 17542)?
42 Press <ENTER> for 0 cylinders: 1000
43 There are now 16542 cylinders available on your disk.
44 The filesystem type you have chosen is limited to 541064 cylinders.
45 How many cylinders would you like for /home/s2 (0 - 16542)?
46 Press <ENTER> for 0 cylinders: 1000
47 Notice: The selections you have made will leave 15542 cylinders unused.
48 You have specified the following disk configuration:
49 A /home/s1 filesystem with 1000 cylinders (1938.0 MB)
50 A /home/s2 filesystem with 1000 cylinders (1938.0 MB)
51 Is this allocation acceptable to you (y/n)? y
52 UX:sh (sh): ERROR: disk3: Not found
53 UX:sh (sh): ERROR: disk5: Not found
54 UX:sh (sh): ERROR: disk6: Not found
注释:第37行到54行对上面定义的两个slice分配空间,以cylinder为单位进行,在第38行有提示说一个cylinder大约接近2MB的空间,在41行提示整个逻辑分区的空间是17542个cylinder。第49、50行说明了上面我们分配的两个slice的大小,并在51行询问是否接受以上定义,我们回答”y”。
55 Filesystems will now be created on the needed slices
56 Creating the /home/s1 filesystem on /dev/rdsk/c2b0t5d0s1
57 Allocated approximately 496093 inodes for this file system. Specify a
58 new value or press <ENTER> to use the default:
59 Creating the /home/s2 filesystem on /dev/rdsk/c2b0t5d0s2
60 Allocated approximately 496093 inodes for this file system. Specify a
61 new value or press <ENTER> to use the default:
62 UX:diskadd: INFO: Diskadd for Disk Drive 2 DONE at Tue Feb 24 13:44:02 CST 2004
63 #
注释:第55到62行创建slice成功,并有说明s1是/dev/rdsk/c2b0t5d0s1,s2是/dev/rdsk/c2b0t5d0s2,这样我们就完成了添加硬盘的工作,并在该逻辑分区上创建了两个子分区。
下面我们用命令prtvtoc将该分区的vtoc表给输出到文件/tmp/aaa,该文件内包含了该分区的子分区(slice)的相关信息。
64 # prtvtoc -f /tmp/aaa /dev/rdsk/c2b0t5d0s0
注释:
1)-f /tmp/aaa
使vtoc表输出到文件/tmp/aaa,该文件可以随意定义。
2)参数/dev/rdsk/c2b0t5d0s0
必须是目录/dev/rdsk,该参数也可以是/dev/rdsk/c2b0t5d0p0。
65 # cat /tmp/aaa
66 #SLICE TAG FLAGS START SIZE
67 0 0x5 0x201 63 69628104
68 1 0x4 0x200 3969 3969000
69 2 0x4 0x200 3972969 3969000
70 3 0x0 0x0 0 0
71 4 0x0 0x0 0 0
72 5 0x0 0x0 0 0
73 6 0x0 0x0 0 0
74 7 0x1 0x201 63 34
75 8 0xd 0x201 97 3872
76 9 0x0 0x0 0 0
77 10 0x0 0x0 0 0
78 11 0x0 0x0 0 0
79 12 0x0 0x0 0 0
80 13 0x0 0x0 0 0
81 14 0x0 0x0 0 0
82 15 0x0 0x0 0 0
注释:我们可以看到/dev/[r]dsk/c2b0t5d0s1和/dev/[r]dsk/c2b0t5d0s2对应的两个slice,第2和3行。也可以看到该活动UNIX系统分区的大小。关于该表的具体介绍请参考《prtvtoc命令介绍一节》。
83 # mount
84 /home/s1 on /dev/dsk/c2b0t5d0s1 read/write/log/setuid/mincache =closesync/noquot4
85 /home/s2 on /dev/dsk/c2b0t5d0s2 read/write/log/setuid/mincache =closesync/noquot4
86 #
a) Total disk size is 17543 cylinders (33998.1 MB)
Cylinders Approx
87 Partition Status Type Start End Length % MB
88 ====== ====== ======= ===== === ====== === ======
1 Active UNIX System 0 17542 17543 100 33998.1
89 SELECT ONE OF THE FOLLOWING:
0. Overwrite system master boot code
1. Create a partition
2. Change Active (Boot from) partition
3. Delete a partition
4. Exit (Update disk configuration and exit)
5. Cancel (Exit without updating disk configuration)
90 Enter Selection: 4
这样,我们就成功的将磁盘阵列的第一个逻辑分区增加到系统中,并且给该分区增加了两个slice子分区。