resize ZFS
zfs
freebsd
raw
image
The disk.raw automatically on the firstboot will try to resize the disk
After booting the ZFS pool need to be increased:
$ gpart show da0
Example of output:
[email protected]/:~ # gpart show
=> 40 503316400 da0 GPT (240G)
40 1024 1 freebsd-boot (512K)
1064 2097152 2 freebsd-swap (1.0G)
2098216 984 - free - (492K)
2099200 2093056 3 freebsd-zfs (1.0G)
4192256 499124184 - free - (1.0M)
Then type gpart recover da0
:
$ gpart recover da0
da0 recovered
And next resize gpart resize -i 3 da0
:
$ gpart resize -i 3 da0
da0 resized
-i 3, 3 is the freebsd-zfs
After resizing:
[email protected]/:~ # gpart show
=> 40 503316400 da0 GPT (240G)
40 1024 1 freebsd-boot (512K)
1064 2097152 2 freebsd-swap (1.0G)
2098216 984 - free - (492K)
2099200 501217240 3 freebsd-zfs (239G)
Get zpool information by typing:
$ zdb
Find the children guid from the output:
zroot -> vdev_tree -> children[0] -> guid
[email protected]:/raw # zdb
zroot:
version: 5000
name: 'zroot'
state: 0
txg: 422
pool_guid: 5388488397555579451
hostid: 4037738314
hostname: ''
com.delphix:has_per_vdev_zaps
vdev_children: 1
vdev_tree:
type: 'root'
id: 0
guid: 5388488397555579451
create_txg: 4
children[0]:
type: 'disk'
id: 0
guid: 2304114010935459478
path: '/dev/gpt/disk0'
whole_disk: 1
metaslab_array: 37
metaslab_shift: 24
ashift: 12
asize: 8584429568
is_log: 0
create_txg: 4
com.delphix:vdev_zap_leaf: 35
com.delphix:vdev_zap_top: 36
features_for_read:
com.delphix:hole_birth
com.delphix:embedded_data
Resize the pool:
$ zpool online -e zroot 2304114010935459478
Check the pool:
[email protected]:/raw # zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
zroot 7.98G 258M 7.73G - 2% 3% 1.00x ONLINE -
readonly=off
Set the /
to readonly off:
$ zfs set readonly=off zroot/ROOT/default