Linux RAID subsystem development
 help / color / mirror / Atom feed
* Partitions with == or \approx same size ?
@ 2007-07-20 17:54 Seb
  2007-07-20 19:48 ` Robin Hill
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Seb @ 2007-07-20 17:54 UTC (permalink / raw)
  To: linux-raid


Dear all,


First I'd like to thank you for the great work you've done with mdadm.
It's flexible, powerful and reasonably easy to use.

I have a question that seems both important for the redundancy of my RAID6
devices and too sharp for me, my friends and the newsgroup
fr.comp.stockage . I think your understanding of the inner workings of
mdadm should allow you to already know the answer.

A 12-disks machine was recently assembled with disks coming from several
sources (Linux Ubuntu server, kernel 2.6.15, RAID6 array). All 12 disks
are S-ATA with 250 GB capacity.

I understand that partitions should have the same size, meaning the same
number of bytes. All 12 disks have exactly 250059350016 bytes, but the
number of blocks that can be allocated are not the same from one disk to
another, ranging from 244196001 to 244198384. Small difference, but
significant nonetheless if this means that data can be lost. So I looked
for a number of blocks that would be the same for all disks. But the
number of blocks cannot be imposed when creating a partition, only the
number of cylinders.

On the disks with 244196001 blocks, 'fdisk -l' says:
	Units = cylinders of 16065 * 512 = 8225280 bytes

For the other half, it says:
	Units = cylinders of 2048 * 512 = 1048576 bytes

Since 16065 and 2048 have no common divisor, the smallest multiple common
to 8225280 and 1048576 is 8225280 × 1048576 / 512 = 16845373440. Thus
trying to have exactly the same number of bytes in each partition means
choosing a partition size that is a multiple of roughly 16 GB. Now the
total size (250059350016) divided by this step (16845373440) is roughly
14.84. I can only have 14 steps, leading to a partition size of
235835228160 and a loss of \approx 15 GB per disk or 150 GB total. That's
a lot.


Now I imagine that there might be embedded in mdadm a correction
mechanism. Since each partition is divided into stripes, the number of
stripes for each disk could be the number of stripes on the smallest
partition of the array. Thus I could create partitions as big as each disk
supports, and 'mdadm' would take care of the small differences. I'd have
my 150 GB back.

Could you tell me if such a mechanism exists in mdadm?
Or should I accept the "loss" of the 150 GB?


Thanks a lot for your help!
Sébastien.
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Partitions with == or \approx same size ?
  2007-07-20 17:54 Partitions with == or \approx same size ? Seb
@ 2007-07-20 19:48 ` Robin Hill
  2007-07-20 21:48 ` Neil Brown
  2007-07-21  9:25 ` Luca Berra
  2 siblings, 0 replies; 7+ messages in thread
From: Robin Hill @ 2007-07-20 19:48 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

On Fri Jul 20, 2007 at 07:54:54PM +0200, Seb wrote:

> But the number of blocks cannot be imposed when creating a partition,
> only the number of cylinders.
> 
If you hit "u" in fdisk then you can create partitions by sector rather
than by cylinder.

HTH,
        Robin
-- 
     ___        
    ( ' }     |       Robin Hill        <robin@robinhill.me.uk> |
   / / )      | Little Jim says ....                            |
  // !!       |      "He fallen in de water !!"                 |

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Partitions with == or \approx same size ?
  2007-07-20 17:54 Partitions with == or \approx same size ? Seb
  2007-07-20 19:48 ` Robin Hill
@ 2007-07-20 21:48 ` Neil Brown
  2007-07-21  0:41   ` Seb
  2007-07-21  9:25 ` Luca Berra
  2 siblings, 1 reply; 7+ messages in thread
From: Neil Brown @ 2007-07-20 21:48 UTC (permalink / raw)
  To: Seb; +Cc: linux-raid

On Friday July 20, seb@h-k.fr wrote:
> 
> Could you tell me if such a mechanism exists in mdadm?
> Or should I accept the "loss" of the 150 GB?

When you give mdadm a collection of drives to turn into a RAID array,
use bases the size of the array on the smallest device.

You might want to make it a little smaller still in case you have to
replace a device with a slightly smaller device (it happens).  You can
use "--size" to reduce the used space a little further if you like.

