Re: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-07 Thread vermaden
 Good to see you've finally been burned.
 You'll never make that mistake again. :)

I liked that syntax:

ASD  {
  asd
} || {
  bsd
}

mostly because of syntax highlighting, to be precise highlighting
of the second bracket of a pair at editors, nor VIM neither GEANY
highlight if/then/elif/else/fi unfortunately, seems that I will have
to live with that ;p

 OK, I'll give that a try. Thanks for being persistent with me.

Did it worked?

Regards,
vermaden
--























...
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-07 Thread Randal L. Schwartz
 vermaden == vermaden  verma...@interia.pl writes:

 Good to see you've finally been burned.
 You'll never make that mistake again. :)

vermaden I liked that syntax:

vermaden ASD  {
vermaden   asd
vermaden } || {
vermaden   bsd
vermaden }

vermaden mostly because of syntax highlighting, to be precise highlighting
vermaden of the second bracket of a pair at editors, nor VIM neither GEANY
vermaden highlight if/then/elif/else/fi unfortunately, seems that I will have
vermaden to live with that ;p

Emacs indents it nicely, and colorizes the keywords so that it stands out.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-07 Thread vermaden
 Emacs indents it nicely, and colorizes the
 keywords so that it stands out.

Indentification is not a problem, it work both
in geany and vim.

Probably I haven't made clear what I meant ;)

Take a look at this picture:
http://ompldr.org/vZG50bQ

The brackets in that specific section (asd) are
highlighted, other are not, its not possible with
if/then/fi, only the keywords are highlighted,
but they are highlighted for the whole script so ... ;)

With { } I can also (un)fold the section/function,
its not possible with if/then/fi.

Regards,
vermaden
-- 








































...
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-05 Thread vermaden
 And no difference on 8.3 :(
 
 Should there have been a promote in there somewhere?  It looks like
 the boot env is still dependent on the very old zroot.

Hi,

I have just recreated from scratch Your zroot root
setup under VirtualBox and tested it deeply.

There was an interesting BUG in the *beadm* utility,
or maybe it is a BUG in sh(1), I do not have that
good knowledge of POSIX/sh(1) standards.

To the point, check these two code snippets, they should
do EXACLY the same, logic is the same, the differece is
only the syntax.

snippet 1:

[ ${MOUNT} -eq 0 ]  {
  zfs set mountpoint=${TMPMNT} ${POOL}/ROOT/${2}
  zfs mount ${POOL}/ROOT/${2}
} || {
  TMPMNT=${MOUNT}
}

snippet 2:

if [ ${MOUNT} -eq 0 ]; then
  zfs set mountpoint=${TMPMNT} ${POOL}/ROOT/${2}
  zfs mount ${POOL}/ROOT/${2}
else
  TMPMNT=${MOUNT}
fi

But unfortunately, it comes out that its not the same ...

[ ${MOUNT} -eq 0 ]  {
  zfs set mountpoint=${TMPMNT} ${POOL}/ROOT/${2}
  zfs mount ${POOL}/ROOT/${2}
  # IF THIS LINE ABOVE FAILS (NOT RETURN 0) THEN
  # TMPMNT=${MOUNT} BELOW WILL BE EXECUTED
} || {
  TMPMNT=${MOUNT}
}

The sollution can be put command that will always
work (return 0 on exit) like that:

[ ${MOUNT} -eq 0 ]  {
  zfs set mountpoint=${TMPMNT} ${POOL}/ROOT/${2}
  zfs mount ${POOL}/ROOT/${2}
  echo 1 /dev/null 2 /dev/null
} || {
  TMPMNT=${MOUNT}
}

... or to rewrite it under if/then/else which I did for the whole
*beadm* utility and I no longer use || and  syntax, anywhere.

As for Your problems, this worked for me on this VirtualBox test
environment.

# zfs promote zroot
# zfs rollback zpool@be
# zfs set mountpoint=/mnt zroot
[ set vfs.root.mountfrom=zfs:zroot in /mnt/boot/loader.conf ]
# zpool set bootfs=zroot zroot
# zfs set mountpoint=none zroot
# reboot

These above should bring back to the start point before
You entered my instructions to try *beadm* and BEs.

After reboot ...

# zfs destroy -R zroot/ROOT
# zfs create -o mountpoint=none zroot/ROOT
# zfs send zpool@be | zfs recv zroot/ROOT/be
# fetch https://raw.github.com/vermaden/beadm/master/beadm
# chmod +x beadm
# ./beadm list
# ./beadm activate be
# reboot

Now You should have a working system with boot environments.

Both GitHub and SourceForce have the latest fixed *beadm* version.

Regards,
vermaden
-- 








































...
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-05 Thread Randal L. Schwartz
 vermaden == vermaden  verma...@interia.pl writes:


vermaden To the point, check these two code snippets, they should
vermaden do EXACLY the same, logic is the same, the differece is
vermaden only the syntax.

vermaden snippet 1:

vermaden [ ${MOUNT} -eq 0 ]  {
vermaden   zfs set mountpoint=${TMPMNT} ${POOL}/ROOT/${2}
vermaden   zfs mount ${POOL}/ROOT/${2}
vermaden } || {
vermaden   TMPMNT=${MOUNT}
vermaden }

vermaden snippet 2:

vermaden if [ ${MOUNT} -eq 0 ]; then
vermaden   zfs set mountpoint=${TMPMNT} ${POOL}/ROOT/${2}
vermaden   zfs mount ${POOL}/ROOT/${2}
vermaden else
vermaden   TMPMNT=${MOUNT}
vermaden fi

No, no and no.  I got burned by that about 30 years ago in shell
programming.  Every time I see someone use that, I shriek just a little
bit.

vermaden ... or to rewrite it under if/then/else which I did for the whole
vermaden *beadm* utility and I no longer use || and  syntax,
vermaden anywhere.

Good to see you've finally been burned.  You'll never make that mistake
again. :)

vermaden After reboot ...

vermaden # zfs destroy -R zroot/ROOT
vermaden # zfs create -o mountpoint=none zroot/ROOT
vermaden # zfs send zpool@be | zfs recv zroot/ROOT/be
vermaden # fetch https://raw.github.com/vermaden/beadm/master/beadm
vermaden # chmod +x beadm
vermaden # ./beadm list
vermaden # ./beadm activate be
vermaden # reboot

vermaden Now You should have a working system with boot environments.

OK, I'll give that a try. Thanks for being persistent with me.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-04 Thread vermaden
 I have zfs-on-root using the classical documentation (everything under
 zpool, possibly with some sub-mounts, but I've left those out lately).
 
 Is there a way to transition my system to a form that beadm expects?
 I tried just running it, and it's upset that zpool/ROOT doesn't exist.

Hi,

I would suggest using something like that:

# zfs create -o mountpoint=none zpool/ROOT
# zfs snapshot zpool@be
# zfs clone zpool@be zpool/ROOT/default
# fetch https://github.com/vermaden/beadm/blob/master/beadm
# chmod +x beadm
# ./beadm list
# ./beadm activate default
# reboot

Be sure to use the latest *beadm* from one of these:
https://raw.github.com/vermaden/beadm/master/beadm
https://sourceforge.net/projects/beadm/

Let me know how these instructions work, especially if You got any errors or an 
unbootable system.

It would be best if You would test this zpool root to sys/ROOT/be transition 
under VirtualBox for 100% safety ;)

Regards,
vermaden
-- 








































...
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-04 Thread Randal L. Schwartz
 vermaden == vermaden  verma...@interia.pl writes:

vermaden # fetch https://github.com/vermaden/beadm/blob/master/beadm

Heh.  That's HTML.  I think you want

fetch https://raw.github.com/vermaden/beadm/master/beadm

vermaden # chmod +x beadm
vermaden # ./beadm list
vermaden # ./beadm activate default
vermaden # reboot

vermaden Be sure to use the latest *beadm* from one of these:
vermaden https://raw.github.com/vermaden/beadm/master/beadm
vermaden https://sourceforge.net/projects/beadm/

vermaden Let me know how these instructions work, especially if You got
vermaden any errors or an unbootable system.

Oh, that worked perfectly, except for an error message during the
create.

and after reboot, zfs set mountpoint=none zroot would also seem to
clean that up.

vermaden It would be best if You would test this zpool root to sys/ROOT/be 
transition under VirtualBox for 100% safety ;)

vermaden Regards,
vermaden vermaden
vermaden -- 








































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



-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-04 Thread Randal L. Schwartz
 Randal == Randal L Schwartz mer...@stonehenge.com writes:

 vermaden == vermaden  verma...@interia.pl writes:
vermaden # fetch https://github.com/vermaden/beadm/blob/master/beadm

Randal and after reboot, zfs set mountpoint=none zroot would also seem to
Randal clean that up.

Oh wait, it looks like zroot is still holding 1.04G of data... will
that ever go away?  Shouldn't all the data be in the /ROOT/xxx items?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-04 Thread Randal L. Schwartz
 Randal == Randal L Schwartz mer...@stonehenge.com writes:

Randal Oh wait, it looks like zroot is still holding 1.04G of data... will
Randal that ever go away?  Shouldn't all the data be in the /ROOT/xxx
Randal items?

And worse, the things from the readme don't work:

locohost# ./beadm create upgrade
cannot create 'zroot/ROOT/upgrade': invalid property ''
cannot open 'zroot/ROOT/upgrade': dataset does not exist
Created successfully

So, no joy on this yet.

This is FreeBSD 8.2.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-04 Thread Randal L. Schwartz
 Randal == Randal L Schwartz mer...@stonehenge.com writes:

Randal This is FreeBSD 8.2.

And no difference on 8.3 :(

Should there have been a promote in there somewhere?  It looks like
the boot env is still dependent on the very old zroot.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-04 Thread Bryan Drewery


On 5/4/2012 5:10 PM, Randal L. Schwartz wrote:
 Randal == Randal L Schwartz mer...@stonehenge.com writes:
 
 Randal Oh wait, it looks like zroot is still holding 1.04G of data... will
 Randal that ever go away?  Shouldn't all the data be in the /ROOT/xxx
 Randal items?
 
 And worse, the things from the readme don't work:
 
 locohost# ./beadm create upgrade
 cannot create 'zroot/ROOT/upgrade': invalid property ''
 cannot open 'zroot/ROOT/upgrade': dataset does not exist
 Created successfully
 
 So, no joy on this yet.
 
 This is FreeBSD 8.2.
 
Hi,

Those errors will be fixed in the next release, out in the next day or so.

Still testing it.

If you want to help test, it's out on vermaden's github right now.

An updated port will be available soon as well.

Regards,
Bryan Drewery
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-03 Thread vermaden
Hi,

 I just tested your tool the last few days and I must say I love
 it already. Though I can get one of the commands to work
 - might be me or the syntax
 
 beadm create [-e nonActiveBe | beName@snapshot] beName
 
 I read it as you can do the following
 
 beadm create beName@snapshot beName
 
 Is that correct or is it
 
 beadm create -e beName@snapshot beName
 
 Well neither of those seems to work for me, can you give an example of the 
 use?
 
 Thanks
 Kalle

There are only 3 possible ways:

1. beadm create beName - this will create BE beName from currently booted BE.

2. beadm create -e nonActiveBe beName - this will create BE beName from other 
BE called nonActiveBe

3. beadm create -e beName@snapshot beName - this will create BE beName from 
existing beName@snapshot snapshot

At least these are the same possibilities that beadm(1M) at Illumos/Solaris 
provides.

Hope that helps ;)

Regards,
vermaden

-- 








































...
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-03 Thread vermaden
Kalle Møller freebsd-questi...@k-moeller.dk:
 And I forgot
 
 If I do a create and destroy, I would assume my system
 was back to same state, but you keep the snapshot
 when I destroy the clone, dont know if its working as
 intended (better safe to keep it than sorry) or you just
 didn't think of it :)

I added automatic deletion of snapshot origins at later
versions, the 0.1 is now in Ports, but at SourceForge [1]
or GitHub [2] there is 0.4 version already, so get the
latest one, test more and let me know how the latest
version works for You ;)

[1] https://sourceforge.net/projects/beadm/
[2] https://github.com/vermaden/beadm

Regards,
vermaden
-- 








































...
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-02 Thread Kalle Møller
Hi vermaden

I just tested your tool the last few days and I must say I love it
already. Though I can get one of the commands to work - might be me or
the syntax

beadm create [-e nonActiveBe | beName@snapshot] beName

I read it as you can do the following

beadm create beName@snapshot beName

Is that correct or is it

beadm create -e beName@snapshot beName

Well neither of those seems to work for me, can you give an example of the use?

Thanks

Kalle

On Fri, Apr 27, 2012 at 1:08 AM, vermaden verma...@interia.pl wrote:
 Hi,

 I have just created new HOWTO [1] on how to use Boot Environments on
 FreeBSD with new created utility *beadm* that I put on SourceForge [2].

 Feel free to send Your ideas/critique about it.

 [1] http://forums.freebsd.org/showthread.php?t=31662
 [2] https://sourceforge.net/projects/beadm/

 Regards,
 vermaden






































 ...
 ___
 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



-- 

Med Venlig Hilsen

