Solved zfs create and mount point

hi to everyone, first of all this is my only creation of a ZFS filesystem on a disk, i'l get some clues but before do it..ask the experts :)
the steps:

-follow this steps(single disk non-redundant) Chapter 19. The Z File System (ZFS)

Code:
dd if=/dev/zero of=/dev/ada0 bs=4M status="progress"
zpool create zroot2 /dev/ada0
zfs create -V 380G zroot2/home

now, I want to set a mountpoint for zroot2/home , and after figthing for a while with commands like this:
Code:
zfs set mountpoint=zroot2/home zroot2/home
and get this:
Code:
cannot set property for 'zroot2/home': 'mountpoint' does not apply to datasets of this type



I'think...the zfs volume that create is in /dev/zvol/zroot2/home without format, so, do I have to format this volume
to UFS? to set the mountpoint correctly?



ps:
if I'folow this steps I'can set the mount point:
Code:
zfs create -o mountpoint=/zroot2/home zroot2/home
but when I'want to set the size of zroot/home :
Code:
zfs set volsize=430G zroot2/home
I'll get:
Code:
cannot set property for 'zroot2/home': 'volsize' does not apply to datasets of this type

and cannot create files o folders with a normal user,only with root


this is my actual zfs list

Code:
NAME                 USED  AVAIL  REFER  MOUNTPOINT
zroot                185G   261G    88K  /zroot
zroot/ROOT          9.67G   261G    88K  none
zroot/ROOT/default  9.67G   261G  9.67G  /
zroot/data           103G   295G  68.8G  -
zroot/tmp            320K   261G   320K  /tmp
zroot/usr           71.4G   261G    88K  /usr
zroot/usr/home      67.7G   261G  67.7G  /usr/home
zroot/usr/ports     3.04G   261G  3.04G  /usr/ports
zroot/usr/src        711M   261G   711M  /usr/src
zroot/var            668M   261G    88K  /var
zroot/var/audit       88K   261G    88K  /var/audit
zroot/var/crash       88K   261G    88K  /var/crash
zroot/var/log        516K   261G   516K  /var/log
zroot/var/mail       112K   261G   112K  /var/mail
zroot/var/tmp        667M   261G   667M  /var/tmp
zroot2               764K   449G    88K  /zroot2
zroot2/home           88K   449G    88K  /zroot2/home

and zpool list
Code:
NAME     SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
zroot    460G   151G   309G        -         -     7%    32%  1.00x  ONLINE  -
zroot2   464G  1004K   464G        -         -     0%     0%  1.00x  ONLINE  -
 
ZFS is a volume manager and filesystem. Trying to use UFS on a ZFS filesystem doesn't make a whole lot of sense.

zpool create
You don't need to prepare the media with dd, "zpool create" is sufficient.

zfs create
You can see where the new filesystem is created with "zfs list", "zfs get mountpoint zroot2/home"

zfs set mountpoint
You probably meant "zfs set mountpoint=/zroot2/home zroot2/home". The full path is probably what you meant.

volsize
I've no experience of changing this ...
 
ZFS is a volume manager and filesystem. Trying to use UFS on a ZFS filesystem doesn't make a whole lot of sense.

you're right, the only scenario when I'do it that is with one geli UFS partition on a ZFS disk
for example:

Code:
zfs create -V 100G  zroot/data
newfs -EUj /dev/zvol/zroot/data

<geli steps...on /dev/zvol/zroot/data>

and then use /dev/zvol/zroot/data.eli and mount in a folder




zfs create
You can see where the new filesystem is created with "zfs list", "zfs get mountpoint zroot2/home"


I'discover if a run zfs create zroot2/home
everything is configured automatically , and now the mount point is zroot2/home
Code:
zroot2               884K   449G    88K  /zroot2
zroot2/home           88K   449G    88K  /zroot2/home

zfs set mountpoint
You probably meant "zfs set mountpoint=/zroot2/home zroot2/home". The full path is probably what you meant.