NeilBrown

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Partitions with == or \approx same size ?
  2007-07-20 21:48 ` Neil Brown
@ 2007-07-21  0:41   ` Seb
  2007-07-21  7:02     ` Neil Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Seb @ 2007-07-21  0:41 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid


Hi Neil,


| > Could you tell me if such a mechanism exists in mdadm?
| > Or should I accept the "loss" of the 150 GB?
| When you give mdadm a collection of drives to turn into a RAID array,
| use bases the size of the array on the smallest device.

I'm sorry I don't know what "bases" are in a RAID array and I can't find
this term in the man page. Could you elaborate?

| You might want to make it a little smaller still in case you have to
| replace a device with a slightly smaller device (it happens).  You can
| use "--size" to reduce the used space a little further if you like.

Thanks for the pointer to --size! I had overlooked this option. The man
page says that "If  this is not specified (as it normally is not) the
smallest drive (or partition) sets the size". This implies that partitions
need not have exactly the same size and 'mdadm' will still manage.

So I'll use 249,9GB out of 250GB, skip over the small resulting
differences, let mdadm work its magic and when new disks will be inserted
after a failure it will suffice to use their total space.


Best,
Sébastien.
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Partitions with == or \approx same size ?
  2007-07-21  0:41   ` Seb
@ 2007-07-21  7:02     ` Neil Brown
  2007-07-21 12:41       ` Seb
  0 siblings, 1 reply; 7+ messages in thread
From: Neil Brown @ 2007-07-21  7:02 UTC (permalink / raw)
  To: Seb; +Cc: linux-raid

On Saturday July 21, seb@h-k.fr wrote:
> 
> Hi Neil,
> 
> 
> | > Could you tell me if such a mechanism exists in mdadm?
> | > Or should I accept the "loss" of the 150 GB?
> | When you give mdadm a collection of drives to turn into a RAID array,
> | use bases the size of the array on the smallest device.
> 
> I'm sorry I don't know what "bases" are in a RAID array and I can't find
> this term in the man page. Could you elaborate?

Typo.  Should be
    It bases the size of the array ...

i.e. it works out which is the smaller device, and uses that size to
determine the size of the array.  e.g. if you are making a raid5 with
4 drives, then the array will be 3 times the size of the smallest array.

> 
> | You might want to make it a little smaller still in case you have to
> | replace a device with a slightly smaller device (it happens).  You can
> | use "--size" to reduce the used space a little further if you like.
> 
> Thanks for the pointer to --size! I had overlooked this option. The man
> page says that "If  this is not specified (as it normally is not) the
> smallest drive (or partition) sets the size". This implies that partitions
> need not have exactly the same size and 'mdadm' will still manage.

Exactly.

> 
> So I'll use 249,9GB out of 250GB, skip over the small resulting
> differences, let mdadm work its magic and when new disks will be inserted
> after a failure it will suffice to use their total space.

Again, exactly correct.

NeilBrown

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Partitions with == or \approx same size ?
  2007-07-20 17:54 Partitions with == or \approx same size ? Seb
  2007-07-20 19:48 ` Robin Hill
  2007-07-20 21:48 ` Neil Brown
