免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: Lippman
打印 上一主题 下一主题

求救Redhat Linux系统重启,盘阵找不到! [复制链接]

论坛徽章:
0
31 [报告]
发表于 2009-04-21 17:13 |只看该作者
有一个工具叫做guesspart什么的,没印象了。但的确有。

论坛徽章:
0
32 [报告]
发表于 2009-04-21 17:15 |只看该作者
原帖由 carrison 于 2009-4-21 17:07 发表

linux下有什么类似的好工具么?
刚才看了一下parted,hdparm,disktest等,好像都不能导入导出分区表。
windows下倒是不少。


sfdisk就可以,我前面的解决方法中就有啊

论坛徽章:
0
33 [报告]
发表于 2009-04-21 17:16 |只看该作者
嗯,网上看到也是推荐sfdisk, dd虽然可以,但备的不是文本文件。

Partition Table Backup

Many of us are doing backups of all kinds of data: from regular files, databases, to full partitions or hard drives. What I have noticed that very few peoples even think about the partition table. Given the importance of the partition table I would suggest to have a backup of it, in case you will have a corrupted partition table, if you made a change by mistake or even if that gets deleted somehow (by mistake or intentionally). You still have the data on the disk but without recreating the correct partition table it will not be very easy to get the data back. Anyway this is very easy to do, so it is better to have it on hand, than regret that you have not done this when needed.

We can get a quick look on all the existing partitions on all the available hard drives with fdisk using the -l switch without any other parameter:

fdisk -l
Disk /dev/sda: 74.3 GB, 74355769344 bytes
255 heads, 63 sectors/track, 9039 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          16      128488+  83  Linux
/dev/sda2              17         259     1951897+  82  Linux swap / Solaris
/dev/sda3             260        2083    14651280   83  Linux
/dev/sda4            2084        9039    55874070   83  Linux

Disk /dev/sdb: 73.4 GB, 73407820800 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        8924    71681998+  83  Linux

If we add to the command line the particular device that corresponds to a hard disk, like /dev/sdb we get the same result only for that device:

fdisk -l /dev/sdb

Disk /dev/sdb: 73.4 GB, 73407820800 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        8924    71681998+  83  Linux

Of course someone might use only this information to recreate the partition table by manually creating the same partitions with the same start/end blocks (in case you want to do that you just have to save the above output in a file so you have that information on hand when needed), but there is a simpler way using sfdisk:

sfdisk -d /dev/sda
# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=       63, size=   256977, Id=83
/dev/sda2 : start=   257040, size=  3903795, Id=82
/dev/sda3 : start=  4160835, size= 29302560, Id=83
/dev/sda4 : start= 33463395, size=111748140, Id=83

Using sfdisk with the -d option we can get a dump of the current partition table in a regular file, and if needed we can restore it from that file:

sfdisk -d /dev/sda > sda_table

and to restore the partition table:

sfdisk /dev/sda < sda_table

Regardless on the method used, having a backup of the partition table might be handy.

One more tip: another usage of sfdisk with -d is to create an identical partition table from another hard disk. In this example we are partitioning sdb with the exact same partitions as sda:

sfdisk -d /dev/sda | sfdisk /dev/sdb

of course this can be handy when the hard drives are identical, in raid1 setups, etc.

论坛徽章:
0
34 [报告]
发表于 2009-04-21 17:19 |只看该作者
原帖由 Lippman 于 2009-4-21 17:15 发表


sfdisk就可以,我前面的解决方法中就有啊

如果分区表都不一样,你如何在linux里设置你的sdb的分区表?

论坛徽章:
0
35 [报告]
发表于 2009-04-21 17:27 |只看该作者
sfdisk有扫描并寻找分区的能力吗?!如果在0头的分区表被破坏了,我看32楼怎么恢复?!

这个东西值得做个试验,你找个分区:
dd if=/dev/zero of=/dev/sdb bs=1 count=64 seek=446

然后再去用sfdisk去折腾。

论坛徽章:
0
36 [报告]
发表于 2009-04-21 17:37 |只看该作者
Parted有个rescue功能,能查找恢复丢失的分区,不知效果如何?呵呵

Example:

(parted) print
Disk geometry for /dev/hdc: 0.000-8063.507 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags
1          0.031   8056.032  primary   ext3
(parted) rm
Partition number? 1
(parted) print
Disk geometry for /dev/hdc: 0.000-8063.507 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags

OUCH! We deleted our ext3 partition!!! Parted comes to the rescue...

(parted) rescue
Start? 0
End? 8056
Information: A ext3 primary partition was found at 0.031Mb ->
8056.030Mb.  Do you want to add it to the partition table?
Yes/No/Cancel? y
(parted) print
Disk geometry for /dev/hdc: 0.000-8063.507 megabytes
Disk label type: msdos
Minor    Start       End     Type      Filesystem  Flags
1          0.031   8056.032  primary   ext3

[ 本帖最后由 carrison 于 2009-4-21 17:40 编辑 ]

论坛徽章:
0
37 [报告]
发表于 2009-04-21 17:39 |只看该作者
原帖由 carrison 于 2009-4-21 17:37 发表
Parted有个rescue功能,能查找恢复丢失的分区,不知效果如何?呵呵


我要有你这功夫去问,我就去试试了。

论坛徽章:
0
38 [报告]
发表于 2009-04-21 22:04 |只看该作者
软raid真不可靠奥。
看完此帖,我的经验是不用lvm,用硬raid 5+1 或raid6做raid。文件系统用单个ext3,最大16t.
当然,根据需要可以用n个ext3.

[ 本帖最后由 aleng 于 2009-4-21 22:18 编辑 ]

论坛徽章:
0
39 [报告]
发表于 2009-04-21 23:20 |只看该作者
我现在考虑LVM到底好不好,数据恢复太麻烦。。各位大侠能不能说下看法?

论坛徽章:
0
40 [报告]
发表于 2009-04-22 00:05 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP