From owner-freebsd-current@FreeBSD.ORG Fri Jul 3 10:12:54 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5764106564A; Fri, 3 Jul 2009 10:12:54 +0000 (UTC) (envelope-from mexas@bristol.ac.uk) Received: from dirg.bris.ac.uk (dirg.bris.ac.uk [137.222.10.102]) by mx1.freebsd.org (Postfix) with ESMTP id 97D4A8FC18; Fri, 3 Jul 2009 10:12:54 +0000 (UTC) (envelope-from mexas@bristol.ac.uk) Received: from isis.bris.ac.uk ([137.222.10.63]) by dirg.bris.ac.uk with esmtp (Exim 4.69) (envelope-from ) id 1MMfl8-0005jG-9P; Fri, 03 Jul 2009 11:12:53 +0100 Received: from mech-cluster238.men.bris.ac.uk ([137.222.187.238]) by isis.bris.ac.uk with esmtp (Exim 4.67) (envelope-from ) id 1MMfl7-0002g1-Dy; Fri, 03 Jul 2009 11:12:45 +0100 Received: from mech-cluster238.men.bris.ac.uk (localhost.men.bris.ac.uk [127.0.0.1]) by mech-cluster238.men.bris.ac.uk (8.14.3/8.14.3) with ESMTP id n63ACiPF092311; Fri, 3 Jul 2009 11:12:44 +0100 (BST) (envelope-from mexas@bristol.ac.uk) Received: (from mexas@localhost) by mech-cluster238.men.bris.ac.uk (8.14.3/8.14.3/Submit) id n63ACgXm092310; Fri, 3 Jul 2009 11:12:42 +0100 (BST) (envelope-from mexas@bristol.ac.uk) X-Authentication-Warning: mech-cluster238.men.bris.ac.uk: mexas set sender to mexas@bristol.ac.uk using -f Date: Fri, 3 Jul 2009 11:12:42 +0100 From: Anton Shterenlikht To: Wojciech Puchar Message-ID: <20090703101242.GA59906@mech-cluster238.men.bris.ac.uk> References: <20090625110253.GA31443@mech-cluster238.men.bris.ac.uk> <10FCC74D-6D46-4112-AD89-BBB4C5933957@mac.com> <20090701105649.GA62596@mech-cluster238.men.bris.ac.uk> <20090702083709.GA66827@mech-cluster238.men.bris.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Spam-Score: -1.2 X-Spam-Level: - Cc: Marcel Moolenaar , Anton Shterenlikht , freebsd-questions@freebsd.org, freebsd-current@freebsd.org, freebsd-ia64@freebsd.org Subject: Re: gmirror per partition X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jul 2009 10:12:55 -0000 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) 34 819200 1 efi (400M) 819234 1048576 2 freebsd-ufs (512M) 1867810 4194304 3 freebsd-swap (2.0G) 6062114 2097152 4 freebsd-ufs (1.0G) 8159266 2097152 5 freebsd-ufs (1.0G) 10256418 25310027 6 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) 34 819200 1 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 Name Status 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 Name Status Components mirror/efi DEGRADED da0p1 da1p1 (44%) # gmirror status Name Status Components mirror/efi DEGRADED da0p1 da1p1 (87%) # gmirror status Name Status 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 Used Avail Capacity Mounted on /dev/da0p2 507630 35904 431116 8% / devfs 1 1 0 100% /dev /dev/da0p5 1012974 12 931926 0% /tmp /dev/da0p6 12252370 252608 11019574 2% /usr /dev/da0p4 1012974 242 931696 0% /var /dev/mirror/efi 409504 163264 246240 40% /mnt # again seems ok so I proceed to modify /etc/fstab and change da0p1 into mirror/efi # cat /etc/fstab # Device Mountpoint FStype Options Dump Pass# /dev/da0p3 none swap sw 0 0 /dev/da0p2 / ufs rw 1 1 /dev/mirror/efi /efi msdosfs rw 0 0 ^^^^^^^^^^^^^^^ /dev/da0p5 /tmp ufs rw 2 2 /dev/da0p6 /usr ufs rw 2 2 /dev/da0p4 /var ufs 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 Used Avail Capacity Mounted on /dev/da0p2 507630 35904 431116 8% / devfs 1 1 0 100% /dev /dev/da0p5 1012974 12 931926 0% /tmp /dev/da0p6 12252370 252608 11019574 2% /usr /dev/da0p4 1012974 242 931696 0% /var /dev/mirror/efi 409504 163264 246240 40% /efi # good, working! 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 Name Status 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? Also, if gmirror overwrites the last sector in the partition, then gmirror per partition cannot be used for /usr, because secondary GPT is stored in the last sector of /usr. Isn't it? 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