免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2495 | 回复: 5
打印 上一主题 下一主题

关于SUN服务器 Fire-280R的硬盘分区表重新恢复的方法 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-06-21 17:04 |只看该作者 |倒序浏览
SUN服务器F280R安装SUNOS5.8配有二块73G的硬盘disk1:c1t0d0、disk2:c1t1d0我们在对主机系统进行维护性重起后,发现原来的/u目录不能挂上,系统提示要进行文件系统的修复,用fsck对DISK2进行修复时,系统提示DISK2的超级块坏,无法修复出错如下:
THE FOLLOWING SECTORS COULD NOT BE READ: 104815424 104815425 104815426 104815427
** /dev/rdsk/c1t1d0s1
BAD SUPER BLOCK: MAGIC NUMBER WRONG
USE AN ALTERNATE SUPER-BLOCK TO SUPPLY NEEDED INFORMATION;
eg. fsck [-F ufs] -o b=# [special ...]
where # is the alternate super block. SEE fsck_ufs(1M).
** /dev/rdsk/c1t1d0s2
** Last Mounted on /dbs
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
6 files, 49455874 used, 2184125 free (21 frags, 273013 blocks,  0.0% fragmentation)
打电话于SUN公司的技术员联系,要求我把以上出错信息发给他们,他们回信说可以通过以下办法80%的情况都可以解决:
Please try follow steps :

With the information that I have, it looks like you should be able to install an alternate superblock as follows:

