One of my RAID1 disks failed recently. I've purchased a replacement, connected it up and formatted it as Linux RAID
using cfdisk
.
- New drive is
/dev/sdc
- Old drive is
/dev/sdd
They appear to have the same number of bytes and sectors overall but the formatted partitions differ in size...
# fdisk -l /dev/sd{c,d}
Disk /dev/sdc: 7.28 TiB, 8001563222016 bytes, 15628053168 sectors
Disk model: ST8000VN0022-2EL
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: gpt
Disk identifier: 952AC4E6-20B9-408D-83CE-AC4AEFBC1075
Device Start End Sectors Size Type
/dev/sdc1 2048 15628052479 15628050432 7.3T Linux RAID
Disk /dev/sdd: 7.28 TiB, 8001563222016 bytes, 15628053168 sectors
Disk model: ST8000VN004-2M21
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: gpt
Disk identifier: 4069B8CB-4C43-304B-B872-DDB89C0E0AA1
Device Start End Sectors Size Type
/dev/sdd1 2048 15628053134 15628051087 7.3T Linux RAID
Specificly...
/dev/sdc1 2048 15628052479 15628050432 7.3T Linux RAID
/dev/sdd1 2048 15628053134 15628051087 7.3T Linux RAID
The new partition /dev/sdc1
is smaller than the existing partition. As a consequence...
# mdadm --manage /dev/md127 --add /dev/sdc1
mdadm: Value "kimura:0" cannot be set as devname. Reason: Not POSIX compatible. Value ignored.
mdadm: /dev/sdc1 not large enough to join array
I've found a thread suggesting one (/dev/sdd
which is the ST8000VN004
) is using 512E to emulate 512bytes per logical sector despite being 4096 bytes per physical sector.
Now I'm wary of jumping in with resizing the existing partition on /dev/sdd1
to match that of /dev/sdc1
as this is part of a RAID1 array with three logical volumes on top.
Found a related thread but the issue there is different as they've a 3TB RAID and they want to partition a new 14TB so space isn't an issue, here my new partition is smaller than the existing.
Any thoughts or advice on how to proceed would be appreciated.
Instead of creating a partition table on the new drive from scratch, copy it from the existing drive using
sfdisk
:This will ensure that partitions are exactly the same.
Both your disks are the same with regard to the physical sector size. Both are having 4k sectors, according to the output:
While it is indeed not very good that the partition has fractional count of physical sectors, this shouldn't be a problem in practice. It is only important it begins at the correct place. The mdadm and LVM on-disk structures have large paddings as to round boundaries to 64k or even to 4M, so the extra space that falls into incomplete physical sector at the end of the volume simply isn't used.
However, it might be good to clean this now, for nobody to be confused in the future. If you are using LVM, it's possible to tidy it all without dangerous surgery, using the following sequence:
pvmove
everything there emptying the old PV,