Naveen surisetty | 10 May 11:01 2011
Picon

ZFS backup and restore

Hi,

Is there a way to backup and restore entire machine without using zfs send/receive options. 

Will export /import will help?. I searched on internet but i am finding backup using send and receive.
Please suggest me 

Thanks in advance 
kumar
--

-- 
This message posted from opensolaris.org
Jim Klimov | 10 May 13:47 2011
Picon

How to add system-shutdown processing commands in OpenSolaris/Solaris11E/OI

Hello all,

A long while ago I made a package for NUT (Network UPS Tools) used in some of our projects since Solaris 8. Part
of this packaging involved changes to "/etc/rc0" scripts, with variants for Solaris 8 and 9, and for
Solaris 10 with SMF, example of the patch changes is attached below.

Currently on another occasion I want to add a watchdog cycle to force rebooting/halting with "uadmin" if
the pool export-on-shutdown hangs, as happens on my home test box too often.

The important part of these patches is adding a watchdog to the shutdown procedure, so that if it does not
complete in a timely fashion for any reason (in case of UPS - line power returns during shutdown/halt, and
the UPS never dies), and in such event the OS is forcibly rebooted. By adding the watchdog to "/etc/rc0" we
could avoid the watchdog being killed as any other system process (it is spawned after the kills).

These patches no longer work for OpenSolaris and its "SunOS 5.11" descendants, because all of that
shutdown logic is no longer in the scripts, but maybe in the binary svc.startd?..

Anyway, what is the proper way to add such special shutdown handlers to modern OpenSolaris versions and its kin?

Example of watchdog cycle in "/etc/rc0" for our NUT integration:

===
# cat /etc/ups/rc0.patch.sol10 
--- rc0.orig    Sat Jan 22 02:27:33 2005
+++ rc0 Thu Sep 28 16:06:15 2006
 <at>  <at>  -16,6 +16,16  <at>  <at> 

 PATH=/usr/sbin:/usr/bin

+# File used by NUT if shutting down because of UPS event
(Continue reading)

Eric Sproul | 10 May 16:32 2011

Re: ZFS backup and restore

On Tue, May 10, 2011 at 5:01 AM, Naveen surisetty
<naveenmailid@...> wrote:
> Hi,
>
> Is there a way to backup and restore entire machine without using zfs send/receive options.

Sure, just use any standard backup tool like Bacula, AMANDA,
NetBackup, tar/cpio, rsync, etc.

>
> Will export /import will help?. I searched on internet but i am finding backup using send and receive.
Please suggest me

Do you mean export/import of a zpool?  That's not really a backup
solution.  That's more for moving a pool from one machine to another.

Eric
Jim Klimov | 11 May 23:17 2011
Picon

Re: How to add system-shutdown processing commands in OpenSolaris/Solaris11E/OI

How that web-forum posts are emailed to the mail-list, "bump".

In short - what is the proper way to add special shutdown handlers to modern OpenSolaris versions and its kin
(OpenIndiala, Solaris 11 Express)? 

I want to extend some shutdown logic. In older Solaris 8-10 these fixes fit in /etc/rc0; now with SMF taking
over, I don't know where to put the logic so it works (and is not killed off during kill-all of unterminated processes).

Further details, if needed, are in my original forum post, as to not clutter the web: 
http://opensolaris.org/jive/thread.jspa?threadID=139052

Thanks,
//Jim Klimov
--

-- 
This message posted from opensolaris.org
alan pae | 12 May 21:39 2011

Re: How to add system-shutdown processing commands in OpenSolaris/Solaris11E/OI

You can either migrate it to SMF or if the old way works then just continue to use the old method.  

SMF and /etc/rc?.d are supported by Solaris 11 Express and all of the older versions. 

alan
--

-- 
This message posted from opensolaris.org
Jim Klimov | 13 May 21:01 2011
Picon

Re: How to add system-shutdown processing commands in OpenSolaris/Solaris11E/OI

Hello Alan, thanks for the reply, but I think your reply is about "normal" shutdown scripts used to
terminate a service properly.

Would this also work for scripts which change the shutdown logic of the OS itself? I mean not shutting down a
specific service and ending my script afterwards - I need to insert a sleeping watchdog loop which makes
sure that the system forcedly reboots in certain circumstances (explained in my original forum web-post
and reiterated below) - and I don't want this loop killed by "killall -9" lookalike which used to be in
/etc/rc0 and may now be in svc.startd or elsewhere. This logic must keep running until the OS uptime ends
one way or another.

Back in Solaris 8/9/10, the /etc/rc0 script was THE logic which led to system halt or reboot (sans the
reboot/halt/uadmin commands themselves). On the way it called the shutdown scripts, issued killall for
the leftover processes, and unmounted the filesystems, and reported 'The system is down.' And in my case -
after all that it spawned the watchdog loop, immune to killall because there were no killalls after that. 

