免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6636 | 回复: 4

一个很诡异的问题大家帮助一下!急!!!在线等!!(解决了) [复制链接]

求职 : Linux运维
论坛徽章:
0
发表于 2010-05-26 17:15 |显示全部楼层
本帖最后由 tsadmin 于 2010-05-27 09:56 编辑

公司有台垃圾服务器,给开发部门测试用,最近其中一块SATA的500G硬盘坏了,
为了让他们闭嘴,拆了一个台式机的SATA500G硬盘挂到该服务器上。这块硬盘原来是整个一个NTFS分区
计划用Fdisk分了它,谁知进去之后告诉我不认得那分区于是先后进行了如下尝试
一、手动修改分区类型
[root@localhost ~]# fdisk /dev/sdb

The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       60801   488384001    7  HPFS/NTFS       ###这里显示NTFS分区状态

Command (m for help): t                                                                  ###重设分区类型
Selected partition 1
Hex code (type L to list codes): 85                                                   ###85是linux扩展看来不让用
You cannot change a partition into an extended one or vice versa
Delete it first.
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): l                                                       ###查看一下帮助发现83是标准分区可用

0  Empty           1e  Hidden W95 FAT1 75  PC/IX           be  Solaris boot   
1  FAT12           24  NEC DOS         80  Old Minix       bf  Solaris        
2  XENIX root      39  Plan 9          81  Minix / old Lin c1  DRDOS/sec (FAT-
3  XENIX usr       3c  PartitionMagic  82  Linux swap      c4  DRDOS/sec (FAT-
4  FAT16 <32M      40  Venix 80286     83  Linux           c6  DRDOS/sec (FAT-
5  Extended        41  PPC PReP Boot   84  OS/2 hidden C:  c7  Syrinx         
6  FAT16           42  SFS             85  Linux extended  da  Non-FS data   
7  HPFS/NTFS       4d  QNX4.x          86  NTFS volume set db  CP/M / CTOS / .
8  AIX             4e  QNX4.x 2nd part 87  NTFS volume set de  Dell Utility   
9  AIX bootable    4f  QNX4.x 3rd part 8e  Linux LVM       df  BootIt         
a  OS/2 Boot Manag 50  OnTrack DM      93  Amoeba          e1  DOS access     
b  W95 FAT32       51  OnTrack DM6 Aux 94  Amoeba BBT      e3  DOS R/O        
c  W95 FAT32 (LBA) 52  CP/M            9f  BSD/OS          e4  SpeedStor      
e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a0  IBM Thinkpad hi eb  BeOS fs        
f  W95 Ext'd (LBA) 54  OnTrackDM6      a5  FreeBSD         ee  EFI GPT        
10  OPUS            55  EZ-Drive        a6  OpenBSD         ef  EFI (FAT-12/16/
11  Hidden FAT12    56  Golden Bow      a7  NeXTSTEP        f0  Linux/PA-RISC b
12  Compaq diagnost 5c  Priam Edisk     a8  Darwin UFS      f1  SpeedStor      
14  Hidden FAT16 <3 61  SpeedStor       a9  NetBSD          f4  SpeedStor      
16  Hidden FAT16    63  GNU HURD or Sys ab  Darwin boot     f2  DOS secondary  
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fd  Linux raid auto
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fe  LANstep        
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid ff  BBT            
1c  Hidden W95 FAT3
Hex code (type L to list codes): 83                                                           ###设置成83写盘成功
Changed system type of partition 1 to 83 (Linux)

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       60801   488384001   83  Linux                      ###分区类型果然变成linux

Command (m for help): w                                                                        ###稳妥起见写盘退出
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]#

看来有戏再次fdisk进入磁盘
[root@localhost ~]# fdisk /dev/sdb

The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       60801   488384001   83  Linux

Command (m for help): d                                            ###删除分区
Selected partition 1

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System    ###看了一下分区果然没了

Command (m for help): c                                                    ###创建分区失败告诉俺DOS
DOS Compatibility flag is not set                                         ###告诉俺DOS兼容分区旗标没设置
琢磨了一下,感觉可能是windows系统相关信息保留在MBR里了于是重写MBR
[root@localhost ~]# dd if=/dev/sda of=/root/haha.mbr bs=1 count=512    ###把现有系统sda的MBR导出来
512+0 records in
512+0 records out
[root@localhost ~]# dd of=/dev/sdb if=/root/haha.mbr bs=1 count=512    ###写入到这块500G硬盘上
512+0 records in
512+0 records out
再进去应该分区信息都变成和sda一样的了
[

root@localhost ~]# fdisk /dev/sdb

The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: ignoring extra data in partition table 5                                                   ###报了一堆错误,这是正常的毕竟俺不是真的分了这些区
Warning: ignoring extra data in partition table 5
Warning: ignoring extra data in partition table 5
Warning: invalid flag 0x0230 of partition table 5 will be corrected by w(rite)

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System                                         ###果然分区和现有的sda一样了
/dev/sdb1   *           1          13      104391   83  Linux
/dev/sdb2              14        3200    25599577+  83  Linux
/dev/sdb3            3201        5112    15358140   83  Linux
/dev/sdb4            5113       19457   115226212+   5  Extended
/dev/sdb5   ?      137151      224421   700994507   77  Unknown

Command (m for help): d                                                                                       ###删掉他们
Partition number (1-5): 1

Command (m for help): d
Partition number (1-5): 2

Command (m for help): d
Partition number (1-5): 3  

Command (m for help): d
Partition number (1-5): 4

Command (m for help): d
No partition is defined yet!

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System                       ###删干净了

Command (m for help): c                                                                      ###再创建分区还是这个错误
DOS Compatibility flag is not set

Command (m for help): w                                                                     ###存盘退出
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# fdisk /dev/sdb

The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): c                                                              ###再进来创建分区我靠!!!涛声依旧
DOS Compatibility flag is not set

Command (m for help):

折腾到这份上俺没办法了,如果拆下来放到windows机器上肯定能搞定,在俺看来万能的linux应该也不差啊,为啥分区这么困难呢,求linux系统上的解法。
望各位大牛不吝赐教。我也百度过,也谷歌过都是让俺拆下来用PQ搞定,此法不妥,不是所有服务器硬盘都能用pq的。
唉!郁闷啊,在线等

求职 : Linux运维
论坛徽章:
0
发表于 2010-05-26 17:16 |显示全部楼层
自己坐沙发,大家快来看啊,这么诡异的问题不多见哦

论坛徽章:
0
发表于 2010-05-26 17:40 |显示全部楼层
先用d 删掉原来分区, 再用n来创建分区, 最后w存盘退出后格式化, 一般不会有什么问题啊.

论坛徽章:
9
2015亚冠之阿尔纳斯尔
日期:2015-09-10 16:21:162015亚冠之塔什干火车头
日期:2015-07-01 16:23:022015年亚洲杯之巴勒斯坦
日期:2015-04-20 17:19:46子鼠
日期:2014-11-13 09:51:26未羊
日期:2014-08-28 18:13:36技术图书徽章
日期:2014-02-21 09:30:15酉鸡
日期:2014-01-14 11:12:49天蝎座
日期:2013-12-09 17:56:53平安夜徽章
日期:2015-12-26 00:06:30
发表于 2010-05-26 19:13 |显示全部楼层
lz把c当成了新建分区?

2楼正解

求职 : Linux运维
论坛徽章:
0
发表于 2010-05-27 08:49 |显示全部楼层

惭愧惭愧!这么简单还有脸问唉我恨不得找个地缝钻进去!!!

本帖最后由 tsadmin 于 2010-05-27 08:51 编辑

一句话惊醒梦中人,最近净给自己笔记本装系统了反反复复装了N遍,习惯性的用C来分区,结果造成这样的问题,总结一下就是经验主义作怪,下次遇到问题仔细思考过程不能只看报错提示。在此谢过,下面是正确操作过程:
[root@localhost ~]# fdisk /dev/sdb

The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-60801, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-60801, default 60801):
Using default value 60801

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP