Guidelines

This site is for tech Q&A. Please keep your posts focused on the subject at hand.

Ask one question at a time. Don't conflate multiple problems into a single question.

Make sure to include all relevant information in your posts. Try to avoid linking to external sites.

Links to documentation are fine, but in addition you should also quote the relevant parts in your posts.

0 votes
3.1k views
3.1k views

I had a harddisk failure in one of my servers. The disk (/dev/sda) is part of a Linux software RAID-1 with 2 partitions. The datacenter support replaced the failed disk, and now I'm trying to add it back into my software RAID.

In preparation for that I copied the partition scheme from the remaining disk to the new one:

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

However, now fdisk -l complains

Partition 2 does not start on physical sector boundary.

Full fdisk -l output:

root@server:~ # fdisk -l
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00063c19

Device     Boot   Start       End   Sectors  Size Id Type
/dev/sda1          2048   4209029   4206982    2G fd Linux raid autodetect
/dev/sda2       4209030 312576704 308367675  147G fd Linux raid autodetect

Partition 2 does not start on physical sector boundary.

Disk /dev/sdb: 149.1 GiB, 160041885696 bytes, 312581808 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00063c19

Device     Boot   Start       End   Sectors  Size Id Type
/dev/sdb1          2048   4209029   4206982    2G fd Linux raid autodetect
/dev/sdb2       4209030 312576704 308367675  147G fd Linux raid autodetect

Disk /dev/md1: 147 GiB, 157884153856 bytes, 308367488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/md0: 2 GiB, 2151874560 bytes, 4202880 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
in Sysadmin
edited by
by (125)
3 19 33
edit history

Please log in or register to answer this question.

1 Answer

0 votes
 

The new disk has a larger block size than the old one:

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
...
Disk /dev/sdb: 149.1 GiB, 160041885696 bytes, 312581808 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
...

The beginning of the second partition on the old disk apparently isn't located at a multiple of 4096 and copying partition information does not account for differing block size, so you're getting that warning.

Since the disk does not contain any data yet, the simplest fix is to delete the partition fdisk complains about and re-create it. cfdisk for instance will automatically align the new partition correctly. Make sure to select the proper partition type (Linux raid autodetect), since you want to add it back to a software RAID.

by (125)
3 19 33
edit history
...