Re: ZFS boot on zfs mirror

2009-05-26 Thread Mickael MAILLOT
Hi,

i prefere use zfsboot boot sector, an example is better than a long talk:

$ zpool create tank mirror ad4 ad6
$ zpool export tank
$ dd if=/boot/zfsboot of=/dev/ad4 bs=512 count=1
$ dd if=/boot/zfsboot of=/dev/ad6 bs=512 count=1
$ dd if=/boot/zfsboot of=/dev/ad4 bs=512 skeep=1  seek=1024
$ dd if=/boot/zfsboot of=/dev/ad6 bs=512 skeep=1  seek=1024
$ zpool import tank
$ zpool set bootfs=tank tank
$ zfs set mountpoint=legacy tank

add vfs.root.mountfrom=zfs:tank to your loader.conf
now you can boot on ad4 or ad6

Source:
http://www.waishi.jp/~yosimoto/diary/?date=20080909

2009/5/25 Philipp Wuensche cryx-free...@h3q.com:
 Lorenzo Perone wrote:

 Hello to all,

 Having licked blood now, and read the news from Kip Macy about

 -  zfs boot for all types now works


 I was wondering if anyone has some updated tutorial on how to achieve a
 zfs-only bootable FreeBSD with a mirrored zpool.

 My own howto and script to do the stuff automated:
 http://outpost.h3q.com/patches/manageBE/create-FreeBSD-ZFS-bootfs.txt

 But beware, it is meant to use with
 http://anonsvn.h3q.com/projects/freebsd-patches/wiki/manageBE
 afterwards. But the steps are the same.

 Searching around I found this tutorial on how to set up a ZFS bootable
 system, which is mostly straightforward:

 http://blogs.freebsdish.org/lulf/2008/12/16/setting-up-a-zfs-only-system/

 However it leaves a few questions open... How am I supposed to make a
 zfs mirror out of it? Suppose I have ad4 and ad6, should I repeat the
 exact same gpart-steps for both ad4 and ad6, and then make a zpool
 create data mirror ad4p3 ad6p3?

 Exactly.

 How about swap? I suppose it will be on
 one of the disks?

 I keep swap in a seperate partition. You could either use two swap
 partition, each on one disk or use gmirror to mirror a single swap
 partition to be safe from disk crash.

 And what if I start with one disk and add the second
 one later with zpool attach?

 This will work. Just do the same gpart commands on the second disk and
 use zpool attach.

 greetings,
 philipp

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

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


Re: ZFS boot on zfs mirror

2009-05-26 Thread Dmitry Morozovsky
On Tue, 26 May 2009, Mickael MAILLOT wrote:

MM Hi,
MM 
MM i prefere use zfsboot boot sector, an example is better than a long talk:
MM 
MM $ zpool create tank mirror ad4 ad6
MM $ zpool export tank
MM $ dd if=/boot/zfsboot of=/dev/ad4 bs=512 count=1
MM $ dd if=/boot/zfsboot of=/dev/ad6 bs=512 count=1
MM $ dd if=/boot/zfsboot of=/dev/ad4 bs=512 skeep=1  seek=1024
MM $ dd if=/boot/zfsboot of=/dev/ad6 bs=512 skeep=1  seek=1024

s/skeep/skip/ ? ;-)

MM $ zpool import tank
MM $ zpool set bootfs=tank tank
MM $ zfs set mountpoint=legacy tank
MM 
MM add vfs.root.mountfrom=zfs:tank to your loader.conf
MM now you can boot on ad4 or ad6
MM 
MM Source:
MM http://www.waishi.jp/~yosimoto/diary/?date=20080909

[snip]

-- 
Sincerely,
D.Marck [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer: ma...@freebsd.org ]

*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- ma...@rinet.ru ***

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


Re: ZFS boot on zfs mirror

2009-05-26 Thread Lorenzo Perone

Hi All,

Thanx for all the feedback!

Philipp: Your idea is really fine, with manageBE :)
Would surely be nice for a test/development machine,
I'll think about using it... (sounds a bit like
FreeBSD goin' the Nexenta way...)

Mickael: Your example looks much more like what I was
looking  for (and thank god UNIX still is mostly
ASCII so I can follow the link You posted).

But, just as a side question: how much of a risk of
creating an [ugly] race condition is it actually,
to use swap on a zvol?

Yet another question would be, how much is performance
impacted by the zfs overhead (ok, leaving aside that
a swapping system needs ram - wherever the swap is located...)?
But hey, snapshotting swap - isn't THAT funky? ;)

Thanx to all for the feedback, it's great to
be a FreeBSD user all the time!

I'll be trying to set this up ASAP.

Regards,

Lorenzo

On 26.05.2009, at 11:26, Mickael MAILLOT wrote:


Hi,

i prefere use zfsboot boot sector, an example is better than a long  
talk:


$ zpool create tank mirror ad4 ad6
$ zpool export tank
$ dd if=/boot/zfsboot of=/dev/ad4 bs=512 count=1
$ dd if=/boot/zfsboot of=/dev/ad6 bs=512 count=1
$ dd if=/boot/zfsboot of=/dev/ad4 bs=512 skeep=1  seek=1024
$ dd if=/boot/zfsboot of=/dev/ad6 bs=512 skeep=1  seek=1024
$ zpool import tank
$ zpool set bootfs=tank tank
$ zfs set mountpoint=legacy tank

add vfs.root.mountfrom=zfs:tank to your loader.conf
now you can boot on ad4 or ad6

Source:
http://www.waishi.jp/~yosimoto/diary/?date=20080909

2009/5/25 Philipp Wuensche cryx-free...@h3q.com:

Lorenzo Perone wrote:


Hello to all,

Having licked blood now, and read the news from Kip Macy about


-  zfs boot for all types now works



I was wondering if anyone has some updated tutorial on how to  
achieve a

zfs-only bootable FreeBSD with a mirrored zpool.


My own howto and script to do the stuff automated:
http://outpost.h3q.com/patches/manageBE/create-FreeBSD-ZFS-bootfs.txt

But beware, it is meant to use with
http://anonsvn.h3q.com/projects/freebsd-patches/wiki/manageBE
afterwards. But the steps are the same.

Searching around I found this tutorial on how to set up a ZFS  
bootable

system, which is mostly straightforward:

http://blogs.freebsdish.org/lulf/2008/12/16/setting-up-a-zfs-only-system/

However it leaves a few questions open... How am I supposed to  
make a
zfs mirror out of it? Suppose I have ad4 and ad6, should I repeat  
the

exact same gpart-steps for both ad4 and ad6, and then make a zpool
create data mirror ad4p3 ad6p3?


Exactly.


How about swap? I suppose it will be on
one of the disks?


I keep swap in a seperate partition. You could either use two swap
partition, each on one disk or use gmirror to mirror a single swap
partition to be safe from disk crash.


And what if I start with one disk and add the second
one later with zpool attach?


This will work. Just do the same gpart commands on the second disk  
and

use zpool attach.

greetings,
philipp

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




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



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


Re: ZFS boot on zfs mirror

2009-05-26 Thread George Hartzell
Dmitry Morozovsky writes:
  On Tue, 26 May 2009, Mickael MAILLOT wrote:
  
  MM Hi,
  MM 
  MM i prefere use zfsboot boot sector, an example is better than a long talk:
  MM 
  MM $ zpool create tank mirror ad4 ad6
  MM $ zpool export tank
  MM $ dd if=/boot/zfsboot of=/dev/ad4 bs=512 count=1
  MM $ dd if=/boot/zfsboot of=/dev/ad6 bs=512 count=1
  MM $ dd if=/boot/zfsboot of=/dev/ad4 bs=512 skeep=1  seek=1024
  MM $ dd if=/boot/zfsboot of=/dev/ad6 bs=512 skeep=1  seek=1024
  
  s/skeep/skip/ ? ;-)

What is the reason for copying zfsboot one bit at a time, as opposed
to 

  dd if=/boot/zfsboot of=/dev/ad4 bs=512 count=2

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


Re: ZFS boot on zfs mirror

2009-05-26 Thread Andriy Gapon
on 26/05/2009 19:21 George Hartzell said the following:
 Dmitry Morozovsky writes:
   On Tue, 26 May 2009, Mickael MAILLOT wrote:
   
   MM Hi,
   MM 
   MM i prefere use zfsboot boot sector, an example is better than a long 
 talk:
   MM 
   MM $ zpool create tank mirror ad4 ad6
   MM $ zpool export tank
   MM $ dd if=/boot/zfsboot of=/dev/ad4 bs=512 count=1
   MM $ dd if=/boot/zfsboot of=/dev/ad6 bs=512 count=1
   MM $ dd if=/boot/zfsboot of=/dev/ad4 bs=512 skeep=1  seek=1024
   MM $ dd if=/boot/zfsboot of=/dev/ad6 bs=512 skeep=1  seek=1024
   
   s/skeep/skip/ ? ;-)
 
 What is the reason for copying zfsboot one bit at a time, as opposed
 to 
 
   dd if=/boot/zfsboot of=/dev/ad4 bs=512 count=2

seek=1024 for the second part? and no 'count=1' for it? :-)

