Solved extend ZFS partition

asteriskRoss

Well-Known Member

Thanks: 133
Messages: 418

#2
Yes this is possible, though best to back up before messing with partitions and filesystems :)

It looks like the partition hosts your root ZFS pool on your running system, so you should boot from your install media and select "Live CD" to change the partition size. Use the resize function of gpart(8). See the man page for syntax; something like gpart resize -i 3 /dev/da0.

For the ZFS pool to use the additional space you will need to set the autoexpand property of the pool to on. See the man page for zpool(8). This can be done from the Live CD when you import the ZFS pool ( zpool import -R /mnt -o autoexpand=on zfspoolname) or your running system ( zpool set autoexpand=on zfspoolname).
 
OP
OP
N

net_tech

Member

Thanks: 3
Messages: 60

#3
I was able to resize the /dev/da0 using gpart resize -i 3 /dev/da0, but autoexpand didn't work. zpool list returns zroot as the name. zpool set autoexpand=on zroot is accepted, but the available free space does not change.
 

maks

Member

Thanks: 4
Messages: 26

#6
Does not works for me... Have virtual server on the Vultr.
Code:
[root@server /home/user]# gpart show
=>       34  125829046  vtbd0  GPT  (60G)
         34        512      1  freebsd-boot  (256K)
        546    2097152      2  freebsd-swap  (1.0G)
    2097698   92274109      3  freebsd-zfs  (44G)
   94371807   31457273         - free -  (15G)

[root@server /home/user]# zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
pool0  43.8G  13.8G  30.0G        -         -    36%    31%  1.00x  ONLINE  -
[root@server /home/user]# zpool status
  pool: pool0
 state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
        still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
        the pool may no longer be accessible by software that does not support
        the features. See zpool-features(7) for details.
  scan: none requested
config:

        NAME         STATE     READ WRITE CKSUM
        pool0        ONLINE       0     0     0
          gpt/disk0  ONLINE       0     0     0

errors: No known data errors
[root@server /home/user]# zpool online -e pool0 vtbd0
cannot expand vtbd0: no such device in pool
[root@server /home/user]# zpool online -e pool0 /dev/vtbd0
cannot expand /dev/vtbd0: no such device in pool
[root@server /home/user]# zpool online -e pool0 gpt/disk0
[root@server /home/user]# gpart show
=>       34  125829046  vtbd0  GPT  (60G)
         34        512      1  freebsd-boot  (256K)
        546    2097152      2  freebsd-swap  (1.0G)
    2097698   92274109      3  freebsd-zfs  (44G)
   94371807   31457273         - free -  (15G)

[root@server /home/user]#
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 6,627
Messages: 28,191

#8
You forgot to resize the freebsd-zfs partition.
 

maks

Member

Thanks: 4
Messages: 26

#9
I tried yesterday and it did not work. But it done today. Thank you!

Code:
[root@server /home/user]# gpart show
=>       34  125829046  vtbd0  GPT  (60G)
         34        512      1  freebsd-boot  (256K)
        546    2097152      2  freebsd-swap  (1.0G)
    2097698   92274109      3  freebsd-zfs  (44G)
   94371807   31457273         - free -  (15G)

[root@server /home/user]# gpart resize -i 3 vtbd0p3
gpart: No such geom: vtbd0p3.
[root@server /home/user]# gpart resize -i 3 vtbd0
vtbd0p3 resized
[root@server /home/user]# gpart show
=>       34  125829046  vtbd0  GPT  (60G)
         34        512      1  freebsd-boot  (256K)
        546    2097152      2  freebsd-swap  (1.0G)
    2097698  123731382      3  freebsd-zfs  (59G)

[root@server /home/user]#
 

maks

Member

Thanks: 4
Messages: 26

#10
When I tried yesterday with gpart resize -i 3 vtbd0 and it resized just second part freebsd-swap. Today works fine. This is weird...
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 6,627
Messages: 28,191

#11
-i 3 is index number 3, which is your freebsd-zfs partition. Your freebsd-swap partition has index 2.
 
Top