Make sure that this fs is not mounted (it probably won't let you mount anyway)

1 - first find the alternate superblocks:

# newfs -N /dev/rdsk/c1t1d0s1

This will list the superblocks, with the first one being the default.  This is non-destructive.

2 - second, install the second superblock:

# fsck -F ufs -o b=[superblock number] /dev/rdsk/c1t1d0s1

3 - test the filesystem with:

# fsck -y /dev/rdsk/c1t1d0s1

repeate this step until it runs through cleanly with no errors, if you persistantly get a superblock error repeat steps 2 & 3 with a different superblock.

If you try more than 3 different superblocks and still get the errors, it means that you have an unrecoverable filesystem and can be fixed WITH LOSS OF ALL DATA as follows:

# newfs /dev/rdsk/c1t1d0s1
他们的意思是假如通过以上办法3次还不能恢复超级块的话,那么这个文件系统的内容就没有办法取出来了,然而我做了5次以后,仍然是以上的出错信息,SUN公司的技术人员认为硬盘可能坏了,准备派工程师到现场来换硬盘了,但通过SUN的EXPLORER实用程序也没有检查出硬盘有什么地方坏呀。为了不掉失数据,我们暂时没有让SUN公司的工程师来换硬盘,想通过其他方法把数据读出来,当时的系统分区目录情况如下:
/dev/dsk/c1t0d0s0    4144014  133813 3968761     4%    /
/dev/dsk/c1t0d0s6    8072333 6208710 1782900    78%    /usr
/proc                      0       0       0     0%    /proc
fd                         0       0       0     0%    /dev/fd
mnttab                     0       0       0     0%    /etc/mnttab
/dev/dsk/c1t0d0s3    4038702 3203108  795207    81%    /var
swap                 15132192       8 15132184     1%    /var/run
swap                 15132608     424 15132184     1%    /tmp
/dev/dsk/c1t0d0s5    4038702 1315588 2682727    33%    /opt
/dev/dsk/c1t0d0s7    40204291 36685648 3116601    93%    /home
/dev/dsk/c1t0d0s1    1988887  334093 1595128    18%    /usr/openwin
/dev/dsk/c1t1d0s0    51639999 49455874 1667726    97%    /dbs
目录/U已经不能MOUNT上去了,通过查看各个硬盘的分区表,发现DISK1的分区表正常,DISK2的分区表已经完全破坏了:
DISK1的分区表:
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 -   826        4.01GB    (827/0/0)     8415552
  1        usr    wm     827 -  1229        1.96GB    (403/0/0)     4100928
  2     backup    wm       0 - 14086       68.35GB    (14087/0/0) 143349312
  3        var    wm    1230 -  2035        3.91GB    (806/0/0)     8201856
  4       swap    wu    2036 -  3646        7.82GB    (1611/0/0)   16393536
  5 unassigned    wm    3647 -  4452        3.91GB    (806/0/0)     8201856
  6        usr    wm    4453 -  6063        7.82GB    (1611/0/0)   16393536
  7       home    wm    6064 - 14086       38.93GB    (8023/0/0)   81642048
与实际使用的各个目录情况相一致。
DISK2当时的分区表:
Part      Tag    Flag     Cylinders         Size            Blocks
  0       root    wm       0 -    25      129.19MB    (26/0/0)       264576
  1       swap    wu      26 -    51      129.19MB    (26/0/0)       264576
  2     backup    wu       0 - 14086       68.35GB    (14087/0/0) 143349312
  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      52 - 14086       68.10GB    (14035/0/0) 142820160
  7 unassigned    wm       0                0         (0/0/0)             0
与实际使用的2个分区情况完全不同了,并且分区大小也不一致了,但DISK2的C1T1D0S0经过修复后仍然能够挂起:
dev/dsk/c1t1d0s0    51639999 49455874 1667726    97%    /dbs
并且数据内容全部在,文件系统大小基本于原来相当(原来的分区表没有了,只能大概估计一下了)。
为了能够把/u目录挂上,我们决定重新写入DISK2的分区表,这样是很危险的,弄的不好,DISK2上的所有数据就要掉失,包括现在能用的/dbs目录下的数据,为了保险期间,我们先把/dbs的数据备份出来。
这样我们可以对DISK2进行重新划分分区表了,依据是我们根据挂上的目录来判断DISK2应该就划了2个分区/dbs用了50G,/u用了20G左右。用SUN的FORMAT命令将DISK2上原来的分区清除掉,改成2个分区,保存分区表,最后再用FSCK命令对/u文件系统进行恢复扫描后,/u文件系统可以挂上了,数据全部都在,避免了不必要的损失。具体步骤如下:
szeaibak:root>[/dbs/oradata] format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c1t0d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w2100000c505622fa,0
       1. c1t1d0 <SUN72G cyl 14087 alt 2 hd 24 sec 424>
          /pci@8,600000/SUNW,qlc@4/fp@0,0/ssd@w2100000c50568761,0
Specify disk (enter its number): 1
selecting c1t1d0
[disk formatted]
Warning: Current Disk has mounted partitions.


partition> 0
Part      Tag    Flag     Cylinders      Size            Blocks
  0       root    wm       0 - 25      129.19MB    (26/0/0) 264576

Enter partition id tag[root]: unassigned
Enter partition permission flags[wm]:
Enter new starting cyl[0]: 0
Enter partition size[264576b, 26c, 129.19mb, 0.13gb]: 0
partition> p
Current partition table (unnamed):
Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders     Size            Blocks
  0 unassigned    wm       0            0         (0/0/0) 0
  1 unassigned    wm       0            0         (0/0/0) 0
  2 unassigned    wm       0            0         (0/0/0) 0
  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 unassigned    wm       0            0         (0/0/0) 0
  7 unassigned    wm       0            0         (0/0/0) 0

partition> 0
Part      Tag    Flag     Cylinders     Size            Blocks
  0 unassigned    wm       0            0         (0/0/0) 0

Enter partition id tag[unassigned]: dbs
`dbs' not expected.
Enter partition id tag[unassigned]: bak
`bak' not expected.
Enter partition id tag[unassigned]: usr
Enter partition permission flags[wm]:
Enter new starting cyl[0]:
Enter partition size[0b, 0c, 0.00mb, 0.00gb]: 50gb
partition> p
Current partition table (unnamed):
Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0        usr    wm       0 - 10304       50.00GB    (10305/0/0) 104863680
  1 unassigned    wm       0                0         (0/0/0)             0
  2 unassigned    wm       0                0         (0/0/0)             0
  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 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0

partition>
partition> 1
Part      Tag    Flag     Cylinders         Size            Blocks
  1        var    wm   10305 - 12365       10.00GB    (2061/0/0)   20972736

Enter partition id tag[var]:
Enter partition permission flags[wm]:
Enter new starting cyl[10305]:
Enter partition size[20972736b, 2061c, 10240.59mb, 10.00gb]: 19gb
`19.00gb' is out of range
Enter partition size[20972736b, 2061c, 10240.59mb, 10.00gb]: 18gb
partition> p
Current partition table (unnamed):
Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0        usr    wm       0 - 10304       50.00GB    (10305/0/0) 104863680
  1        var    wm   10305 - 14014       18.00GB    (3710/0/0)   37752960
  2 unassigned    wm       0                0         (0/0/0)             0
  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 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0
partition> p
Current partition table (unnamed):
Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0        usr    wm       0 - 10304       50.00GB    (10305/0/0) 104863680
  1        var    wm   10305 - 14076       18.30GB    (3772/0/0)   38383872
  2 unassigned    wm       0                0         (0/0/0)             0
  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 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0

partition> 2
Part      Tag    Flag     Cylinders         Size            Blocks
  2 unassigned    wm       0                0         (0/0/0)             0

Enter partition id tag[unassigned]: backup
Enter partition permission flags[wm]:
Enter new starting cyl[0]:
Enter partition size[0b, 0c, 0.00mb, 0.00gb]: 68.35gb
partition> p
Current partition table (unnamed):
Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0        usr    wm       0 - 10304       50.00GB    (10305/0/0) 104863680
  1        var    wm   10305 - 14076       18.30GB    (3772/0/0)   38383872
  2     backup    wm       0 - 14086       68.35GB    (14087/0/0) 143349312
  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 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0

partition> 1
Part      Tag    Flag     Cylinders         Size            Blocks
  1        var    wm   10305 - 14076       18.30GB    (3772/0/0)   38383872

Enter partition id tag[var]:
Enter partition permission flags[wm]:
Enter new starting cyl[10305]:
Enter partition size[38383872b, 3772c, 18742.12mb, 18.30gb]: 18.35gb
partition> p
Current partition table (unnamed):
Total disk cylinders available: 14087 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders         Size            Blocks
  0        usr    wm       0 - 10304       50.00GB    (10305/0/0) 104863680
  1        var    wm   10305 - 14086       18.35GB    (3782/0/0)   38485632
  2     backup    wm       0 - 14086       68.35GB    (14087/0/0) 143349312
  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 unassigned    wm       0                0         (0/0/0)             0
  7 unassigned    wm       0                0         (0/0/0)             0

partition> l
Ready to label disk, continue? y

partition> quit


FORMAT MENU:
        disk       - select a disk
        type       - select (define) a disk type
        partition  - select (define) a partition table
        current    - describe the current disk
        format     - format and analyze the disk
        repair     - repair a defective sector
        label      - write label to the disk
        analyze    - surface analysis
        defect     - defect list management
        backup     - search for backup labels
        verify     - read and display labels
        save       - save new disk/partition definitions
        inquiry    - show vendor, product and revision
        volname    - set 8-character volume name
        !<cmd>     - execute <cmd>, then return
        quit
format> q
szeaibak:root>[/dbs/oradata]
szeaibak:root>[/dbs/oradata] cd         
szeaibak:root>[/] df -k
Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c1t0d0s0    4144014  133814 3968760     4%    /
/dev/dsk/c1t0d0s6    8072333 6208710 1782900    78%    /usr
/proc                      0       0       0     0%    /proc
fd                         0       0       0     0%    /dev/fd
mnttab                     0       0       0     0%    /etc/mnttab
/dev/dsk/c1t0d0s3    4038702 3203108  795207    81%    /var
swap                 15131920       8 15131912     1%    /var/run
swap                 15132336     424 15131912     1%    /tmp
/dev/dsk/c1t0d0s5    4038702 1315588 2682727    33%    /opt
/dev/dsk/c1t0d0s7    40204291 36685648 3116601    93%    /home
/dev/dsk/c1t0d0s1    1988887  334093 1595128    18%    /usr/openwin
/dev/dsk/c1t1d0s0    51639999 49455874 1667726    97%    /dbs
szeaibak:root>[/] umount /dbs
szeaibak:root>[/] fsck /dev/rdsk/c1t1d0s1
** /dev/rdsk/c1t1d0s1
** Last Mounted on /u
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
112 files, 10190936 used, 8400594 free (58 frags, 1050067 blocks,  0.0% fragmentation)
szeaibak:root>[/] mount /dev/dsk/c1t1d0s1 /u
szeaibak:root>[/] cd /u
szeaibak:root> ls
backup                      spctab.lis
clientsdk.2.90.FC4.SOL.tar  spcusr.lis
error97.txt                 test1.sh
lost+found                  test1.sql
oradata                     test2.sql
sp_1_2.lst                  zyb
spcpkg.lis
szeaibak:root> mount /dev/dsk/c1t1d0s0 /dbs
szeaibak:root> cd /dbs
szeaibak:root>[/dbs] ls
lost+found  oradata     rdbs
szeaibak:root>[/dbs] pwd
/dbs
szeaibak:root>[/dbs] ls
lost+found  oradata     rdbs
szeaibak:root>[/dbs] cd /u
szeaibak:root> ls
backup                      spctab.lis
clientsdk.2.90.FC4.SOL.tar  spcusr.lis
error97.txt                 test1.sh
lost+found                  test1.sql
oradata                     test2.sql
sp_1_2.lst                  zyb
spcpkg.lis
szeaibak:root> ls -l
total 193064
drwxr-xr-x   2 root     other        512 Jul 13  2004 backup
-rw-r--r--   1 root     other    98458112 Feb 27 10:20 clientsdk.2.90.FC4.SOL.tar
-rw-r--r--   1 oracle   dba       220548 Jan 12  2005 error97.txt
drwx------   2 root     root        8192 Jun  8  2004 lost+found
drwxrwxrwx   2 oracle   dba         1024 Apr  6 11:55 oradata
-rw-r--r--   1 oracle   dba        75322 Apr 15  2005 sp_1_2.lst
-rw-r--r--   1 oracle   dba          190 Apr 15  2005 spcpkg.lis
-rw-r--r--   1 oracle   dba         2154 Apr 15  2005 spctab.lis
-rw-r--r--   1 oracle   dba         4174 Apr 15  2005 spcusr.lis
-rw-r--r--   1 oracle   dba           28 Apr 15  2005 test1.sh
-rwxr-xr-x   1 oracle   dba         2052 Apr 15  2005 test1.sql
-rwxr-xr-x   1 oracle   dba         1743 Apr 15  2005 test2.sql
drwxr-xr-x   3 oracle   dba          512 May 19 08:55 zyb

经过测试,ORACLE数据库也能够正常运行,所有数据全部都在。
通过这次经历我们认为,SUN的操作系统的文件系统类型UFS不够强壮,因此使用SUN系统应该经常备份各个文件系统的数据。

论坛徽章:
0
2 [报告]
发表于 2006-06-21 18:45 |只看该作者
sf
一定要顶

论坛徽章:
0
3 [报告]
发表于 2006-06-21 19:39 |只看该作者
呵呵呵 我也遇到过一次 那是t3 ,系统数据库升级后 t3的分区表就乱了 我也是这么搞好的,我那时7个分区 600多g 的数据阿

论坛徽章:
7
荣誉会员
日期:2011-11-23 16:44:17水瓶座
日期:2013-08-28 21:20:16丑牛
日期:2013-10-02 21:01:462015年迎新春徽章
日期:2015-03-04 09:54:45操作系统版块每日发帖之星
日期:2016-06-05 06:20:0015-16赛季CBA联赛之吉林
日期:2016-06-20 08:24:0515-16赛季CBA联赛之四川
日期:2016-08-18 15:02:02
4 [报告]
发表于 2006-06-21 21:38 |只看该作者
vxfs好上一点

论坛徽章:
0
5 [报告]
发表于 2006-06-21 21:47 |只看该作者
这是SUN公司的技术员给的? 印度人吧?(玩笑)

-----------------------------
Please try follow steps :

With the information that I have, it looks like you should be able to install an alternate superblock as follows:

Make sure that this fs is not mounted (it probably won't let you mount anyway)

1 - first find the alternate superblocks:

# newfs -N /dev/rdsk/c1t1d0s1

This will list the superblocks, with the first one being the default.  This is non-destructive.

2 - second, install the second superblock:

# fsck -F ufs -o b=[superblock number] /dev/rdsk/c1t1d0s1

3 - test the filesystem with:

# fsck -y /dev/rdsk/c1t1d0s1

论坛徽章:
0
6 [报告]
发表于 2006-06-22 01:29 |只看该作者
Whe you did 维护性重起, did you have a clean shutdown of
Oracle and the OS?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP