Linux

(Debian) Linux 中的重複分區表

  • August 16, 2013

軟體 RAID 陣列中的磁碟出現故障,我正在嘗試更換它。我之前已經順利完成了這項工作,但這次我在嘗試複製分區表時遇到了錯誤。

我正在使用這個命令:

sfdisk -l /dev/sda | sfdisk /dev/sdb

並得到這個錯誤:

sfdisk: unrecognized input: 121601 cylinders, 255 heads, 63 sectors/track

閱讀sfdisk 手冊頁,我無法誠實地看到這個命令是如何工作的,但它在過去曾多次工作過。

**問題:如何將確切的分區表複製到第二個磁碟,以便我可以將其用作 RAID 成員?**我不喜歡 sfdisk,這只是之前完成的工作。

如果有幫助,這裡有一些細節

sfdisk -l /dev/sda

Disk /dev/sda: 121601 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

  Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1   *      0+   3646    3647-  29294496   fd  Linux raid autodetect
/dev/sda2       3647  121600  117954  947465505    5  Extended
/dev/sda3          0       -       0          0    0  Empty
/dev/sda4          0       -       0          0    0  Empty
/dev/sda5       3647+  27961   24315- 195310206   fd  Linux raid autodetect
/dev/sda6      27962+  40119   12158-  97659103+  fd  Linux raid autodetect
/dev/sda7     120628+ 121600     973-   7815591   fd  Linux raid autodetect
/dev/sda8     119655+ 120627     973-   7815591   fd  Linux raid autodetect
/dev/sda9      40120+ 119654   79535- 638864856   fd  Linux raid autodetect

sfdisk -l /dev/sdb

Disk /dev/sdb: 121601 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
  Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sdb1          0+ 121600  121601- 976760001   83  Linux
/dev/sdb2          0       -       0          0    0  Empty
/dev/sdb3          0       -       0          0    0  Empty
/dev/sdb4          0       -       0          0    0  Empty

還嘗試了該選項的管道-d,但這告訴我:

  Device Boot    Start       End   #sectors  Id  System
/dev/sdb1   *        63  58589054   58588992  fd  Linux raid autodetect
/dev/sdb2      58589055 1953520064 1894931010   5  Extended
/dev/sdb3             0         -          0   0  Empty
/dev/sdb4             0         -          0   0  Empty
/dev/sdb5      58589118 449209529  390620412  fd  Linux raid autodetect
/dev/sdb6     449209593 644527799  195318207  fd  Linux raid autodetect
/dev/sdb7     1937888883 1953520064   15631182  fd  Linux raid autodetect
/dev/sdb8     1922257638 1937888819   15631182  fd  Linux raid autodetect
/dev/sdb9     644527863 1922257574 1277729712  fd  Linux raid autodetect
Warning: partition 7 does not start at a cylinder boundary

sfdisk: I don't like these partitions - nothing changed.
(If you really want this, use the --force option.)

partition7 是否有可能從 sda 的圓柱邊界開始,但不會在 sdb 上?我應該修復這個(分開?)還是強制它?

由於您之前為您工作的命令不再起作用,我有點猶豫是否要告訴您有關複製 MBR 的資訊dd……如果您敢於嘗試並完全自擔風險,請嘗試一下。

dd if=/dev/sda of=/dev/sdb bs=512 count=1

命令應該是

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

引用自:https://serverfault.com/questions/531438