Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 02 Dec 2012 00:29:39 +0600
From:      Boris Talovikov <boris.t.ru@mail.ru>
To:        current@freebsd.org
Subject:   gtpzfsboot: error 66
Message-ID:  <50BA4C93.9050105@mail.ru>

next in thread | raw e-mail | index | archive | help
please help
I migrate from ufs to zfs

I executed a script

    #!/bin/sh -v
    # $Id: zfs_install,v 1.3 2012/12/01 14:57:30 root Exp root $

    GEOM=ada0
    POOL=zroot
    POOL_CACHE=/tmp/zpool.cache
    MNT=/mnt
    BACKUP_FBSD=/media/hummingbird.tar.gz

    gpart backup $GEOM > /media/geom_backup_`date "+%s"`
    gpart destroy -F $GEOM
    gpart create -s gpt $GEOM
    gpart add -t freebsd-boot -a 4k -s 64k -l boot0 $GEOM
    gpart add -t freebsd-swap -a 4k -s 4G -l swap0 $GEOM
    gpart add -t freebsd-zfs -a 4k -l zroot0 $GEOM
    gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 $GEOM

    kldload opensolaris
    kldload zfs

    zpool create -f -o altroot=$MNT -o cachefile=$POOL_CACHE $POOL $GEOM\p3
    zfs set checksum=fletcher4 $POOL
    zfs create -o compression=on -o exec=on -o setuid=off $POOL/tmp
    chmod 1777 $MNT/tmp
    zfs create $POOL/usr
    zfs create $POOL/usr/local
    zfs create $POOL/home
    zfs create -o compression=lzjb -o setuid=off $POOL/usr/ports
    zfs create -o compression=off -o exec=off -o setuid=off
$POOL/usr/ports/distfiles
    zfs create -o compression=off -o exec=off -o setuid=off
$POOL/usr/ports/package
    zfs create -o compression=lzjb -o exec=off -o setuid=off $POOL/usr/src
    zfs create $POOL/var
    zfs create -o compression=lzjb -o exec=off -o setuid=off $POOL/var/crash
    zfs create -o exec=off -o setuid=off $POOL/var/db
    zfs create -o compression=lzjb -o exec=on -o setuid=off $POOL/var/db/pkg
    zfs create -o exec=off -o setuid=off $POOL/var/empty
    zfs create -o compression=lzjb -o exec=off -o setuid=off $POOL/var/log
    zfs create -o compression=gzip -o exec=off -o setuid=off $POOL/var/mail
    zfs create -o exec=off -o setuid=off $POOL/var/run
    zfs create -o compression=lzjb -o exec=on -o setuid=off $POOL/var/tmp
    chmod 1777 /mnt/var/tmp
    tar -xzvf $BACKUP_FBSD -C /
    echo zfs_enable=\"YES\" >> $MNT/etc/rc.conf
    echo zfs_load=\"YES\" >> $MNT/boot/loader.conf
    echo vfs.root.mountfrom=\"zfs:$POOL\" >> $MNT/boot/loader.conf
    mv $MNT/etc/fstab $MNT/etc/fstab_backup
    echo /dev/$GEOM\p2      none    swap    sw 0 0 > $MNT/etc/fstab

    zfs unmount -af
    zpool export $POOL
    zpool import -o cachefile=$POOL_CACHE -o altroot=$MNT $POOL
    zfs set mountpoint=/ $POOL
    zpool set bootfs=$POOL $POOL
    cp $POOL_CACHE $MNT/boot/zfs/
    zfs unmount -af
    zpool set cachefile='' $POOL
    zfs set mountpoint=legacy $POOL
    zfs set mountpoint=/tmp $POOL/tmp
    zfs set mountpoint=/usr $POOL/usr
    zfs set mountpoint=/var $POOL/var
    zfs set mountpoint=/home $POOL/home
    zfs set readonly=on $POOL/var/crash


