Solved [Solved] Root boot ZFS mirror, change ashift.

Hi.

I've managed to create a FreeBSD installation on a ZFS mirror consisting of two identical 2TB drives. Each disk has a freebsd-boot, a freebsd-swap, and a freebsd-zfs partition. Both FreeBSD and my data is stored in the same pool. The major use is as a fileserver with Samba, but also web server.

It has been running smooth for about two months, but I've noticed that it´s slow.. When transferring a file (I have tested with files around 700MB) from the server to my computer, the transfer rate is only about 50% or less of what the gigabit Ethernet can handle, but when copying the same file directly again, the speed increases to almost 1GB/s. (I think this is because of caching?).

I've found out that this is a common problem concerning the ashift property. The ashift=9 on my installation. How do one change this to ashift=12 without loosing any data, settings or software? I suppose I need to split the mirror, and then somehow make a new ZFS pool on one disk, and then transfer the data to the other disk, make a new mirror, and make both disks bootable again.

Bäckman
 
Re: Root boot ZFS mirror, change ashift.

Hi @Backman!

Indeed, that´s what you need to do to change that 9 to a 12. Detach a drive from the mirror, repartition that drive (while taking care of proper alignment) and create a gnop device ontop of the label provider that you use to create the new pool with, e.g:
Code:
# zpool detach oldpool gpt/disk1
# gpart destroy -F <device>
# gpart create -s gpt <device>
# gpart add -t freebsd-boot -s 64k <device>
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 <device>
# gpart add -t freebsd-swap -b 2048 -s Xg -l swap1 <device>
# gpart add -t freebsd-zfs -a 4k -l disk1 <device>
# gnop create -S 4096 /dev/gpt/disk1
# zpool create newpool gpt/disk1.nop
# zpool export newpool
# gnop destroy /dev/gpt/disk1.nop
# zpool import -d /dev/gpt newpool
# zfs snapshot -r oldpool@now
# zfs send -R oldpool@now | zfs recv -dFu newpool

(Not taking into account that you may be booting from the pool. In that case you need to boot up from a Live-CD to do this)
# zpool destroy oldpool
# gpart destroy -F <device>
# gpart create -s gpt <device>
# gpart add -t freebsd-boot -s 64k <device>
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 <device>
# gpart add -t freebsd-swap -b 2048 -s Xg -l swap2 <device>
# gpart add -t freebsd-zfs -a 4k -l disk2 <device>
# zpool attach newpool gpt/disk1 gpt/disk2

Should be what you´re after. Can´t say if it´ll really make any difference in your transfers though...

/Sebulon
 
Last edited by a moderator:
Re: Root boot ZFS mirror, change ashift.

Hi again!

Thanks for your answer. I have detached one of the disks from the old pool. Next step is to clean the disk with gpart destroy -F <disk>, but I get the error: gpart: Device busy. (I thought that I had chose the wrong disk, but that was not the case).

Then I thought swap was the problem, so I edited /etc/fstab. After the reboot swapinfo shows no swap at all, but I still get the same error when using gpart.

How do I make the disk unbusy? Do I need to do this from Live-CD also?

Thanks for your help,
Bäckman

EDIT: I was able to delete the boot-, and zfs partition using gpart delete, but I was not able to delete the freebsd-swap. I get the same error as before: gpart: Device busy.
 
Re: Root boot ZFS mirror, change ashift.

Something still has that partition in use. swapoff -a might help.
 
Re: Root boot ZFS mirror, change ashift.

I tried that, with no luck. But I realised that I had the swap on some sort of gmirror. After removing the mirror I successfully deleted all partitions.
 
Re: Root boot ZFS mirror, change ashift.

Now I have managed to change that 9 to a 12.

Thanks for the help!
 
Back
Top