exictent zroot re-alignment to 4K (end of story - final recipe)

Zeus Panchenko zeus at ibs.dn.ua
Thu Aug 29 11:58:26 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi all,

here is what I did and now I am happy with my ashifted to 12 zroot on my
netbook

1. Backup existent data
   zfs send -R zroot > latest.snap
   zpool export zroot

2. Destroy/Create partitions
   gpart destroy ada1
   gpart create -s gpt ada1
   gpart add -b 34 -s 94 -t freebsd-boot -l z-hp_boot ada1

   here it was surprise for me since gpart complained and I had to issue
   another options

   #> gpart add -b 34 -s 94 -t freebsd-boot -l z-hp_boot ada1
   ada1p1 added, but partition is not aligned on 4096 bytes
   #> gpart add -s 64K -t freebsd-boot -l z-hp_boot ada1
   ada1p1 added

   gpart add -s 4G -t freebsd-swap -l z-hp_swap ada1
   gpart add -a 1m -t freebsd-zfs -l z-hp_disk ada1
   gpart bootcode -b /path/to/backuped/pmbr -p /path/to/backuped/gptzfsboot -i 1 ada1

3. Create zpool and restore backup
   gnop create -S 4096 gpt/z-hp_disk
   zpool create z-hp_zroot gpt/z-hp_disk.nop
   cat latest.snap | zfs receive -Fv z-hp_zroot

4. Heal new zpool
   zpool export z-hp_zroot
   zpool import -f -o cachefile=/tmp/zpool.cache -o altroot=/mnt z-hp_zroot
   zfs set mountpoint=/ z-hp_zroot
   cp /tmp/zpool.cache /mnt/boot/zfs/zpool.cache

   vi /mnt/boot/loader.conf
   change vfs.root.mountfrom="zfs:zroot" => vfs.root.mountfrom="zfs:z-hp_zroot"
   vi /mnt/etc/fstab
   change /dev/gpt/swap0.eli => /dev/gpt/z-hp_swap.eli

   zfs umount /mnt
   zfs set mountpoint=legacy z-hp_zroot
   zpool export z-hp_zroot

5. Removing gnop
   gnop destroy gpt/z-hp_disk.nop

and now I have my system undamaged and zdb shows:
z-hp_zroot:
    version: 5000
    name: 'z-hp_zroot'
    ...
    vdev_tree:
        type: 'root'
	...
        children[0]:
            type: 'disk'
	    ...
            path: '/dev/ada0p3'
            phys_path: '/dev/ada0p3'
            whole_disk: 1
            ashift: 12
	    ...

thanks much to all

- -- 
Zeus V. Panchenko				jid:zeus at im.ibs.dn.ua
IT Dpt., I.B.S. LLC					  GMT+2 (EET)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iEYEARECAAYFAlIfN1gACgkQr3jpPg/3oyr5awCeOzHIFdxR7rZ60CJw9qQ71ePd
uQ4An07Xs2extRRDbG/vijgZ7WjNIaTZ
=y5yh
-----END PGP SIGNATURE-----


More information about the freebsd-fs mailing list