0

A disk failed in a software RAID array and I'm trying to replace it. I've done this before without a hitch but this time I'm getting an error when trying to duplicate the partition table.

I'm using this command:

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

And getting this error:

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

Reading the sfdisk man page I can't honestly see how this command ever worked, but it's worked several times in the past.

Question: how can I duplicate the exact partition table to the 2nd disk, so I can use it for as a RAID member? I'm not wedded to sfdisk, it's just what's done the job well before.

Here's some detail in case it's helpful

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

Also tried piping from the -d option, but this tells me:

   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.)

Is it possible that partition7 does start at a cylendar boundary on sda but wouldn't on sdb? Should I fix this (parted?) or force it?

2 Answers 2

2

Since your command that was worked for you earlier does not work anymore, I'm a bit hesitant to tell you about cloning the MBR with dd ... try it if you dare and completely at your own risk.

dd if=/dev/sda of=/dev/sdb bs=512 count=1
2
  • yeah, it's only going to screw up a blank, new sdb drive isn't it? That's safe enough - does it do the full/same job? Aug 16, 2013 at 9:51
  • This is presumably the same as using the --force option in sfdisk? Aug 16, 2013 at 10:30
3

The command should be

sfdisk -d /dev/sda | sfdisk /dev/sdb
2
  • Pls see bottom of question Aug 16, 2013 at 9:04
  • Add --force to the 2nd option and this works. Thanks. Aug 16, 2013 at 11:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .