Re: gmirror per partition

2009-07-03 Thread Anton Shterenlikht
On Thu, Jul 02, 2009 at 03:48:41PM +0200, Wojciech Puchar wrote:
 
  # gmirror label -vb round-robin root /dev/da0p2
  gmirror: Can't store metadata on /dev/da0p2: Operation not permitted.
  isn't that partition accessed by other process or mounted?
 
  should it not be mounted?
 yes it should not, no matter what architecture.

ok, thank you

So how can I gmirror root partition? I can't unmount it, I think.
Perhaps I need to use a single-user mode?


Following is a gpart/gmirror report - some success and problems.

I did a fresh FBSD current install on ia64 on directly attached scsi, da0.

# gpart show
=  34  35566411  da0  GPT  (17G)
348192001  efi  (400M)
819234   10485762  freebsd-ufs  (512M)
   1867810   41943043  freebsd-swap  (2.0G)
   6062114   20971524  freebsd-ufs  (1.0G)
   8159266   20971525  freebsd-ufs  (1.0G)
  10256418  253100276  freebsd-ufs  (12G)

#

What I want is to mirror the whole of the boot disk to da1, which
is identical to da0, but following Marcel's advice, will apply
gmirror per partition.

So starting with efi partition:

First I create GPT scheme on da1

# gpart create -s gpt da1
da1 created
# gpart show da1
=  34  35566411  da1  GPT  (17G)
34  35566411   - free -  (17G)

#

then I create EFI partition of the same size as on the boot disk, da0.

# gpart add -b 34 -s 819200 -t efi da1
da1p1 added
# gpart show da1
=  34  35566411  da1  GPT  (17G)
348192001  efi  (400M)
819234  34747211   - free -  (17G)

#

then I umount /efi so that I can create gmirror label on da0p1.

# umount /efi
# gmirror label -vb round-robin efi /dev/da0p1
Metadata value stored on /dev/da0p1.
Done.
#

Checking gmirror

# gmirror status
  NameStatus  Components
mirror/efi  COMPLETE  da0p1
#

and another check

# gmirror list
Geom name: efi
State: COMPLETE
Components: 1
Balance: round-robin
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 3904698645
Providers:
1. Name: mirror/efi
   Mediasize: 419429888 (400M)
   Sectorsize: 512
   Mode: r0w0e0
Consumers:
1. Name: da0p1
   Mediasize: 419430400 (400M)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: NONE
   GenID: 0
   SyncID: 1
   ID: 1288665799

#

now insert a spare partition, da1p1, into the mirror

# gmirror insert efi /dev/da1p1

status looks fine

# gmirror status
  NameStatus  Components
mirror/efi  DEGRADED  da0p1
  da1p1 (44%)
# gmirror status
  NameStatus  Components
mirror/efi  DEGRADED  da0p1
  da1p1 (87%)
# gmirror status
  NameStatus  Components
mirror/efi  COMPLETE  da0p1
  da1p1
#

and another check

# gmirror list
Geom name: efi
State: COMPLETE
Components: 2
Balance: round-robin
Slice: 4096
Flags: NONE
GenID: 0
SyncID: 1
ID: 3904698645
Providers:
1. Name: mirror/efi
   Mediasize: 419429888 (400M)
   Sectorsize: 512
   Mode: r0w0e0
Consumers:
1. Name: da0p1
   Mediasize: 419430400 (400M)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: NONE
   GenID: 0
   SyncID: 1
   ID: 1288665799
2. Name: da1p1
   Mediasize: 419430400 (400M)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Priority: 0
   Flags: NONE
   GenID: 0
   SyncID: 1
   ID: 1724596009

#

So far, so good.

Now, I don't need to create the filesystem on the mirror, because EFI
was copied from da0p1 to da1p1.

So, I try to mount /dev/mirror/efi

# mount -t msdosfs /dev/mirror/efi /mnt
# df
Filesystem  1K-blocks   UsedAvail Capacity  Mounted on
/dev/da0p2 507630  35904   431116 8%/
devfs   1  10   100%/dev
/dev/da0p51012974 12   931926 0%/tmp
/dev/da0p6   12252370 252608 11019574 2%/usr
/dev/da0p41012974242   931696 0%/var
/dev/mirror/efi409504 163264   24624040%/mnt
#

again seems ok

so I proceed to modify /etc/fstab and change da0p1 into mirror/efi

