Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1275609
  • 博文数量: 554
  • 博客积分: 10425
  • 博客等级: 上将
  • 技术积分: 7555
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-09 09:49
文章分类

全部博文(554)

文章存档

2012年(1)

2011年(1)

2009年(8)

2008年(544)

分类:

2008-04-15 13:51:29

3.查看或更改硬盘标识内容
(1)先来查看硬盘的标识。

检查硬盘标识的命令是prtvtoc。需要说明的是,查看EFI标识也使用这个命令。

使用prtvtoc命令查看VTOC标识:

# prtvtoc /dev/rdsk/c0t0d0s0

* /dev/rdsk/c0t0d0s0 partition map

*

* Dimensions:

* 512 bytes/sector

* 63 sectors/track

* 15 tracks/cylinder

* 945 sectors/cylinder

* 8894 cylinders

* 8892 accessible cylinders

*

* Flags:

* 1: unmountable

* 10: read-only

*

* First Sector Last

* Partition Tag Flags Sector Count Sector Mount Directory

0 2 00 1048950 3381210 4430159 /

1 3 01 0 1048950 1048949

2 5 00 0 8402940 8402939

7 8 00 4430160 3972780 8402939 /export/home

使用prtvtoc命令查看EFI标识:

# prtvtoc /dev/rdsk/c3t1d0s0

* /dev/rdsk/c3t1d0s0 partition map

*

* Dimensions:

* 512 bytes/sector

* 2479267840 sectors

* 2479267773 accessible sectors

*

* Flags:

* 1: unmountable

* 10: read-only

*

* First Sector Last

* Partition Tag Flags Sector Count Sector Mount Directory

0 2 00 34 262144 262177

1 3 01 262178 262144 524321

6 4 00 524322 2478727100 2479251421

8 11 00 2479251422 16384 2479267805

从上面可以出,EFI标识写到第34扇区,从34扇区以后才进入硬盘分区。

(2)更改硬盘标识。

将硬盘从VTOC标识更改为EFI标识的方法是:先选定需要更改的硬盘号,然后再键入lable命令,就会出现让你选择标识类型的菜单。过程如下:

# format -e

Searching for disks...done

AVAILABLE DISK SELECTIONS:

1. c1t0d0

/sbus@2,0/QLGC,isp@2,10000/sd@0,0

2. c1t1d0

/sbus@2,0/QLGC,isp@2,10000/sd@1,0

3. c1t8d0

/sbus@2,0/QLGC,isp@2,10000/sd@8,0

4. c1t9d0

/sbus@2,0/QLGC,isp@2,10000/sd@9,0

Specify disk (enter its number): 4

selecting c1t9d0

[disk formatted]

format> label

[0] SMI Label

[1] EFI Label

Specify Label type[0]: 1

Ready to label disk, continue? yes

format> quit

完成。

11.2.3 修复坏的硬盘扇区
硬盘故障发生后,我们首先关注的是硬盘上的数据是否丢失。我们可以先将数据备份,再修复硬盘的坏扇区,如果还是不能修复,就需要换一块新的硬盘了。

下面介绍怎样修复坏硬盘扇区。

(1)将文件存档。

如果硬盘坏了,但还可以访问硬盘,那么就把硬盘上的所有文件系统做一下ufsdump。ufsdump命令的用法见第12章。

(2)将硬盘上的文件拷出。

若无法对硬盘运行ufsdump,那么找一个同类型硬盘,联入系统,使用dd命令从坏盘上拷出数据,

例如,从主盘/dev/rdsk/c0t0d0s2拷贝到目的盘/dev/rdsk/c0t2d0s2,使用命令:

# dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t2d0s2 bs=128k

dd的使用详见dd(1M)手册。

(3)分析硬盘扇区错误。

 成为超级用户或授权角色用户。

 卸载故障盘:

# umount /dev/dsk/device-name

 使用format命令:

# format

 选择硬盘:

Specify disk (enter its number):1

selecting c0t2d0:

[disk formatted]

Warning: Current Disk has mounted partitions.

 选择分析菜单:

format> analyze

 键入setup命令设置分析参数:

analyze> setup

Analyze entire disk [yes]? n

Enter starting block number [0, 0/0/0]: 12330

Enter ending block number [2052287, 2035/13/71]: 12360