[Just guessing] Apparently the first block of zfsboot is some form of MBR and 
the
rest is zfs-specific code that goes to magical sector 1024.

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


Re: ZFS boot on zfs mirror

2009-05-26 Thread George Hartzell
Andriy Gapon writes:
  on 26/05/2009 19:21 George Hartzell said the following:
   Dmitry Morozovsky writes:
 On Tue, 26 May 2009, Mickael MAILLOT wrote:
 
 MM Hi,
 MM 
 MM i prefere use zfsboot boot sector, an example is better than a long 
   talk:
 MM 
 MM $ zpool create tank mirror ad4 ad6
 MM $ zpool export tank
 MM $ dd if=/boot/zfsboot of=/dev/ad4 bs=512 count=1
 MM $ dd if=/boot/zfsboot of=/dev/ad6 bs=512 count=1
 MM $ dd if=/boot/zfsboot of=/dev/ad4 bs=512 skeep=1  seek=1024
 MM $ dd if=/boot/zfsboot of=/dev/ad6 bs=512 skeep=1  seek=1024
 
 s/skeep/skip/ ? ;-)
   
   What is the reason for copying zfsboot one bit at a time, as opposed
   to 
   
 dd if=/boot/zfsboot of=/dev/ad4 bs=512 count=2
  
  seek=1024 for the second part? and no 'count=1' for it? :-)
  
  [Just guessing] Apparently the first block of zfsboot is some form of MBR 
  and the
  rest is zfs-specific code that goes to magical sector 1024.

Ok, I managed to read the argument to seek as one block, apparently
my coffee hasn't hit yet.

I'm still confused about the two parts of zfsboot and what's magical
about seeking to 1024.

g.

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


Re: ZFS boot on zfs mirror

2009-05-26 Thread Andriy Gapon
on 26/05/2009 19:42 George Hartzell said the following:
 I'm still confused about the two parts of zfsboot and what's magical
 about seeking to 1024.

Can't help with answer to this, but cc-ing the one who can (I think).
I am interested too :-)

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


Re: ZFS boot on zfs mirror

2009-05-26 Thread Doug Rabson

On Tue, 26 May 2009 19:57:03 +0300, Andriy Gapon a...@icyb.net.ua wrote:
 on 26/05/2009 19:42 George Hartzell said the following:
 I'm still confused about the two parts of zfsboot and what's magical
 about seeking to 1024.
 
 Can't help with answer to this, but cc-ing the one who can (I think).
 I am interested too :-)

This is due to the primitive DOS boot sequence. Basically the BIOS loads
the first sector of the partition and executes it. For zfsboot, that is the
first 512 bytes of /boot/zfsboot. The next stage of the bootstrap is tucked
away in a convenient hole in the ZFS on-disk formwat which is located just
after the ZFS metadata - this is the seek=1024 part. The first 512 byte
part is a tiny assembler program that loads the rest into memory and
executes it. The second part is large enough and smart enough to understand
the ZFS filesystem format directly and it loads /boot/loader directly from
the filesystem and transfers control to that. The third stage
(/boot/loader) is what puts up the boot menu and loads the kernel etc.

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


Re: ZFS boot on zfs mirror

2009-05-25 Thread Philipp Wuensche
Lorenzo Perone wrote:
 
 Hello to all,
 
 Having licked blood now, and read the news from Kip Macy about
 
 -  zfs boot for all types now works
 
 
 I was wondering if anyone has some updated tutorial on how to achieve a
 zfs-only bootable FreeBSD with a mirrored zpool. 

My own howto and script to do the stuff automated:
http://outpost.h3q.com/patches/manageBE/create-FreeBSD-ZFS-bootfs.txt

But beware, it is meant to use with
http://anonsvn.h3q.com/projects/freebsd-patches/wiki/manageBE
afterwards. But the steps are the same.

 Searching around I found this tutorial on how to set up a ZFS bootable
 system, which is mostly straightforward:
 
 http://blogs.freebsdish.org/lulf/2008/12/16/setting-up-a-zfs-only-system/
 
 However it leaves a few questions open... How am I supposed to make a
 zfs mirror out of it? Suppose I have ad4 and ad6, should I repeat the
 exact same gpart-steps for both ad4 and ad6, and then make a zpool
 create data mirror ad4p3 ad6p3? 

Exactly.

 How about swap? I suppose it will be on
 one of the disks?

I keep swap in a seperate partition. You could either use two swap
partition, each on one disk or use gmirror to mirror a single swap
partition to be safe from disk crash.

 And what if I start with one disk and add the second
 one later with zpool attach?

This will work. Just do the same gpart commands on the second disk and
use zpool attach.

greetings,
philipp

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