# cat /etc/fstab
# DeviceMountpoint  FStype  Options DumpPass#
/dev/da0p3  noneswapsw  0   0
/dev/da0p2  /   ufs rw  1   1
/dev/mirror/efi /efimsdosfs rw  0   0
^^^
/dev/da0p5  /tmpufs rw  2   2
/dev/da0p6  /usrufs rw  2   2
/dev/da0p4  /varufs rw  2   2
/dev/acd0   /cdrom  cd9660  ro,noauto   0   0
#

now I can try to just mount /efi

# umount /mnt
# mount /efi
# df
Filesystem  1K-blocks   UsedAvail Capacity  Mounted on
/dev/da0p2 507630  35904   431116 8%/
devfs   1  10   100%/dev
/dev/da0p51012974 12   931926 0%/tmp
/dev/da0p6   12252370 252608 11019574 2%/usr
/dev/da0p41012974242   931696 0%/var
/dev/mirror/efi

Re: gmirror per partition

2009-07-03 Thread Alban Hertroys

On Jul 3, 2009, at 12:12 PM, Anton Shterenlikht wrote:


now to mirror root partition.

My problem is that root is mounted and cannot (?) be unmounted,  
unlike /efi,

on the live system.

# gpart add -b 819234 -s 1048576 -t freebsd-ufs da1
da1p2 added
#

# gmirror label -vb round-robin root /dev/da0p2
gmirror: Can't store metadata on /dev/da0p2: Operation not permitted.
#

If I create gmirror on da1, the spare disk:

# gmirror label -vb round-robin root /dev/da1p2
Metadata value stored on /dev/da0p1.
Done.
#

so that

# gmirror status
  NameStatus  Components
mirror/efi  COMPLETE  da0p1
  da1p1
mirror/root  COMPLETE  da1p2

#


then I still cannot insert da0p2


# gmirror insert root da0p2
gmirror: Cannot access provider da0p2.
#

So how can I gmirror root partion on a live system?


You're almost there... I did this a while ago, can't remember when,  
but I just upgraded the system that had this from FreeBSD 6.3 of  
sometime in 2006 to 7.2.


What I believe I did from this point on was:

Copy everything from the root partition to mirror/root.
Modify /etc/fstab to mount root on mirror/root.
Reboot.

Now the original root partition isn't mounted anymore, so we can do  
operate on it's geom stuff.


gmirror insert root da0p2

That should be it.
If that doesn't work you can always boot off a live file-system CD/DVD  
and perform these actions from there. You won't have man pages in that  
case though, or at least I couldn't find a way to read them off the  
DVD last I tried.


One thing I'd like to warn about at this point:
If you ever upgrade to a kernel with a newer geom metadata version and  
that new kernel crashes, you're left with a system where the new  
kernel can't boot at all while the old kernel can't mount the root  
mirror as it's now of a version it can't handle.
You can however mount a single geom provider of that root file system  
(/dev/da1p2 for example) to try to fix things.
That file-system WILL be dirty, but DON'T run fsck on it or you will  
destroy it's contents. That's what happened to my upgrade above...


Thankfully it was only my root partition with hardly any data on it  
and I did make level 0 dumps before the upgrade, but I needed to  
restore that FS from a fixit shell without man pages. Augh!



many thanks

--
Anton Shterenlikht
Room 2.6, Queen's Building
Mech Eng Dept
Bristol University
University Walk, Bristol BS8 1TR, UK
Tel: +44 (0)117 928 8233
Fax: +44 (0)117 929 4423
___
freebsd-curr...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org 








Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:760,4a4de90f759155226611503!


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


SUCCESS: Re: gmirror per partition

2009-07-03 Thread Anton Shterenlikht
On Fri, Jul 03, 2009 at 01:18:28PM +0200, Alban Hertroys wrote:
 On Jul 3, 2009, at 12:12 PM, Anton Shterenlikht wrote:
 
  now to mirror root partition.
 
  My problem is that root is mounted and cannot (?) be unmounted,  
  unlike /efi,
  on the live system.
 
  # gpart add -b 819234 -s 1048576 -t freebsd-ufs da1
  da1p2 added
  #
 
  # gmirror label -vb round-robin root /dev/da0p2
  gmirror: Can't store metadata on /dev/da0p2: Operation not permitted.
  #
 
  If I create gmirror on da1, the spare disk:
 
  # gmirror label -vb round-robin root /dev/da1p2
  Metadata value stored on /dev/da0p1.
  Done.
  #
 
  so that
 
  # gmirror status
