From owner-freebsd-fs@FreeBSD.ORG Tue Apr 9 20:34:49 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9D42E836 for ; Tue, 9 Apr 2013 20:34:49 +0000 (UTC) (envelope-from jamebus@gmail.com) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx1.freebsd.org (Postfix) with ESMTP id 62A43C3B for ; Tue, 9 Apr 2013 20:34:49 +0000 (UTC) Received: by mail-ve0-f169.google.com with SMTP id d10so6961851vea.28 for ; Tue, 09 Apr 2013 13:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=FtOTs/76xizFkmSlPCOyM1NkV1DAF3S21b0U3Ibd94c=; b=f04Mj8GQYF1YJSePnsIOoiipnFK50MnmMvluccdDHQl7LsqtezM9Mpay37ZdudjuSe a01q9uuO7xioMhPH/rIQzHGJ4KnDYt0Z83v+jQEpVqlUMPyFOeE6VcJcsLxG3qw7mePA ROm7j7m06mQIN+O47o5MFWYWkzcNDFidxDLlHhMQx2Dia/0w4Ah2lVVzAPTThfXRg7rH 7pMIbzvi0/SV0dOVMkuoHCPiXVporztyDhdKpXM1C2OgXfvDjxG0BLnMH4F9g8KBRj30 4HRpR3Ecb+f5d1o1FvCILjWHM1/FGvxZlDeksY6hJPTaHOCr+0XGmnwSA3PBHSbDhoMH eXqA== MIME-Version: 1.0 X-Received: by 10.52.66.229 with SMTP id i5mr13079586vdt.131.1365539681904; Tue, 09 Apr 2013 13:34:41 -0700 (PDT) Sender: jamebus@gmail.com Received: by 10.58.34.243 with HTTP; Tue, 9 Apr 2013 13:34:41 -0700 (PDT) In-Reply-To: <51642E22.404@gmail.com> References: <9407C6ED-3B4C-4BA2-8B88-F8A998E0A847@free.de> <5162CBE8.5050104@madpilot.net> <51642E22.404@gmail.com> Date: Tue, 9 Apr 2013 15:34:41 -0500 X-Google-Sender-Auth: Un56fCTGKzASobc6RpNDu8hmdsk Message-ID: Subject: Re: FreeBSD 9.1 and swap on zfs From: James To: Volodymyr Kostyrko Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-fs@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Apr 2013 20:34:49 -0000 On Tue, Apr 9, 2013 at 10:05 AM, Volodymyr Kostyrko wrote: > Be sure to use -b prefer for that as when dump is written it goes to > the first component. Man page is a bit outdated as we currently miss > /etc/rc.early. Yes. rc.early hasn't worked in ages. But here's another way to do it. This assumes your swap mirror is called swap. /etc/rc.d/gmirror_savecore_pre: #!/bin/sh # # $Tilted$ # # PROVIDE: gmirror_savecore_pre # BEFORE: savecore # KEYWORD: nojail name='gmirror_savecore_pre' start_cmd='gmirror_savecore_pre_start' start_precmd='gmirror_savecore_pre_prestart' stop_cmd=':' gmirror_savecore_pre_prestart () { if ! gmirror status swap >/dev/null 2>&1; then debug 'No gmirror swap. Skipping.' return 1 fi return 0 } gmirror_savecore_pre_start () { gmirror configure -b prefer swap } load_rc_config $name run_rc_command "$1" /etc/rc.d/gmirror_savecore_post: #!/bin/sh # # $Tilted$ # # PROVIDE: gmirror_savecore_post # REQUIRE: savecore # KEYWORD: nojail name='gmirror_savecore_post' start_cmd='gmirror_savecore_post_start' start_precmd='gmirror_savecore_post_prestart' stop_cmd=':' gmirror_savecore_post_prestart () { if ! gmirror status swap >/dev/null 2>&1; then debug 'No gmirror swap. Skipping.' return 1 fi return 0 } gmirror_savecore_post_start () { gmirror configure -b load swap } load_rc_config $name run_rc_command "$1" I would prefer swap on a zvol, but it doesn't appear ready yet. At this time I allocate a swap partition in the gpt of every disk and gmirror the first two. If a disk failure happens, or looks like it might, I can simply add one of the spares. It works well. -- James.