negative free blocks after mirror! [was: Re: mirror without destroying existing contents]

2007-03-19 Thread Steve Franks

On 3/17/07, Jonathan McKeown [EMAIL PROTECTED] wrote:

On Friday 16 March 2007 21:48, Steve Franks wrote:
 On 3/16/07, John Nielsen [EMAIL PROTECTED] wrote:
  On Friday 16 March 2007 11:18, Steve Franks wrote:
   I get the following:
  
   #gmirror label -v -b split -s 1024 data ad0
   can't store metadata on ad0: operation not permitted.
 
  That most likely means that you currently have a filesystem on ad0
  mounted. If that's the case you should be glad that the OS was smarter
  than you. What steps had you taken prior to this?

 It appears to say in the manpage that you can do this on a disk with
 an existing filesys - would you expect it to work if the disk is
 unmounted first, then?

The way to do this is potentially a little risky but I haven't had a problem
with it yet after setting up several mirrors on live fileservers. There is a
sysctl called kern.geom.debugflags: if you set this to 16 it will allow you
to change the mounted filesystem. Bear in mind that since the metadata for
the mirror is written to the last sector of the disk, there is a small risk
of data loss: if that sector contains data it will be overwritten.

There's a thorough howto by Ralph Engelschall, and an OnLamp article by Dru
Lavigne, with more details:

http://people.freebsd.org/~rse/mirror/
http://www.onlamp.com/pub/a/bsd/2005/11/10/FreeBSD_Basics.html

Jonathan



Yes, the origonal disk was pretty full, but, I suspect this is not a good thing:

Filesystem  1K-blocks  Used Avail Capacity  Mounted on
/dev/ad0s1a507630 9525437176620%/
devfs   1 1 0   100%/dev
/dev/ad0s1e507630 30688436332 7%/tmp
/dev/ad0s1f 152451398   5956408 134298880 4%/usr
/dev/ad0s1d   1444526103600   1225364 8%/var
/dev/mirror/rainstones1 151368706 141135278  -1876068   101%/rainstone

How is that even possible?

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


Re: negative free blocks after mirror! [was: Re: mirror without destroying existing contents]

2007-03-19 Thread John Nielsen
On Monday 19 March 2007 10:46, Steve Franks wrote:
 Yes, the origonal disk was pretty full, but, I suspect this is not a good
 thing:

 Filesystem  1K-blocks  Used Avail Capacity  Mounted on
 /dev/ad0s1a507630 9525437176620%/
 devfs   1 1 0   100%/dev
 /dev/ad0s1e507630 30688436332 7%/tmp
 /dev/ad0s1f 152451398   5956408 134298880 4%/usr
 /dev/ad0s1d   1444526103600   1225364 8%/var
 /dev/mirror/rainstones1 151368706 141135278  -1876068   101%/rainstone

 How is that even possible?

This is a FAQ:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/disks.html#DISK-MORE-THAN-FULL

Not really related to gmirror.

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


Re: mirror without destroying existing contents

2007-03-17 Thread Jonathan McKeown
On Friday 16 March 2007 21:48, Steve Franks wrote:
 On 3/16/07, John Nielsen [EMAIL PROTECTED] wrote:
  On Friday 16 March 2007 11:18, Steve Franks wrote:
   I get the following:
  
   #gmirror label -v -b split -s 1024 data ad0
   can't store metadata on ad0: operation not permitted.
 
  That most likely means that you currently have a filesystem on ad0
  mounted. If that's the case you should be glad that the OS was smarter
  than you. What steps had you taken prior to this?

 It appears to say in the manpage that you can do this on a disk with
 an existing filesys - would you expect it to work if the disk is
 unmounted first, then?

The way to do this is potentially a little risky but I haven't had a problem 
with it yet after setting up several mirrors on live fileservers. There is a 
sysctl called kern.geom.debugflags: if you set this to 16 it will allow you 
to change the mounted filesystem. Bear in mind that since the metadata for 
the mirror is written to the last sector of the disk, there is a small risk 
of data loss: if that sector contains data it will be overwritten.

There's a thorough howto by Ralph Engelschall, and an OnLamp article by Dru 
Lavigne, with more details:

http://people.freebsd.org/~rse/mirror/
http://www.onlamp.com/pub/a/bsd/2005/11/10/FreeBSD_Basics.html

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


Re: mirror without destroying existing contents

2007-03-16 Thread Steve Franks

I get the following:

#gmirror label -v -b split -s 1024 data ad0
can't store metadata on ad0: operation not permitted.

Ideas?  Same behavior with /dev/ad0.  Does this only work with da0
disks, not sata drives?  I'm logged in as root, not su.  The drive is
on a promise non-raid sata card (the sw raid chipset on my asus bios
lost support going from 6.1 to 6.2 - something about some new method
not supported by the bios according to Soren).

