ZFS New Disk, new ZFS Pool - how? solved

Hello Forums

After a long time I'm again working with FreeBSD :)

My current 14.1 System had one disk ~40G which runs out of storage. I have a second disk available and want that disk to be a seperate ZFS POOL.


Code:
 % gpart show
=>      34  62984125  da0  GPT  (30G)
        34      2014       - free -  (1.0M)
      2048       345    1  freebsd-boot  (173K)
      2393     66584    2  efi  (33M)
     68977  62914560    3  freebsd-zfs  (30G)
  62983537       622       - free -  (311K)

=>      40  16777136  da1  GPT  (8.0G)
        40  12582832    1  freebsd-ufs  (6.0G)
  12582872   4194304    2  freebsd-swap  (2.0G)

And the ZFSPOOL looks like this
Code:
 % zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
zroot  29.5G  23.9G  5.59G        -         -    49%    81%  1.00x    ONLINE  -
viadmin@VIMS-ANSIBLE-01:~ % zfs list
NAME                                           USED  AVAIL  REFER  MOUNTPOINT
zroot                                         23.9G  4.68G   424K  none
zroot/ROOT                                    20.9G  4.68G   424K  none
zroot/ROOT/14.1-RELEASE-p3_2024-10-11_110122     8K  4.68G  11.6G  /
zroot/ROOT/14.1-RELEASE_2024-08-08_082248        8K  4.68G  5.32G  /
zroot/ROOT/default                            20.9G  4.68G  17.1G  /
zroot/home                                    2.10G  4.68G  2.10G  /home
zroot/tmp                                     2.05M  4.68G  2.05M  /tmp
zroot/usr                                     1.64M  4.68G   424K  /usr
zroot/usr/obj                                  420K  4.68G   420K  /usr/obj
zroot/usr/ports                                420K  4.68G   420K  /usr/ports
zroot/usr/src                                  420K  4.68G   420K  /usr/src
zroot/var                                      924M  4.68G   424K  /var
zroot/var/audit                                428K  4.68G   428K  /var/audit
zroot/var/crash                                424K  4.68G   424K  /var/crash
zroot/var/log                                  920M  4.68G   920M  /var/log
zroot/var/mail                                1.61M  4.68G  1.61M  /var/mail
zroot/var/tmp                                 1.06M  4.68G  1.06M  /var/tmp

As you can see there is not much free space left.
Since the storage is needed for data only, my idea is to use a seperate ZFS-POOL and don't add the new disk to the current pool

After fiddeling arround with gpart
% sudo gpart create -s GPT da2

I have a partition available
Code:
 % gpart show -lp
=>      34  62984125    da0  GPT  (30G)
        34      2014         - free -  (1.0M)
      2048       345  da0p1  bootfs  (173K)
      2393     66584  da0p2  efiesp  (33M)
     68977  62914560  da0p3  rootfs  (30G)
  62983537       622         - free -  (311K)

=>      40  16777136    da1  GPT  (8.0G)
        40  12582832  da1p1  (null)  (6.0G)
  12582872   4194304  da1p2  (null)  (2.0G)

=>       40  134217648  da2  GPT  (64G)
         40  134217648       - free -  (64G)

But this won't let me create a new ZFS Pool
Code:
 % zpool create storage /dev/da2
cannot use '/dev/da2': must be a block device or regular file

Lets play some more with gpart..
sudo gpart add -t freebsd-zfs da2

Code:
 % gpart show -lp
=>      34  62984125    da0  GPT  (30G)
        34      2014         - free -  (1.0M)
      2048       345  da0p1  bootfs  (173K)
      2393     66584  da0p2  efiesp  (33M)
     68977  62914560  da0p3  rootfs  (30G)
  62983537       622         - free -  (311K)

=>      40  16777136    da1  GPT  (8.0G)
        40  12582832  da1p1  (null)  (6.0G)
  12582872   4194304  da1p2  (null)  (2.0G)

=>       40  134217648    da2  GPT  (64G)
         40  134217648  da2p1  (null)  (64G)

ok, retry creating the pool
Code:
% zpool create storage /dev/da2p1
cannot use '/dev/da2p1': must be a block device or regular file

hmm now i'm not sure how to proceed further. From the handbook https://docs.freebsd.org/en/books/handbook/zfs/ (22.2.1 - The whole process looks a lot easier)


All the storage data (backup from other systems) is now in /filestore
My goal is to use the whole 64G from da2 as /filestore

Any guideances or ideas?

/BR
Philippe
 
I am not sure if this is corrrect:
After fiddeling arround with gpart
% sudo gpart create -s GPT da2

I have a partition available
I have found that in my history:
Code:
gpart add -t freebsd-zfs -a 1M -s 64G -l share-zfs /dev/nvd0
Please see /dev/nvd0 instead of nvd0. I am not sure if this makes a difference. The partition appears as below.
Code:
# gpart show -lp
=>        34  1000215149    nda0  GPT  (477G)
          34        2014          - free -  (1.0M)
        2048     1048576  nda0p1  (null)  (512M)
     1050624   268435456  nda0p2  (null)  (128G)
   269486080     2097152  nda0p3  (null)  (1.0G)
   271583232   268435456  nda0p4  zfs  (128G)
   540018688     4194304  nda0p5  freebsd-swap  (2.0G)
   544212992   134217728  nda0p6  share-zfs  (64G)
   678430720   321784463          - free -  (153G)
 
thank you chrbr

somehow this fixed the issue :)

I did destory the gpart and re-created it and all of a sudden the zpool-create command did work

Code:
% gpart show -lp
=>      34  62984125    da0  GPT  (30G)
        34      2014         - free -  (1.0M)
      2048       345  da0p1  bootfs  (173K)
      2393     66584  da0p2  efiesp  (33M)
     68977  62914560  da0p3  rootfs  (30G)
  62983537       622         - free -  (311K)

=>      40  16777136    da1  GPT  (8.0G)
        40  12582832  da1p1  (null)  (6.0G)
  12582872   4194304  da1p2  (null)  (2.0G)

=>       40  134217648    da2  GPT  (64G)
         40       2008         - free -  (1.0M)
       2048  134213632  da2p1  storage  (64G)
  134215680       2008         - free -  (1.0M)

% zpool list
NAME      SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
storage  63.5G  3.55G  59.9G        -         -     0%     5%  1.00x    ONLINE  -
zroot    29.5G  23.9G  5.56G        -         -    49%    81%  1.00x    ONLINE  -
viadmin@VIMS-ANSIBLE-01:~ %

thank you very much!!
 
Seeing that you had to sudo for gpart commands, don't you need to sudo for zpool as well?
I have both commands in the history, with and without sudo
You are right, i should have used sudo to use zpool, if that was the issue (which might was) the error message is for me a bit... unclear
 
You are right, i should have used sudo to use zpool, if that was the issue (which might was) the error message is for me a bit... unclear
Permissions on the disk devices prevent a 'regular' user from reading it, so it cannot determine what it is.
 
Back
Top