exictent zroot re-alignment to 4K

Zeus Panchenko zeus at ibs.dn.ua
Tue Aug 27 15:16:18 UTC 2013


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

hi all,

please, I really need help ...

recently I noticed that my netbook HDD has 4K phys sectors and I think
it is worth to use that (is it really worth indeed?)

I have FreeBSD 9-STABLE running well on it already but when it was
installed, the alignment was not done properly ...

- --------------------------------------------------------------------
what I have:

> uname -a
FreeBSD 9.1-STABLE #17 r250823: Mon May 20 19:39:19 EEST 2013 amd64

> smartctl -a /dev/ada0
Model Family:     Western Digital Scorpio Black (AF)
Device Model:     WDC WD5000BPKT-60PK4T0
Serial Number:    WD-WXJ1A61P0560
User Capacity:    500,107,862,016 bytes [500 GB]
Sector Sizes:     512 bytes logical, 4096 bytes physical

> gpart show ada0
=>       34  976773101  ada0  GPT  (465G)
         34          6        - free -  (3.0k)
         40        128     1  freebsd-boot  (64k)
        168   33554432     2  freebsd-swap  (16G)
   33554600  943218528     3  freebsd-zfs  (449G)
  976773128          7        - free -  (3.5k)

> zdb
zroot:
    version: 5000
    name: 'zroot'
    ...
    vdev_tree:
	...
        children[0]:
            type: 'disk'
            id: 0
            path: '/dev/ada0p3'
            phys_path: '/dev/ada0p3'
            whole_disk: 1
            ashift: 9
    ...

> cat /boot/loader.conf
...
vfs.root.mountfrom="zfs:zroot"
...    



- --------------------------------------------------------------------
what I am thinking about:

1. to backup whole zroot
#> zfs send -r zroot at 2align > file

2. to plug HDD (let it be detected as adaX) on other system and to:
#> gpart destroy adaX
#> gpart create -s gpt adaX
#> gpart add -b 34 -s 94 -t freebsd-boot -l bootX adaX
#> gpart add -s 4G -t freebsd-swap -l swapX adaX
#> gpart add -a 1m -t freebsd-zfs -l diskX adaX
#> gpart bootcode -b /path/to/backuped/pmbr -p /path/to/backuped/gptzfsboot -i 1 adaX

#> gnop create -S 4096 gtp/diskX
#> zpool create zroot_z-hp gpt/diskX.nop
#> cat file | zfs receive -v zroot_z-hp

#> zpool export zroot_z-hp
#> zpool import -f -o cachefile=/tmp/zpool.cache -o altroot=/mnt zroot_z-hp
#> zfs set mountpoint=/root zroot_z-hp
#> cp /tmp/zpool.cache /mnt/root/boot/zfs/zpool.cache
#> vi /mnt/root/boot/loader.conf
  s/zroot/zroot_z-hp/
#> zfs umount /mnt/root
#> zfs set mountpoint=legacy zroot_z-hp
#> zpool export zroot_z-hp
#> gnop destroy gpt/disk0.nop

#> zpool import -d /dev/gpt/diskX
#> zpool export zroot_z-hp

3. return HDD to the netbook


so, am I right, is it correct way to re-align to 4K an existent ZFS
pool, will it work?

is ZFS version have to be the same on both systems (the one to be
aligned is shown as 5000 (after `zpool upgrade -a') while the one all
that stuff to be performed at is 28)?


- -- 
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)

iEYEARECAAYFAlIcwZ4ACgkQr3jpPg/3oyorGgCghK0E/Gl9pAi73V2jFVRk77mU
784AnivFBHqy00i4t+qvTHM1vZdIWqFf
=FsRY
-----END PGP SIGNATURE-----


More information about the freebsd-fs mailing list