Thanks,
Steve

On 3/13/07, John Nielsen [EMAIL PROTECTED] wrote:

On Tuesday 13 March 2007 15:12, Steve Franks wrote:
 Anyone made a mirror w/o destroying what's in the disk already?  The
 atacontrol man page is less than adequate in this respect...is is even
 possible?

If you want to use gmirror (which I recommend), the most conservative approach
is as follows. This can probably be adapted to other mirroring
techniques/software as well.

Verify that your backups are up-to-date and reliable.

Create a degraded single-member mirror on the blank disk (or a
partition/slice on said disk). (gmirror label command) Make sure that the
size of the disk/slice/partition is equal to or smaller than the size of the
disk/slice/partition which already contains your data.

Create (a) new filsystem(s) on the new mirror. (newfs and possibly bsdlabel,
depending on how/if you want to break it up)

Transfer your data from the existing filesystem to the new filesystem
(dump/restore -- it's easier than it sounds). (Alternative: restore from the
backup you created to begin with.)

Verify data transfer, make relevant changes to /etc/fstab, possibly other
intermediate steps.

Destroy the original filesystem (possibly using dd and /dev/zero) (not
strictly necessary, but wiping at least the first part of the
disk/slice/partition can help avoid potential confusion (for you and the
system) later.)

Insert the original disk/slice/partition into your new mirro (gmirror insert
command).

This approach can take longer than some others (due to the transfer
requirement), but the finished product is less likely to contain surprises. I
have successfully used this approach to migrate several types of volumes to
gmirror sets, including boot partitions.

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




--
Steve Franks, KE7BTE
Staff Engineer
La Palma Devices, LLC
http://www.lapalmadevices.com
(520) 312-0089
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: mirror without destroying existing contents

2007-03-16 Thread John Nielsen
On Friday 16 March 2007 11:18, Steve Franks wrote:
 I get the following:

 #gmirror label -v -b split -s 1024 data ad0
 can't store metadata on ad0: operation not permitted.

That most likely means that you currently have a filesystem on ad0 mounted. If 
that's the case you should be glad that the OS was smarter than you. What 
steps had you taken prior to this?

 Ideas?  Same behavior with /dev/ad0.  Does this only work with da0
 disks, not sata drives?  I'm logged in as root, not su.  The drive is
 on a promise non-raid sata card (the sw raid chipset on my asus bios
 lost support going from 6.1 to 6.2 - something about some new method
 not supported by the bios according to Soren).

Gmirror should work with any GEOM provider, and definitely works with SATA 
disks. As long as your controller is supported to the point of seeing and 
accessing the disks connected to it the software raid support is irrelevant 
(that's what you're using gmirror for).

JN

 On 3/13/07, John Nielsen [EMAIL PROTECTED] wrote:
  On Tuesday 13 March 2007 15:12, Steve Franks wrote:
   Anyone made a mirror w/o destroying what's in the disk already?  The
   atacontrol man page is less than adequate in this respect...is is even
   possible?
 
  If you want to use gmirror (which I recommend), the most conservative
  approach is as follows. This can probably be adapted to other mirroring
  techniques/software as well.
 
  Verify that your backups are up-to-date and reliable.
 
  Create a degraded single-member mirror on the blank disk (or a
  partition/slice on said disk). (gmirror label command) Make sure that the
  size of the disk/slice/partition is equal to or smaller than the size of
  the disk/slice/partition which already contains your data.
 
  Create (a) new filsystem(s) on the new mirror. (newfs and possibly
  bsdlabel, depending on how/if you want to break it up)
 
  Transfer your data from the existing filesystem to the new filesystem
  (dump/restore -- it's easier than it sounds). (Alternative: restore from
  the backup you created to begin with.)
 
  Verify data transfer, make relevant changes to /etc/fstab, possibly other
  intermediate steps.
 
  Destroy the original filesystem (possibly using dd and /dev/zero) (not
  strictly necessary, but wiping at least the first part of the
  disk/slice/partition can help avoid potential confusion (for you and the
  system) later.)
 
  Insert the original disk/slice/partition into your new mirro (gmirror
  insert command).
 
  This approach can take longer than some others (due to the transfer
  requirement), but the finished product is less likely to contain
  surprises. I have successfully used this approach to migrate several
  types of volumes to gmirror sets, including boot partitions.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: mirror without destroying existing contents

2007-03-16 Thread Steve Franks

On 3/16/07, John Nielsen [EMAIL PROTECTED] wrote:

On Friday 16 March 2007 11:18, Steve Franks wrote:
 I get the following:

 #gmirror label -v -b split -s 1024 data ad0
 can't store metadata on ad0: operation not permitted.

That most likely means that you currently have a filesystem on ad0 mounted. If
that's the case you should be glad that the OS was smarter than you. What
steps had you taken prior to this?




