Skip to contentSkip to conversation

new drive is 4 sectors shorter, can it be used for swraid5 array?

DISCUSSION Marc MERLIN 7 participants 13 messages Mar 18, 2022 – Apr 2, 2022 MD RAID

lore
Share & tools
lore
#0 lore raw

old drive:

Device Model:     ST6000VN0041-2EL11C
Serial Number:    ZA18WX4T
LU WWN Device Id: 5 000c50 0a47d527a
Firmware Version: SC61
User Capacity:    6,001,175,126,016 bytes [6.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical

8 128 5860522584 sdi
8 129 5860521543 sdi1

new drive:

Device Model:     ST6000VN001-2BB186
Serial Number:    ZR118A1Y
LU WWN Device Id: 5 000c50 0dba1b3c0
Firmware Version: SC60
User Capacity:    6,001,175,126,016 bytes [6.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical

8 160 5860522580 sdk
8 161 5860521536 sdk1

New drive is 4 sectors shorter, so I assume I can't use it as a replacement in my md5 array because it's 4 sectors too short, or does swraid5 not need the last few sectors of a drive?

Looks like formatting as MDR won't help, I'm still 4 sectors short.

Thanks,
Marc

Signature · 3 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
 
Home page: http://marc.merlins.org/                       | PGP 7F55D5F27AAF9D08
#1 lore raw
Quoted 20 lines · Marc MERLIN

old drive:

Device Model:     ST6000VN0041-2EL11C
Serial Number:    ZA18WX4T
LU WWN Device Id: 5 000c50 0a47d527a
Firmware Version: SC61
User Capacity:    6,001,175,126,016 bytes [6.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
    8      128 5860522584 sdi
    8      129 5860521543 sdi1

new drive:

Device Model:     ST6000VN001-2BB186
Serial Number:    ZR118A1Y
LU WWN Device Id: 5 000c50 0dba1b3c0
Firmware Version: SC60
User Capacity:    6,001,175,126,016 bytes [6.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Quoted 9 lines
    8      160 5860522580 sdk
    8      161 5860521536 sdk1

New drive is 4 sectors shorter, so I assume I can't use it as a replacement in my md5 array because it's 4 sectors too short, or does swraid5 not need the last few sectors of a drive?

Looks like formatting as MDR won't help, I'm still 4 sectors short.

Suck it and see ...

The two drives look like they report the same User Capacity, ie 6 terabytes "exactly". They should therefore be drop-in replacements for each other.

And I find that eg when I partition a drive it reports unusable space at the end - you should find that any lost space will get lost there ...

And are you using sdk, or sdk1, as your block device to add to the array? While I'd be a little surprised, is it possible the disk drives are reporting different geometries and messing up fdisk's default partition sizes? Try copying the partition geometry exactly from sdi to sdk using sector numbers ...

Plus they're both Seagates (Ironwolf, good choice :-), so there really shouldn't be a problem. The only odd thing I notice is your new drive seems to have an older firmware?

Cheers,
Wol

#2 lore raw
In reply to Marc MERLIN
Quoted 20 lines · On Thu, 17 Mar 2022 20:08:55 -0700 Marc MERLIN <[email protected]> wrote:

old drive:

Device Model:     ST6000VN0041-2EL11C
Serial Number:    ZA18WX4T
LU WWN Device Id: 5 000c50 0a47d527a
Firmware Version: SC61
User Capacity:    6,001,175,126,016 bytes [6.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
   8      128 5860522584 sdi
   8      129 5860521543 sdi1

new drive:

Device Model:     ST6000VN001-2BB186
Serial Number:    ZR118A1Y
LU WWN Device Id: 5 000c50 0dba1b3c0
Firmware Version: SC60
User Capacity:    6,001,175,126,016 bytes [6.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Quoted 8 lines
   8      160 5860522580 sdk
   8      161 5860521536 sdk1

New drive is 4 sectors shorter, so I assume I can't use it as a replacement in my md5 array because it's 4 sectors too short, or does swraid5 not need the last few sectors of a drive?

Looks like formatting as MDR won't help, I'm still 4 sectors short.

Check "Used Dev Size" in "mdadm --detail" of your array. I suppose that is how much (at least) it actually needs from any new member to be suitable for the array.

If you find it needs more than the size of sdk1, as an emergency measure you could wipe off the partition table and add the entire sdk as the array member. While usually not recommended, if you don't boot other operating systems on the same machine (that could see the "raw" drive and mess with it), it should not cause any problem.

However there should not be such size difference in the first place, check your dmesg if drive detection messages report "HPA", and/or check with "hdparm -N" if there's this HPA enabled, cutting off a portion of the drive at the end.

Signature · 2 lines
With respect,
Roman
#3 lore raw
Quoted 1 line · On Fri, 18 Mar 2022 17:30:07 +0500 Roman Mamedov <[email protected]> wrote:

However there should not be such size difference in the first place

If we look closely though, there actually doesn't appear to be:

Quoted 8 lines
Quoted 5 lines · On Thu, 17 Mar 2022 20:08:55 -0700 Marc MERLIN <[email protected]> wrote:

old drive:
User Capacity: 6,001,175,126,016 bytes [6.00 TB]

new drive:
User Capacity: 6,001,175,126,016 bytes [6.00 TB]

As for...

Quoted 5 lines
Quoted 5 lines
   8      128 5860522584 sdi
   8      129 5860521543 sdi1

   8      160 5860522580 sdk
   8      161 5860521536 sdk1

Which tool returns this output?

What do you get for

  blockdev --getsize64 /dev/sdi
  blockdev --getsize64 /dev/sdk

If this returns the same size for both, wipe a few first MB the new drive with zeroes using dd, and try a different partitioning tool.

Signature · 2 lines
With respect,
Roman
#4 lore raw
Quoted 3 lines · Wols Lists

mdadm has absolutely no trouble with that at all. All it cares about is if something is a block device - if it finds an mdadm signature at the start of a block device it will use it.

I think I remember back in the day that auto joining of raid1 arrays by the kernel at boot time so that you could then mount the filesystem as root, only worked if it was on partitions. That was a long time ago though.

Quoted 9 lines · Roman Mamedov

As for...

Quoted 5 lines
Quoted 5 lines
   8      128 5860522584 sdi
   8      129 5860521543 sdi1

   8      160 5860522580 sdk
   8      161 5860521536 sdk1

Which tool returns this output?

cat /proc/partitions

Quoted 4 lines

What do you get for

  blockdev --getsize64 /dev/sdi
  blockdev --getsize64 /dev/sdk
gargamel:/dev# blockdev --getsize64 /dev/sdi
6001175126016
gargamel:/dev# blockdev --getsize64 /dev/sdk
6001175121920
Quoted 2 lines

If this returns the same size for both, wipe a few first MB the new drive with zeroes using dd, and try a different partitioning tool.

Good suggestion, but the drives indeed seem different, very slightly so. Thankfully not enough to matter for my mdadm array it seems, so that's good news

Thanks to all for the help
Marc

Signature · 3 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
 
Home page: http://marc.merlins.org/                       | PGP 7F55D5F27AAF9D08
#5 lore raw
In reply to Marc MERLIN
Quoted 2 lines · Marc MERLIN

old drive:

...

Quoted 2 lines
   8      128 5860522584 sdi
   8      129 5860521543 sdi1

...

Quoted 6 lines

new drive:
Device Model: ST6000VN001-2BB186
8 160 5860522580 sdk
8 161 5860521536 sdk1

New drive is 4 sectors shorter, so I assume

...

The one option I did not see is resizing the filesystem (smaller) to make an easy match.

In this case there is a second new disk big enough to back up all the data so that is
the first task.

Shrinking a filesystem (resize2fs) does have some risks so backup first.

It is sort of nice to leave modest unused space when setting up a new disk.

Also back up to the new disk formatted correctly then invert the question and add the old disk with matched size partitions to mirror to.

It all depends on the backup strategy. Clonezilla?

Signature · 1 line
          T o m    M i t c h e l l  (on NiftyEgg[.]com )
#6 lore raw
Quoted 8 lines · Tom Mitchell

Shrinking a filesystem (resize2fs) does have some risks so backup first.

It is sort of nice to leave modest unused space when setting up a new disk.

Also back up to the new disk formatted correctly then invert the question and add the old disk with matched size partitions to mirror to.

It all depends on the backup strategy. Clonezilla?

If they are the same size or the backup disk is larger, I'd just use dd on an unmounted filesystem!

Cheers,
Wol

#7 lore raw
In reply to Marc MERLIN

Marc MERLIN <[email protected]>

Quoted 3 lines

New drive is 4 sectors shorter, so I assume I can't use it as a replacement in my md5 array because it's 4 sectors too short, or does swraid5 not need the last few sectors of a drive?

4 sectors shorter are common for external hard drives (sold from
seagate,toshiba,etc). if you attach the drive to internal sata port or normal usb enclosure(not sold from disk vendors),you will get back normal disk size. so maybe you want to check what connect to your disk.

#8 lore raw
Quoted 10 lines · d tbsky

Marc MERLIN <[email protected]>

Quoted 3 lines

New drive is 4 sectors shorter, so I assume I can't use it as a replacement in my md5 array because it's 4 sectors too short, or does swraid5 not need the last few sectors of a drive?

4 sectors shorter are common for external hard drives (sold from
seagate,toshiba,etc). if you attach the drive to internal sata port or normal usb enclosure(not sold from disk vendors),you will get back normal disk size. so maybe you want to check what connect to your disk.

OMG, using a USB adapter eats 4 setors? I had no idea... Sure enough, I did connect the drives via USB for diagnosis since I had run out of sata ports.

Thanks for the hint.
Marc

Signature · 3 lines
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
 
Home page: http://marc.merlins.org/  
#9 lore raw
Quoted 4 lines · Marc MERLIN

OMG, using a USB adapter eats 4 setors? I had no idea... Sure enough, I did connect the drives via USB for diagnosis since I had run out of sata ports.

None of my SATA-USB enclosures behave this way. But what it does do is mask (lie) the true physical sector size, claiming it's 512 bytes instead of 4096 bytes.

I've also seen enclosures turn a 512 byte logical sector drive into a 4096 byte logical sector drive, which is a real PITA because it completely messes up the GPT. My understanding of the logic of GPT format is atomic modifications that are crash safe (that's up to the tool to do correctly too but the spec has a pretty specific order each sector is supposed to be written), but in practice this is another PITA for a significant minority of users who end up putting an internal drive into an enclosure and bam - can't read the drive at all.

It'd be kinda neat if this condition could be detected and have a device mapper target setup to deal with it.

Signature · 1 line
Chris Murphy
#10 lore raw

Chris Murphy <[email protected]>

Quoted 3 lines

None of my SATA-USB enclosures behave this way. But what it does do is mask (lie) the true physical sector size, claiming it's 512 bytes instead of 4096 bytes.

normal sata-usb should be ok. seagate/toshiba sata-usb will eat sectors. some gigabyte dual-bios motherboards will eat sectors (with disk HPA function).
In the early days different vendors made different capacity harddisks. But at some moment, maybe 250GB or 500GB, suddenly every vendor made the same capacity harddisks. It's a mystery to me. who decides the disk sector numbers? why 2TB disk capacity is not double 1TB, 8TB not double 4TB? capacity is different for sd-card and ssd, but harddisk capacity seems normalized at some time.

#11 lore raw

Hi,

Quoted 4 lines · d tbsky

In the early days different vendors made different capacity harddisks. But at some moment, maybe 250GB or 500GB, suddenly every vendor made the same capacity harddisks. It's a mystery to me. who decides the disk sector numbers?

There is a standard called IDEMA LBA1-03:

    http://www.idema.org/wp-content/downloads/2169.pdf

This says that a certain "marketing capacity" (i.e. when the drive product description says "2TB" or whatever) will equal an exact number of 512 or 4096 byte sectors.

It's been over a decade since I personally saw a SATA, SAS or NVMe drive that did not obey this, so I've felt comfortable that I could replace drives from one vendor with another without having to worry about a few sectors different size here or there.

However, I did see people on this and other mailing lists such as zfs-discuss saying they were still seeing drives that did not comply with IDEMA LBA1-03 for capacity as recently as last year, so apparently I did not look hard enough or have just been lucky.

If you want to play at home the formula in IDEMA LBA1-03 boils down to:

    ($GB * 1000194048) + 10838016 bytes

using powers of ten definitions for "GB", so anything calling itself a "2TB" drive should be exactly:

    (2000 * 1000194048) + 10838016

    = 2,000,398,934,016 bytes

Capacity presented to the OS might be lower of course if there is hardware meddling as you mention.

Again, I've not personally seen anything recently that doesn't obey this, but people have shown me things that don't, so it's apparently still a thing.

Cheers,
Andy

#12 lore raw

Andy Smith <[email protected]>

Quoted 7 lines

There is a standard called IDEMA LBA1-03:

    http://www.idema.org/wp-content/downloads/2169.pdf

This says that a certain "marketing capacity" (i.e. when the drive product description says "2TB" or whatever) will equal an exact number of 512 or 4096 byte sectors.

thanks a lot for the information! now I understand what happened to
my disk drives :)