FreeBSD 7.3 root on ZFS mirror, change /etc/fstab if one disk fails ?

Hello. Help me please.
I'm installed FreeBSD 7.3-Release using 2 SATA 1TB disks, how described there

ad5 and ad6

MBR \ boot on UFS + root on ZFS

I'm have same bsdlabel on two disks:

Code:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a:  2097152        0    4.2BSD     4096 16384     8 
  b:  8388608  2097152      swap                    
  c: 1953525105        0    unused        0     0         # "raw" part, don't edit
  d: 1943039345 10485760    4.2BSD        0     0     0

a: -> for /bootdir ( /boot on ZFS links to -> bootdir/boot on UFS)
d: -> for ZFS

and mirrored one to other
Code:
$ zpool status
  pool: tank
 state: ONLINE
 scrub: none requested
config:

	NAME        STATE     READ WRITE CKSUM
	tank        ONLINE       0     0     0
	  mirror    ONLINE       0     0     0
	    ad6s1d  ONLINE       0     0     0
	    ad5s1d  ONLINE       0     0     0

errors: No known data errors

/etc/fstab on root ZFS:

Code:
$ cat /etc/fstab
# Device		Mountpoint	FStype	Options		Dump	Pass#
/dev/mirror/swap	none		swap	sw		0	0
/dev/ad5s1a		/bootdir	ufs	rw		1	0
/dev/ad6s1a		/mnt/bootdir	ufs	rw		1	0
/dev/acd0		/cdrom		cd9660	ro,noauto	0	0

Code:
$ cat /boot/loader.conf
geom_mirror_load="YES"
zfs_load="YES"
vfs.root.mountfrom="zfs:tank/root"

Code:
$ mount
tank/root on / (zfs, local)
devfs on /dev (devfs, local)
/dev/ad5s1a on /bootdir (ufs, local)
/dev/ad6s1a on /mnt/bootdir (ufs, local)
tank/jails on /jails (zfs, local)
tank/jails/ftp on /jails/ftp (zfs, local)
tank/jails/mail on /jails/mail (zfs, local)
tank/jails/www on /jails/www (zfs, local)
tank/tmp on /tmp (zfs, local)
tank/usr on /usr (zfs, local)
tank/var on /var (zfs, local)
/usr/ports on /jails/www/usr/ports (nullfs, local, noatime)
/usr/src on /jails/www/usr/src (nullfs, local, noatime, read-only)
devfs on /jails/www/dev (devfs, local)
/usr/ports on /jails/mail/usr/ports (nullfs, local, noatime)
/usr/src on /jails/mail/usr/src (nullfs, local, noatime, read-only)
devfs on /jails/mail/dev (devfs, local)
/usr/ports on /jails/ftp/usr/ports (nullfs, local, noatime)
/usr/src on /jails/ftp/usr/src (nullfs, local, noatime, read-only)
devfs on /jails/ftp/dev (devfs, local)

If ad6 fails - machine can boot and work online, but if ad5 fails... because this:
Code:
/dev/ad5s1a		/bootdir	ufs	rw		1	0
i'm need login to machine directly and change /dev/ad5s1a to /dev/ad6s1a in /etc/fstab to get machine back online...

The question is how change this automatically if ad5s1a or ad5 dont exists in /dev/ ?
 
It is better to use gmirror to mirror the 'a' partitions. If you name the mirror gm0, replace in fstab /dev/ad5s1a with /dev/mirror/gm0s1a.

An easy way to do it is this:

# gmirror label gm0 ad5
# gmirror insert gm0 ad6

wait for mirror to sync. you may check status with

# gmirror status

then go change /etc/fstab and reboot
 
danbi said:
It is better to use gmirror to mirror the 'a' partitions. If you name the mirror gm0, replace in fstab /dev/ad5s1a with /dev/mirror/gm0s1a.

An easy way to do it is this:

# gmirror label gm0 ad5
# gmirror insert gm0 ad6

wait for mirror to sync. you may check status with

# gmirror status

then go change /etc/fstab and reboot

I'm already mirrored the part of disk - ad5s1d to ad6s1d by ZFS, you think its good idea to mirror all disk with gmirror ?
 
You might find it more straightforward to go for a entirely-ZFS setup as described here (FreeBSD Wiki) or here (my page). It's really not necessary to keep your /boot directory in a UFS filesystem.
 
jem said:
You might find it more straightforward to go for a entirely-ZFS setup as described here (FreeBSD Wiki) or here (my page). It's really not necessary to keep your /boot directory in a UFS filesystem.

Yeah, agreed, but I'm using 7.3-RELENG and keep on ad5s1a and ad6s1a not only boot directory but all system which works like aid pack if crush occurs. Nice guides read them before to start install this system, but choose this one... Thank.
 
danbi said:
It is better to use gmirror to mirror the 'a' partitions. If you name the mirror gm0, replace in fstab /dev/ad5s1a with /dev/mirror/gm0s1a.

An easy way to do it is this:

# gmirror label gm0 ad5
# gmirror insert gm0 ad6

wait for mirror to sync. you may check status with

# gmirror status

then go change /etc/fstab and reboot

Thank, may be I'll try to mirror just ad5s1a to ad6s1a with gmirror...
 
I wonder why would anyone want to mirror swap?

There are sometimes problems with ZFS-only root (still, with 8-stable) when doing it with USB FLASH drives. The boot process would take much, much longer. No problems to boot fast, if there are no USB drives attached.

You should not mirror the entire disk with gmirror, as you are using ZFS, which can detect and heal data inconsistency.
 
What happens if one of the drives with an active swap partition die?
Without mirrored swap:
Programs crash. Worst case, OS spontaniously reboot.
With mirrored swap:
In theory, nothing.

It's all about reliability.
If you're now thinking "Yeah but you don't actually use swap": Then don't. Or mirror it, since having more/less swap space really doesn't matter when you don't actually use it. :)
 
Thank to all. Done this. Just use gmirror to mirror ad5s1a to ad6s1a -> /dev/mirror/gm0a

Code:
/dev/mirror/gm0a		/bootdir	ufs	rw		1	0

Now it works like planned, automatic boot if one disk fail, and no matter which one.

Question resolved. Thread may be closed. :)

Thank for help.
 
Back
Top