It appears to say in the manpage that you can do this on a disk with
an existing filesys - would you expect it to work if the disk is
unmounted first, then?

Steve

man gmirror:
Create a mirror on disk with valid data (note that the last sector of the
disk will be overwritten).  Add another disk to this mirror, so it will
be synchronized with existing disk:

   gmirror label -v -b round-robin data da0
   gmirror insert data da1


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


Re: mirror without destroying existing contents

2007-03-16 Thread John Nielsen
On Friday 16 March 2007 15:48, Steve Franks wrote:
 On 3/16/07, John Nielsen [EMAIL PROTECTED] wrote:
  On Friday 16 March 2007 11:18, Steve Franks wrote:
   I get the following:
  
   #gmirror label -v -b split -s 1024 data ad0
   can't store metadata on ad0: operation not permitted.
 
  That most likely means that you currently have a filesystem on ad0
  mounted. If that's the case you should be glad that the OS was smarter
  than you. What steps had you taken prior to this?

 It appears to say in the manpage that you can do this on a disk with
 an existing filesys - would you expect it to work if the disk is
 unmounted first, then?

 Steve

 man gmirror:
 Create a mirror on disk with valid data (note that the last sector of the
  disk will be overwritten).  Add another disk to this mirror, so it
 will be synchronized with existing disk:

  gmirror label -v -b round-robin data da0
  gmirror insert data da1
 

I would expect it to, yes.

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


Re: mirror without destroying existing contents

2007-03-13 Thread Chuck Swiger

On Mar 13, 2007, at 12:12 PM, Steve Franks wrote:

Anyone made a mirror w/o destroying what's in the disk already?  The
atacontrol man page is less than adequate in this respect...is is even
possible?


Oh, yes-- it's certainly possible to create a mirror with live data,  
but one is advised to be cautious and have a full backup available in  
case of problems.  With hardware-based ATA controllers like Promise,  
3ware, etc, they should have a BIOS utility which you can use to  
create the mirror-- make sure to add the drive with valid data first,  
and then add the second or additional drives to the mirror set.


The same approach ought to work with software-mirroring such as (g) 
vinum.


--
-Chuck

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


Re: mirror without destroying existing contents

2007-03-13 Thread John Nielsen
On Tuesday 13 March 2007 15:12, Steve Franks wrote:
 Anyone made a mirror w/o destroying what's in the disk already?  The
 atacontrol man page is less than adequate in this respect...is is even
 possible?

If you want to use gmirror (which I recommend), the most conservative approach 
is as follows. This can probably be adapted to other mirroring 
techniques/software as well.

Verify that your backups are up-to-date and reliable.

Create a degraded single-member mirror on the blank disk (or a 
partition/slice on said disk). (gmirror label command) Make sure that the 
size of the disk/slice/partition is equal to or smaller than the size of the 
disk/slice/partition which already contains your data.

Create (a) new filsystem(s) on the new mirror. (newfs and possibly bsdlabel, 
depending on how/if you want to break it up)

Transfer your data from the existing filesystem to the new filesystem 
(dump/restore -- it's easier than it sounds). (Alternative: restore from the 
backup you created to begin with.)

Verify data transfer, make relevant changes to /etc/fstab, possibly other 
intermediate steps.

Destroy the original filesystem (possibly using dd and /dev/zero) (not 
strictly necessary, but wiping at least the first part of the 
disk/slice/partition can help avoid potential confusion (for you and the 
system) later.)

Insert the original disk/slice/partition into your new mirro (gmirror insert 
command).

This approach can take longer than some others (due to the transfer 
requirement), but the finished product is less likely to contain surprises. I 
have successfully used this approach to migrate several types of volumes to 
gmirror sets, including boot partitions.

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


Re: mirror without destroying existing contents

2007-03-13 Thread David Robillard

Anyone made a mirror w/o destroying what's in the disk already?  The
atacontrol man page is less than adequate in this respect...is is even
possible?


Oh, yes-- it's certainly possible to create a mirror with live data,
but one is advised to be cautious and have a full backup available in
case of problems.  With hardware-based ATA controllers like Promise,
3ware, etc, they should have a BIOS utility which you can use to
create the mirror-- make sure to add the drive with valid data first,
and then add the second or additional drives to the mirror set.

The same approach ought to work with software-mirroring such as (g)
vinum.


I'd add gmirror(8) to the list of software RAID solutions.

Man page: 
http://www.freebsd.org/cgi/man.cgi?query=gmirrorapropos=0sektion=0manpath=FreeBSD+6.2-RELEASEformat=html

Handbook:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/book.html#GEOM-MIRROR

Cheers,

David
--
David Robillard
UNIX systems administrator  Oracle DBA
CISSP, RHCE  Sun Certified Security Administrator
Montreal: +1 514 966 0122
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]