ZFS and space allocation - can`t understand

Hi everybody!
I have a server

Code:
FreeBSD freebsd 12.2-RELEASE FreeBSD 12.2-RELEASE r366954 GENERIC  amd64

I have two disks - 10G for the OS and 50G for DB Postgres.
I got the server preinstalled and I can`t do much with the hardware.
The system was preinstalled there and the admin then added a 50G disk for me to use it for DB storage.

I created pool, filesystem, set up Postgres and everything worked well.
But then I figured out that there is smth wrong with the disk space allocated.

I mean - I supposed that I would see space allocated on /pgdata , but I loose disk space on the root fs instead.

Code:
root@freebsd:/pgdata # df -H
Filesystem         Size    Used   Avail Capacity  Mounted on
/dev/gpt/rootfs    9.4G    7.6G    965M    89%    /
devfs              1.0k    1.0k      0B   100%    /dev

Code:
root@freebsd:/pgdata # zfs list
NAME     USED  AVAIL  REFER  MOUNTPOINT
pgdata   348K  48.0G    96K  /pgdata

Code:
root@freebsd:/pgdata # du -sh /*
8.0K    /COPYRIGHT
1.4M    /bin
153M    /boot
4.0K    /dev
4.0K    /entropy
3.1M    /etc
  0B    /home
 13M    /lib
332K    /libexec
4.0K    /media
4.0K    /mnt
4.0K    /net
4.0K    /pg
1.3G    /pgdata
4.0K    /proc
 12M    /rescue
 44K    /root
6.4M    /sbin
 28K    /tmp
5.0G    /usr
612M    /var

The DB is here:

Code:
root@freebsd:/pgdata # vim postgresql.conf
data_directory = '/pgdata/'

I did
dd if=/dev/random of=/pgdata/myfile.dat bs=500M count=1

and got

Code:
root@freebsd:/pgdata # df -H
Filesystem         Size    Used   Avail Capacity  Mounted on
/dev/gpt/rootfs    9.4G    8.2G    441M    95%    /
devfs              1.0k    1.0k      0B   100%    /dev

and somehow I can`t see /pgdata mounted nowhere:

/etc/fstab
Code:
# Custom /etc/fstab for FreeBSD VM images
/dev/gpt/rootfs   /       ufs     rw      1       1
/dev/gpt/swapfs  none    swap    sw      0       0


So the questions are

If you go UEFI then you still have the issue of playing the boot loader game (who's boot loader starts and if that boot loader knows about the other OS - and without allot of hacking it will NOT)

Where do I have my DB? I want it on ZFS storage and it's there but it seems that I keep spending diskspace of my 10G tiny system disk.
What did I do wrong (did I?) and how to fix it? If I didn't mount ZFS properly how in the world does Postgres work there?
Thanks in advance for any help.
 
looks like /pgdata is not mounted
do you have zfs_enable='YES" in /etc/rc.conf ?
no, I don`t have it.
so it seems that there is ZFS pool created but I didn`t mount it in the /pgdata folder and I keep writing data "just in folder" /pgdata of my UFS...
But then what does it mean (there is a mountpoint) ?
Code:
root@freebsd:/pgdata # zfs list
NAME     USED  AVAIL  REFER  MOUNTPOINT
pgdata   348K  48.0G    96K  /pgdata
 
zfs list is like looking at fstab. does not mean the fs is currently mounted but by default will mount at /mountpoint
 
What is the best way to fix the situation and not breaking DB?
I should mount zfs (add in rc.conf and fstab)
but my DB is already looking at /pgdata.. don`t want to loose the data
 
Thanks to all of you guys!
It worked! (I`ve just add zfs_enable="YES") and rebooted.
After that ZFS mounted into /pgdata and .... I lost my DB (have to read everything carefully, my mistake, not your advices surely)
Thankfully there was not much data.
Anyway, it works now, everything is fine with the space and I got a bit of experience :)
 
I lost my DB (have to read everything carefully, my mistake, not your advices surely)
Unmount the filesystem; zfs unmount pgdata, I'm fairly certain your data is "hiding" under the mount point. Then either move it out of the way or temporarily mount the ZFS filesystem somewhere else (as covacat showed).
 
Unmount the filesystem; zfs unmount pgdata, I'm fairly certain your data is "hiding" under the mount point. Then either move it out of the way or temporarily mount the ZFS filesystem somewhere else (as covacat showed).
I`ll try it the next time, I`m sure you`re right, but now I got everything back (it was a DB for a freshly installed Zabbix server), so it`s really not a big deal to loose that DB since I set up it back.
Just wanted to do everything carefully first but ...ed up a bit.
Thank you guys! RTFM as always :)
 
Back
Top