Loop continuously [no]? y

Repair defective blocks [yes]? n

Stop after first error [no]? n

Use random bit patterns [no]? n

Enter number of blocks per transfer [126, 0/1/54]: 1

Verify media after formatting [yes]? y

Enable extended messages [no]? n

Restore defect list [yes]? y

Create defect label [yes]? y

 使用read命令找到错误的块

analyze> read

Ready to analyze (won’t harm SunOS). This takes a long time,

but is interruptible with Control-C. Continue? y

pass 0

2035/12/1825/7/24

pass 1

Block 12354 (18/4/1, Corrected media error (hard data ecc)

25/7/24

^C

Total of 1 defective blocks repaired.

可见,数据块12345有错误,需要被修复。

(4)下面开始修复错误扇区。

 成为超级用户或授权角色用户。

 使用format命令:

# format

 选择硬盘:

Specify disk (enter its number): 1

selecting c0t3d0

[disk formatted]

format>

 选择repair命令:

format> repair

 键入错误的块的号码:

Enter absolute block number of defect: 12354

Ready to repair defect, continue? y

Repairing block 12354 (18/4/1...ok.

format>

(5)重新格式化硬盘。

若硬盘上有坏块,则重新格式化有时会解决问题。格式化硬盘的命令是format,其用法和修复扇区错误相似,就是把repair命令换成format命令,详细信息见format(1M)手册。但请记住,格式化硬盘会毁掉磁盘上面的所有数据,格式化完成后还须使用newfs命令重新建立文件系统。

(6)换下旧硬盘。

如果重新格式化和修复坏块都解决不了问题时,就要换下此坏硬盘,方法详见11.2.4节。

11.2.4 添加新的硬盘
在计算机运行过程中,如果硬盘空间已经不足,或者有个硬盘已经出现坏的扇区,而且修复也失败的情况下,我们就须添加一个新的硬盘,并把坏的硬盘换下。

由于在分区方面有所不同,所以SPARC和x86平台上添加硬盘的步骤稍微有所不同,我们须分别介绍。

添加系统盘和数据盘也有所不同。系统盘上只安装着操作系统,如果坏了,就须重新安装或者从备份介质中恢复。具体恢复步骤我们在第1**薪樯堋U饫镏氐憬彩?据盘的添加。

1.在SPARC平台上增添第2块硬盘
(1)关闭系统,装上新的硬盘。

(2)启动系统,进入超级用户状态。

(3)运行Format命令,查看是否已经发现新的硬盘。

# format

AVAILABLE DISK SELECTIONS:

0. /dev/rdsk/c1t0d0s0

/sbus@2,0/QLGC,isp@2,10000/sd@0,0

1. /dev/rdsk/c1t1d0s0

/sbus@2,0/QLGC,isp@2,10000/sd@1,0

(4)选择新的硬盘号码,进入硬盘设置菜单,使用下面命令进入分区菜单:

format> partition

(5)查看分区情况:

partition> print

(6)修改分区设置:

partition> modify

(7)写入lalel标识中:

partition>label

(8)离开分区菜单:

partition>quit

(9)保存设置,并退出:

format>save

format>quit

#

(10)使用命令newfs来为每一个分区创建文件系统:

#newfs /dev/rdsk/c?t?d?s?

(11)修改/etc/vfstab文件,使新的硬盘分区可以在系统启动的时候别自动mount。

2.在x86平台上增添第2块硬盘
在x86平台上添加第2块硬盘比起在SPARC平台上稍微复杂些。因为x86平台上有个fdisk分区的概念。fdisk分区是区分Solaris系统分区和其他如DOS分区、Linux分区的,毕竟大多数x86平台都可以运行着多操作系统,而在SPARC平台上就没有这些考虑了。

在fdisk分区之后,只有分给Solaris系统的硬盘部分,我们才可以和在SPARC平台上一样进行盘片的分割。限于篇幅,这部分我们将不再叙述,请参见上面的SPARC部分。

下面我们主要介绍x86的fdisk分区:

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

可以看出原盘只有DOS分区,下面建立Solaris分区:

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

选择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

键入1,则可选择创建Solaris分区。

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

键入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

键入5,选择退出fdisk分区设置。

接下来就是划分Solaris分区的盘片了,这里不再叙述。
阅读(1150) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~