Kalle R. Møller
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-05-02 Thread Kalle Møller
And I forgot

If I do a create and destroy, I would assume my system was back to
same state, but you keep the snapshot when I destroy the clone, dont
know if its working as intended (better safe to keep it than sorry) or
you just didn't think of it :)

http://pastebin.com/XdYZ2eGR

main# zfs list -t all
NAME USED  AVAIL  REFER  MOUNTPOINT
sys 1.45G  6.36G31K  none
sys/ROOT 430M  6.36G31K  none
sys/ROOT/clean   430M  6.36G   430M  legacy
sys/swap1.03G  7.39G16K  -
main# beadm create main
Created successfully
main# zfs list -t all
NAME  USED  AVAIL  REFER  MOUNTPOINT
sys  1.45G  6.36G31K  none
sys/ROOT  430M  6.36G31K  none
sys/ROOT/clean430M  6.36G   430M  legacy
sys/ROOT/clean@main  0  -   430M  -
sys/ROOT/main   1K  6.36G   430M  none
sys/swap 1.03G  7.39G16K  -
main# beadm destroy main
Are you sure you want to destroy 'main'?
This action cannot be undone (y/[n]): y
Destroyed successfully
main# zfs list -t all
NAME  USED  AVAIL  REFER  MOUNTPOINT
sys  1.45G  6.36G31K  none
sys/ROOT  430M  6.36G31K  none
sys/ROOT/clean430M  6.36G   430M  legacy
sys/ROOT/clean@main  0  -   430M  -
sys/swap 1.03G  7.39G16K  -
main#

Kalle


On Wed, May 2, 2012 at 10:10 AM, Kalle Møller
freebsd-questi...@k-moeller.dk wrote:
 Hi vermaden

 I just tested your tool the last few days and I must say I love it
 already. Though I can get one of the commands to work - might be me or
 the syntax

 beadm create [-e nonActiveBe | beName@snapshot] beName

 I read it as you can do the following

 beadm create beName@snapshot beName

 Is that correct or is it

 beadm create -e beName@snapshot beName

 Well neither of those seems to work for me, can you give an example of the 
 use?

 Thanks

 Kalle

 On Fri, Apr 27, 2012 at 1:08 AM, vermaden verma...@interia.pl wrote:
 Hi,

 I have just created new HOWTO [1] on how to use Boot Environments on
 FreeBSD with new created utility *beadm* that I put on SourceForge [2].

 Feel free to send Your ideas/critique about it.

 [1] http://forums.freebsd.org/showthread.php?t=31662
 [2] https://sourceforge.net/projects/beadm/

 Regards,
 vermaden






































 ...
 ___
 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



 --

 Med Venlig Hilsen

 Kalle R. Møller



--

Med Venlig Hilsen

Kalle R. Møller
___
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: HOWTO: FreeBSD ZFS Madness (Boot Environments)

2012-04-27 Thread vermaden
 Hi,
 
 do you know manageBE? Google for it, it is the first
 hit. This works for me like a charm since about a year.
 
 Bye,
 Alexander.

Hi,

yes I know and used manageBE for a while, I even mentioned it
in the HOWTO (quote below) but thought that making *beadm*
that is compatible with Illumos/Solaris version would be nice
idea, *beadm* is also more comfortable to use, at least for me.

Mine *beadm* has also a feature to activate BE's from other
machines.
 
 Illumos/Solaris has the beadm(1M) [4] utility and while
 Philipp Wuensche wrote the manageBE script as
 replacement [5], it uses older style used at times when
 OpenSolaris (and SUN) were still having a great time.
 I last couple of days writing an up-to-date replacement for
 FreeBSD compatible beadm utility, and with some tweaks
 from today I just made it available at SourceForge [6] if You
 wish to test it. Currently its about 200 lines long, so it should
 be pretty simple to take a look at it. I tried to make it as
 compatible as possible with the 'upstream' version, along
 with some small improvements, it currently supports basic
 functions like list, create, destroy and activate.

(...)

 There are several subtle differences between mine
 implementation and Philipp's one, he defines and then relies
 upon ZFS property called freebsd:boot-environment=1 for
 each boot environment, I do not set any other additional
 ZFS properties. There is already org.freebsd:swap property
 used for SWAP on FreeBSD, so we may use org.freebsd:be in
 the future, but is just a thought, right now its not used. My
 version also supports activating boot environments received
 with zfs recv command from other systems (it just updates
 appreciate /boot/zfs/zpool.cache file).

Regards,
vermaden





























...

___
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