I had no luck with that , but almost lost my /home partition 🤣 with :
zfs set mountpoint=/home zroot2/home

volsize
I've no experience of changing this ...


the only reason to use this is for the geli encripted UFS partition, I'reserve 100G and limit space on the pool
for zroot/data
Code:
zfs create -V 100G  zroot/data

and forget...to fix the user permision to write on the volume zroot2/home I use:
chown -R user:user zroot2/home
chmod u+rwx /zroot2/home/
chmod g+rwx /zroot2/home/
taked from here Permission denied when accessing submounts as non-root
 
Do you really want to create a block device which acts like a drive and needs to be formatted, or did you want to create a file system where a user can enter into it and see files and folders? -V says to make a block device (zvol) but you probably wanted a filesystem (perhaps with -o refquota=size)
 
Backing up a little bit: Can you please explain what you're really trying to accomplish? Explain what you want your file systems to be when you are done? Because this is confusing.
 
Do you really want to create a block device which acts like a drive and needs to be formatted, or did you want to create a file system where a user can enter into it and see files and folders? -V says to make a block device (zvol) but you probably wanted a filesystem (perhaps with -o refquota=size)

a simple filesystem where a user can enter into it and see files and folders
jusk like the base system(always I use the FreeBSD installer,never made by hand)
maybe later I create a block device to make a geli encrypted drive,but that is not relevant
 
Assuming you want to get rid of the zvol created with the -V option:

Code:
zfs destroy zroot2/home
zfs create -o refquota=380G zroot2/home

Should give you a filesystem mounted at zroot2/home (provided the zroot2 pool was created with default options) that can only ever actively reference 380G. (Note it can grow larger due to snapshots; if you create 100G or data in the filesystem, take a snapshot, and replace the data with 300G of new data, it will consume 400G of space but only reference 300G. (Glossing over compression and other details for now.)

Note that one of the benefits of zfs over traditional file systems is that you don’t have to fix a filesystem’s (like zroot2/home’s) size at creation time. If you want to guarantee a particular size is reserved, you can look into refreservation option, but in general, I create filesystems with no quota or reservation. (Note that refreservation’s behavior can be surprising in the presence of snapshots even for seasoned users. It makes perfect sense, but it is sometimes a surprise.)

Hope this helps!
 
Assuming you want to get rid of the zvol created with the -V option:

Code:
zfs destroy zroot2/home
zfs create -o refquota=380G zroot2/home

Should give you a filesystem mounted at zroot2/home (provided the zroot2 pool was created with default options) that can only ever actively reference 380G. (Note it can grow larger due to snapshots; if you create 100G or data in the filesystem, take a snapshot, and replace the data with 300G of new data, it will consume 400G of space but only reference 300G. (Glossing over compression and other details for now.)

Note that one of the benefits of zfs over traditional file systems is that you don’t have to fix a filesystem’s (like zroot2/home’s) size at creation time. If you want to guarantee a particular size is reserved, you can look into refreservation option, but in general, I create filesystems with no quota or reservation. (Note that refreservation’s behavior can be surprising in the presence of snapshots even for seasoned users. It makes perfect sense, but it is sometimes a surprise.)

Hope this helps!

yes,it helps a lot, so, to create a ZFS
disk is so easy like this steps?

Code:
zpool create zroot2 /dev/ada0
zfs create zroot2/home

and from that point I can use the benefits of a ZFS filesystem :)
snapshots,compression,etc

I will not use quota or reservation for now
 
Do you really want to create a block device which acts like a drive and needs to be formatted, or did you want to create a file system where a user can enter into it and see files and folders? -V says to make a block device (zvol) but you probably wanted a filesystem (perhaps with -o refquota=size)

answered to Eric A. Borisch
btw, I dont now that the -V argument create a block device,always I think that is for reservate the space o quota
thanks for the help!
 
Back
Top