result:

    # gpart show
    =>       34  488397101  ada0  GPT  (232G)
             34          6        - free -  (3.0k)
             40        128     1  freebsd-boot  (64k)
            168    8388608     2  freebsd-swap  (4.0G)
        8388776  480008352     3  freebsd-zfs  (228G)
      488397128          7        - free -  (3.5k)

    =>      63  62808001  da0  MBR  (30G)
            63      8001       - free -  (3.9M)
          8064  62800000    1  !12  (30G)

    =>       0  15687680  da1  BSD  (7.5G)
             0   1065680    1  freebsd-ufs  (520M)
       1065680  14622000       - free -  (7G)

    =>     63  3911617  da2  MBR  (1.9G)
           63       66       - free -  (33k)
          129  3911551    1  !6  (1.9G)
    # zpool list
    NAME          SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
    zroot   228G  24.9G   203G    10%  1.00x  ONLINE  -
    # zpool get all zroot
    NAME         PROPERTY       VALUE        SOURCE
    zroot  size           228G         -
    zroot  capacity       10%          -
    zroot  altroot        -            default
    zroot  health         ONLINE       -
    zroot  guid           16482364191304738607  default
    zroot  version        28           default
    zroot  bootfs         zroot  local
    zroot  delegation     on           default
    zroot  autoreplace    off          default
    zroot  cachefile      -            default
    zroot  failmode       wait         default
    zroot  listsnapshots  off          default
    zroot  autoexpand     off          default
    zroot  dedupditto     0            default
    zroot  dedupratio     1.00x        -
    zroot  free           203G         -
    zroot  allocated      24.9G        -
    zroot  readonly       off          -
    zroot  comment        -            default
    zroot  expandsize     0            -
    # zfs list
    NAME                              USED  AVAIL  REFER  MOUNTPOINT
    zroot                      24.9G   200G  1.09G  legacy
    zroot/home                 5.40G   200G  5.40G  /home
    zroot/tmp                   141M   200G   141M  /tmp
    zroot/usr                  17.6G   200G  7.85G  /usr
    zroot/usr/local            5.55G   200G  5.55G  /usr/local
    zroot/usr/ports            3.44G   200G  1.24G  /usr/ports
    zroot/usr/ports/distfiles  2.21G   200G  2.21G  /usr/ports/distfiles
    zroot/usr/ports/package      31K   200G    31K  /usr/ports/package
    zroot/usr/src               784M   200G   784M  /usr/src
    zroot/var                   698M   200G   131M  /var
    zroot/var/crash             402M   200G   402M  /var/crash
    zroot/var/db                144M   200G  91.6M  /var/db
    zroot/var/db/pkg           52.3M   200G  52.3M  /var/db/pkg
    zroot/var/empty              31K   200G    31K  /var/empty
    zroot/var/log              20.6M   200G  20.6M  /var/log
    zroot/var/mail               34K   200G    34K  /var/mail
    zroot/var/run              65.5K   200G  65.5K  /var/run
    zroot/var/tmp               286K   200G   286K  /var/tmp
    # zfs get all zroot
    NAME         PROPERTY              VALUE                  SOURCE
    zroot  type                  filesystem             -
    zroot  creation              Sat Dec  1 15:26 2012  -
    zroot  used                  24.9G                  -
    zroot  available             200G                   -
    zroot  referenced            1.09G                  -
    zroot  compressratio         1.06x                  -
    zroot  mounted               no                     -
    zroot  quota                 none                   default
    zroot  reservation           none                   default
    zroot  recordsize            128K                   default
    zroot  mountpoint            legacy                 local
    zroot  sharenfs              off                    default
    zroot  checksum              fletcher4              local
    zroot  compression           off                    default
    zroot  atime                 on                     default
    zroot  devices               on                     default
    zroot  exec                  on                     default
    zroot  setuid                on                     default
    zroot  readonly              off                    default
    zroot  jailed                off                    default
    zroot  snapdir               hidden                 default
    zroot  aclmode               discard                default
    zroot  aclinherit            restricted             default
    zroot  canmount              on                     default
    zroot  xattr                 on                     default
    zroot  copies                1                      default
    zroot  version               5                      -
    zroot  utf8only              off                    -
    zroot  normalization         none                   -
    zroot  casesensitivity       sensitive              -
    zroot  vscan                 off                    default
    zroot  nbmand                off                    default
    zroot  sharesmb              off                    default
    zroot  refquota              none                   default
    zroot  refreservation        none                   default
    zroot  primarycache          all                    default
    zroot  secondarycache        all                    default
    zroot  usedbysnapshots       0                      -
    zroot  usedbydataset         1.09G                  -
    zroot  usedbychildren        23.8G                  -
    zroot  usedbyrefreservation  0                      -
    zroot  logbias               latency                default
    zroot  dedup                 off                    default
    zroot  mlslabel                                     -
    zroot  sync                  standard               default
    zroot  refcompressratio      1.00x                  -
    zroot  written               1.09G                  -

system does not boot

    gtpzfsboot: error 66 lba 48
    gtpzfsboot: error 66 lba 1
    gtpzfsboot: No ZFS pools located, can't boot

please tell me what I'm doing wrong?

freebsd 10-current



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50BA4C93.9050105>