@ 2007-07-21  9:25 ` Luca Berra
  2 siblings, 0 replies; 7+ messages in thread
From: Luca Berra @ 2007-07-21  9:25 UTC (permalink / raw)
  To: linux-raid

On Fri, Jul 20, 2007 at 07:54:54PM +0200, Seb wrote:
>
>Dear all,
>
>
>First I'd like to thank you for the great work you've done with mdadm.
>It's flexible, powerful and reasonably easy to use.
>
>I have a question that seems both important for the redundancy of my RAID6
>devices and too sharp for me, my friends and the newsgroup
>fr.comp.stockage . I think your understanding of the inner workings of
>mdadm should allow you to already know the answer.
>
>A 12-disks machine was recently assembled with disks coming from several
>sources (Linux Ubuntu server, kernel 2.6.15, RAID6 array). All 12 disks
>are S-ATA with 250 GB capacity.
>
>I understand that partitions should have the same size, meaning the same
>number of bytes. All 12 disks have exactly 250059350016 bytes, but the
>number of blocks that can be allocated are not the same from one disk to
>another, ranging from 244196001 to 244198384. Small difference, but
>significant nonetheless if this means that data can be lost. So I looked
>for a number of blocks that would be the same for all disks. But the
>number of blocks cannot be imposed when creating a partition, only the
>number of cylinders.

since we are living with machines based on a 1980 design,
the usable size of a partitioned device is rounded to disk geometry,
and geometry is read from the partition table (if there is one)
oh, geometry has no real meaning in modern disk drives.


>On the disks with 244196001 blocks, 'fdisk -l' says:
>	Units = cylinders of 16065 * 512 = 8225280 bytes
this disk has 255 head and 63 sectors per track
usable space is
int(size/H/S/512)*H*S*512-S*512   # the subtraction here is to account
                                  # for space used by partition table
int (250059350016/255/63/512) = 30401
30401*255*63*512-63*512 = 250056705024
250056705024 / 1024 = 244196001 *BINGO*

>For the other half, it says:
>	Units = cylinders of 2048 * 512 = 1048576 bytes
this one might be 128H 16S, or any other combination for that matter,
let's see
int (250059350016/1048576) = 238475
238475 * 1048576 = 250059161600
your resulting space is 244198384K
244198384 * 1024 = 250059145216
250059161600 - 250059145216 = 16384 (space used by partition)
16384k is 32 sectors...
so geometry for this one is 238475 Cyl, 64 Heads, 32 Sectors

best thing you can do is make all disk have the same apparent geometry.
usually if you zap partition tables and reboot all disks should come up
with similar geometry.
another issue is to partition your drives with sfdisk, using -C, -H, -S
options to force a geometry.

L.


-- 
Luca Berra -- bluca@comedia.it
        Communication Media & Services S.r.l.
 /"\
 \ /     ASCII RIBBON CAMPAIGN
  X        AGAINST HTML MAIL
 / \
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Partitions with == or \approx same size ?
  2007-07-21  7:02     ` Neil Brown
@ 2007-07-21 12:41       ` Seb
  0 siblings, 0 replies; 7+ messages in thread
From: Seb @ 2007-07-21 12:41 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid


Hello Neil,


Thanks for the confirmations!
It's all very clear now. Case closed.


Best,
Seb.

On Sat, 21 Jul 2007, Neil Brown wrote:

| On Saturday July 21, seb@h-k.fr wrote:
| >
| > Hi Neil,
| >
| >
| > | > Could you tell me if such a mechanism exists in mdadm?
| > | > Or should I accept the "loss" of the 150 GB?
| > | When you give mdadm a collection of drives to turn into a RAID array,
| > | use bases the size of the array on the smallest device.
| >
| > I'm sorry I don't know what "bases" are in a RAID array and I can't find
| > this term in the man page. Could you elaborate?
|
| Typo.  Should be
|     It bases the size of the array ...
|
| i.e. it works out which is the smaller device, and uses that size to
| determine the size of the array.  e.g. if you are making a raid5 with
| 4 drives, then the array will be 3 times the size of the smallest array.
|
| >
| > | You might want to make it a little smaller still in case you have to
| > | replace a device with a slightly smaller device (it happens).  You can
| > | use "--size" to reduce the used space a little further if you like.
| >
| > Thanks for the pointer to --size! I had overlooked this option. The man
| > page says that "If  this is not specified (as it normally is not) the
| > smallest drive (or partition) sets the size". This implies that partitions
| > need not have exactly the same size and 'mdadm' will still manage.
|
| Exactly.
|
| >
| > So I'll use 249,9GB out of 250GB, skip over the small resulting
| > differences, let mdadm work its magic and when new disks will be inserted
| > after a failure it will suffice to use their total space.
|
| Again, exactly correct.
|
| NeilBrown
|

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-07-21 12:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-20 17:54 Partitions with == or \approx same size ? Seb
2007-07-20 19:48 ` Robin Hill
2007-07-20 21:48 ` Neil Brown
2007-07-21  0:41   ` Seb
2007-07-21  7:02     ` Neil Brown
2007-07-21 12:41       ` Seb
2007-07-21  9:25 ` Luca Berra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox