gmirror is confusing me, will I be bitten by the last-sector-use?

2006-02-21 Thread Eivind Olsen

Hello.

I've just configured a server to use gmirror (using FreeBSD 6.1b2). I 
followed the tutorial on 
http://www.onlamp.com/pub/a/bsd/2005/11/10/FreeBSD_Basics.html and did 
it install-time.
Then I read in the gmirror(8) man-page that gmirror uses the last sector 
of the provider to store metadata.


My mirror consists of two IDE-disks/consumers (ad0 and ad3), both 
showing a mediasize of 250059350016 (233G) in gmirror list. The 
provider is shown as having a mediasize of 250059349504. Sectorsize = 512.


Now, how can I check whether my current partitions will cause trouble 
with the metadata-sector or not? I've done some searching on the net, 
but I'm still a bit confused. If I understand correctly, the consumers 
ad0/ad2 span 488397168 sectors (mediasize/sectorsize), and the 
mirror/gm0 spans 488397167 sectors.


Here's the output from bsdlabel:

vimes# bsdlabel /dev/mirror/gm0s1
# /dev/mirror/gm0s1:
8 partitions:
#size   offsetfstype   [fsize bsize bps/cpg]
  a:  629145604.2BSD 2048 16384 28552
  b:  4194304  6291456  swap
  c: 4883920020unused0 0 # raw part, 
don't edit

  d: 41943040 104857604.2BSD 2048 16384 28552
  e:  2097152 524288004.2BSD 2048 16384 28552
  f: 31457280 545259524.2BSD 2048 16384 28552
  g: 31457280 859832324.2BSD 2048 16384 28552
  h: 370951490 1174405124.2BSD 2048 16384 28552

So, the h partition, which is the last one, has offset=117440512 and 
size=370951490, and if I add those together I get 488392002. Does this 
mean that my h partition ends at 488392001 (right before 488392002), 
and I'm still several sectors away from the metadata? Or am I 
misunderstanding things here?


--
Regards / Hilsen
Eivind Olsen
[EMAIL PROTECTED]
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: gmirror is confusing me, will I be bitten by the last-sector-use?

2006-02-21 Thread Ruslan Ermilov
On Tue, Feb 21, 2006 at 10:58:30AM +0100, Eivind Olsen wrote:
 Hello.
 
 I've just configured a server to use gmirror (using FreeBSD 6.1b2). I 
 followed the tutorial on 
 http://www.onlamp.com/pub/a/bsd/2005/11/10/FreeBSD_Basics.html and did 
 it install-time.
 Then I read in the gmirror(8) man-page that gmirror uses the last sector 
 of the provider to store metadata.
 
 My mirror consists of two IDE-disks/consumers (ad0 and ad3), both 
 showing a mediasize of 250059350016 (233G) in gmirror list. The 
 provider is shown as having a mediasize of 250059349504. Sectorsize = 512.
 
 Now, how can I check whether my current partitions will cause trouble 
 with the metadata-sector or not? I've done some searching on the net, 
 but I'm still a bit confused. If I understand correctly, the consumers 
 ad0/ad2 span 488397168 sectors (mediasize/sectorsize), and the 
 mirror/gm0 spans 488397167 sectors.
 
In short: kernel (g_mirror) won't let you write to the last sector of its
media.

 Here's the output from bsdlabel:
 
 vimes# bsdlabel /dev/mirror/gm0s1
 # /dev/mirror/gm0s1:
 8 partitions:
 #size   offsetfstype   [fsize bsize bps/cpg]
   a:  629145604.2BSD 2048 16384 28552
   b:  4194304  6291456  swap
   c: 4883920020unused0 0 # raw part, 
 don't edit
   d: 41943040 104857604.2BSD 2048 16384 28552
   e:  2097152 524288004.2BSD 2048 16384 28552
   f: 31457280 545259524.2BSD 2048 16384 28552
   g: 31457280 859832324.2BSD 2048 16384 28552
   h: 370951490 1174405124.2BSD 2048 16384 28552
 
 So, the h partition, which is the last one, has offset=117440512 and 
 size=370951490, and if I add those together I get 488392002. Does this 
 mean that my h partition ends at 488392001 (right before 488392002), 
 and I'm still several sectors away from the metadata? Or am I 
 misunderstanding things here?
 
Your c partition (the whole disk) occupies 488392002 sectors.
The h's partition last sector is 117440512+370951490-1=488392001.


Cheers,
-- 
Ruslan Ermilov
[EMAIL PROTECTED]
FreeBSD committer


pgpwOyU1JUUd2.pgp
Description: PGP signature


Re: gmirror is confusing me, will I be bitten by the last-sector-use?

2006-02-21 Thread [EMAIL PROTECTED]
  Now, how can I check whether my current partitions will cause trouble
  with the metadata-sector or not? I've done some searching on the net,
  but I'm still a bit confused. If I understand correctly, the consumers
  ad0/ad2 span 488397168 sectors (mediasize/sectorsize), and the
  mirror/gm0 spans 488397167 sectors.
 
 In short: kernel (g_mirror) won't let you write to the last sector of its
 media.


So long as your partition(s) exist(s) within the mirror device, you can't
problem the metadata.  If you tried writing to the last sectors of /dev/ad0
or /dev/ad2, you would damage or destroy the metadata.  So, don't do that.

I am curious about this case, does FreeBSD periodically check for the
existance of the metadata, or (like some things, the kernel for instance)
does it, once read and not rewritten, exist in memory, thus being able
to be written over on disk, not to be noticed until reboot (or modification,
if such would be your wont)?

--
--
___
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to [EMAIL PROTECTED]