- 求职 : Linux运维
- 论坛徽章:
- 0
|
本帖最后由 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的。
唉!郁闷啊,在线等 |
|