In OpenSolaris and later /etc/rc0 only calls the legacy shutdown scripts, while the later half of the logic
is gone elsewhere (and I'm trying to discover - where).

Here's the pre-history of my question after all - for those who don't like to follow links (I had little hope
for that anyway ;) :

===
Hello all,

A long while ago I made a package for NUT (Network UPS Tools) used in some of our projects since Solaris 8. Part
of this packaging involved changes to "/etc/rc0" scripts, with variants for Solaris 8 and 9, and for
Solaris 10 with SMF, example of the patch changes is attached below.

Currently on another occasion I want to add a watchdog cycle to force rebooting/halting with "uadmin" if
the pool export-on-shutdown hangs, as happens on my home test box too often.
(Continue reading)

Jim Klimov | 13 May 23:01 2011
Picon

Re: How to add system-shutdown processing commands in OpenSolaris/Solaris11E/OI

Hello all,

Now that I think of it, and review the code more thoroughly, Solaris 10 (at least u6 and later) may have a
similar problem as OpenSolaris - much of the shutdown logic is already gone from /etc/rc0 - killalls in
particular, so in fact the Sol10 version of the script patch sleeps (if needed according to UPS-shutdown
logic) without exiting the script and without passing execution to filesystem export/unmounting which
is already elsewhere.

As it happens, my script was guaranteed to work as planned only in Sol 8 and 9 (where this added logic was in the
very end of script, after killalls and unmounts), and maybe in very early releases of 10 - I'm not sure now ;)

So my original question actually does pertain to Solaris 10 and newer in general - 
how can I plug in my modified shutown logic between "killall" and "export / umount" in one case, and between
"export / umount" and "halt / reboot" in another? Is it still possible in Solaris 10, OpenSolaris and
newer, or is all the shutdown logic not a script but a monolithic binary of some sort now?

Thanks,
//Jim Klimov
--

-- 
This message posted from opensolaris.org
alan pae | 13 May 23:53 2011

Re: How to add system-shutdown processing commands in OpenSolaris/Solaris11E/OI

> Hello Alan, thanks for the reply, but I think your
> reply is about "normal" shutdown scripts used to
> terminate a service properly.

Up until now I wasn't aware of an "abnormal" way to bring a system down.  The only other way that I know happens
when init 0 or init 5 hang and you eventually get mad and yank the power cord.  Which means that your script did
nothing. :-)

> Would this also work for scripts which change the
> shutdown logic of the OS itself? I mean not shutting
> down a specific service and ending my script
> afterwards - I need to insert a sleeping watchdog
> loop which makes sure that the system forcedly
> reboots in certain circumstances (explained in my
> original forum web-post and reiterated below) - and I
> don't want this loop killed by "killall -9" lookalike
> which used to be in /etc/rc0 and may now be in
> svc.startd or elsewhere. This logic must keep running
> until the OS uptime ends one way or another.

I'm only aware of two facilities.  smf which can disable the services one by one (svcadm enable/disable) or
in the cases of init 5 etc... stop everything or the old method with scripts in /etc/rc?.d linked to /etc/init.d.

> Back in Solaris 8/9/10, the /etc/rc0 script was THE
> logic which led to system halt or reboot (sans the
> reboot/halt/uadmin commands themselves). On the way
> it called the shutdown scripts, issued killall for
> the leftover processes, and unmounted the
> filesystems, and reported 'The system is down.' And
> in my case - after all that it spawned the watchdog
(Continue reading)

Jim Klimov | 14 May 04:38 2011
Picon

Re: How to add system-shutdown processing commands in OpenSolaris/Solaris11E/OI

Well, since I am not sure my Solaris 10 variant of the patch works properly with recent Solarises (last patch
revision was 5 years ago), here's the patched script back from Solaris 8 (yes, we have such boxes too). The
two blocks of added lines are prefixes with exclamations, as asked:

===
[root <at> sol8 /]# cat /etc/rc0
#!/sbin/sh
#
# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
# All rights reserved.
#
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
# Copyright (c) 1997-1999 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident  " <at> (#)rc0.sh     1.21    99/04/09 SMI"

# "Run Commands" for init states 0, 5 and 6.

PATH=/usr/sbin:/usr/bin

!# File used by NUT if shutting down because of UPS event
!UPSFLAG=/etc/ups/killpower
!# How long we wait after halt before reboot
!UPSWAIT=600
!# Flag used by us to trigger waiting
!_UPSPOWERDOWN=0
(Continue reading)

Jim Klimov | 14 May 05:26 2011
Picon

Re: How to add system-shutdown processing commands in OpenSolaris/Solaris11E/OI

Well, as I thought, all the killall and umountall logic moved to svc.startd. Particularly, to "graph.c",
function "do_uadmin" (thanks for pushing me in the right direction to look, at the very least):
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/svc/startd/graph.c

On one hand, I see that this replacement for killall only concerns user processes, so a background watchdog
loop in /etc/rc0 should (theoretically) live until system shutdown - that is, my second quest with
possibly hanging umounts.

But properly interfering with shutdown, regarding the UPS... I see little choice but to bring back all the
Solaris 8 logic (or rather external program calls from graph.c) into /etc/rc0 - if that script still plays
a role - specifically into my "wait until UPS dies or reboot" if-clause. Not cool :\

Thanks,
//Jim Klimov
--

-- 
This message posted from opensolaris.org

Gmane