NameStatus  Components
  mirror/efi  COMPLETE  da0p1
da1p1
  mirror/root  COMPLETE  da1p2
 
  #
 
 
  then I still cannot insert da0p2
 
 
  # gmirror insert root da0p2
  gmirror: Cannot access provider da0p2.
  #
 
  So how can I gmirror root partion on a live system?
 
 You're almost there... I did this a while ago, can't remember when,  
 but I just upgraded the system that had this from FreeBSD 6.3 of  
 sometime in 2006 to 7.2.
 
 What I believe I did from this point on was:
 
 Copy everything from the root partition to mirror/root.
 Modify /etc/fstab to mount root on mirror/root.
 Reboot.
 
 Now the original root partition isn't mounted anymore, so we can do  
 operate on it's geom stuff.
 
 gmirror insert root da0p2
 
 That should be it.
 If that doesn't work you can always boot off a live file-system CD/DVD  
 and perform these actions from there. You won't have man pages in that  
 case though, or at least I couldn't find a way to read them off the  
 DVD last I tried.
 
 One thing I'd like to warn about at this point:
 If you ever upgrade to a kernel with a newer geom metadata version and  
 that new kernel crashes, you're left with a system where the new  
 kernel can't boot at all while the old kernel can't mount the root  
 mirror as it's now of a version it can't handle.
 You can however mount a single geom provider of that root file system  
 (/dev/da1p2 for example) to try to fix things.
 That file-system WILL be dirty, but DON'T run fsck on it or you will  
 destroy it's contents. That's what happened to my upgrade above...
 
 Thankfully it was only my root partition with hardly any data on it  
 and I did make level 0 dumps before the upgrade, but I needed to  
 restore that FS from a fixit shell without man pages. Augh!

thank you, that was helpful.

I think I've got it, but it's a bit more complex on ia64
because /boot is a symlink to /efi/boot, which is a separate
partition.

Anyway, I've got:

# gmirror status
   NameStatus  Components
 mirror/efi  COMPLETE  da0p1
   da1p1
mirror/root  COMPLETE  da0p2
   da1p2
mirror/swap  COMPLETE  da0p3
   da1p3
 mirror/var  COMPLETE  da1p4
   da0p4
 mirror/tmp  COMPLETE  da1p5
   da0p5
 mirror/usr  DEGRADED  da1p6
   da0p6 (24%)
# 

I'll try to write up my experience and post later.

thanks again

-- 
Anton Shterenlikht
Room 2.6, Queen's Building
Mech Eng Dept
Bristol University
University Walk, Bristol BS8 1TR, UK
Tel: +44 (0)117 928 8233 
Fax: +44 (0)117 929 4423
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: gmirror per partition. Was: Re: gmirror gm0 destroyed on shutdown; GPT corrupt

2009-07-02 Thread Anton Shterenlikht
On Wed, Jul 01, 2009 at 10:00:54PM +0200, Wojciech Puchar wrote:
  It's better to use gmirror per partition.
 
  Like this?
 
  # gmirror label -vb round-robin root /dev/da0p2
  gmirror: Can't store metadata on /dev/da0p2: Operation not permitted.
 isn't that partition accessed by other process or mounted?

should it not be mounted?

Sorry, I was just following the handbook, but I now understand it is
incorrect when it comes to ia64.

many thanks
anton

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

-- 
Anton Shterenlikht
Room 2.6, Queen's Building
Mech Eng Dept
Bristol University
University Walk, Bristol BS8 1TR, UK
Tel: +44 (0)117 928 8233 
Fax: +44 (0)117 929 4423
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: gmirror per partition. Was: Re: gmirror gm0 destroyed on shutdown; GPT corrupt

2009-07-02 Thread Wojciech Puchar


# gmirror label -vb round-robin root /dev/da0p2
gmirror: Can't store metadata on /dev/da0p2: Operation not permitted.

isn't that partition accessed by other process or mounted?


should it not be mounted?

yes it should not, no matter what architecture.

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


Re: gmirror per partition. Was: Re: gmirror gm0 destroyed on shutdown; GPT corrupt

2009-07-01 Thread Wojciech Puchar

It's better to use gmirror per partition.


Like this?

# gmirror label -vb round-robin root /dev/da0p2
gmirror: Can't store metadata on /dev/da0p2: Operation not permitted.

isn't that partition accessed by other process or mounted?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org