Solved why we create zfs pool , the zfs will autocreate same name dataset ? what function about this dataset ?

Dear all :
when i create a zfs pool , the system will autocreate same name dataset , that make me confused what is zpool and dataset with same name ? any one can show me something about this ? thanks.
 
Code:
     Unless the -R option is specified, the default mount point is /pool.  The
     mount point must not exist or must be empty, or else the root dataset
     will not be able to be be mounted.  This can be overridden with the -m
     option.
zpool-create(8)
 
Code:
     Unless the -R option is specified, the default mount point is /pool.  The
     mount point must not exist or must be empty, or else the root dataset
     will not be able to be be mounted.  This can be overridden with the -m
     option.
zpool-create(8)
Dear sirdice :
thanks first. when we create one zfs pool . zpool create pool200 vtbd0p3 . pool200 will mount at /pool200. we use zfs list command will show pool200 dataset . pool200 is a dataset or pool ? if pool200 is a dataset , what function is it ? if pool200 is a pool, i think the other dataset will belongs to her, we create other dataset , we will find it in /pool200/ , right ? thanks. new guys , so i have much more questions. thanks.
 
Both. Each pool has a 'root' dataset with the same name as the pool.
Dear sirdice :
please see below output .
game@f14:/mnt $ zfs list
NAME USED AVAIL REFER MOUNTPOINT
zroot 905M 16.1G 384K /zroot
zroot/ROOT 896M 16.1G 384K none
zroot/ROOT/default 896M 16.1G 896M /
zroot/home 512K 16.1G 512K /home
zroot/tmp 384K 16.1G 384K /tmp
zroot/usr 1.12M 16.1G 384K /usr
zroot/usr/ports 384K 16.1G 384K /usr/ports
zroot/usr/src 384K 16.1G 384K /usr/src
zroot/var 2.36M 16.1G 384K /var
zroot/var/audit 384K 16.1G 384K /var/audit
zroot/var/crash 384K 16.1G 384K /var/crash
zroot/var/log 496K 16.1G 496K /var/log
zroot/var/mail 384K 16.1G 384K /var/mail
zroot/var/tmp 384K 16.1G 384K /var/tmp

if the pool name has a "root" dataset . when we create other dataset , the other dataset will be a sub dataset in 'root' dataset. but we will see output, example, zroot/home , this is a sub-dataset, we must find it in location "/zroot/" ("root" dataset ) ..the other sub-dataset will same . but when i run "ls /zroot/ " command, i just get nothing . no sub-dataset in there ? why ? thanks.
 
zfsconcepts(7)
Code:
   ZFS File System Hierarchy
     A ZFS storage pool is a logical collection of devices that provide space
     for datasets.  A storage pool is also the root of the ZFS file system
     hierarchy.

     The root of the pool can be accessed as a file system, such as mounting
     and unmounting, taking snapshots, and setting properties.  The physical
     storage characteristics, however, are managed by the zpool(8) command.
[...]
   Mount Points
     [...]
     By default, file systems are mounted under /path, where path is the name
     of the file system in the ZFS namespace.  Directories are created and
     destroyed as needed.

     A file system can also have a mount point set in the mountpoint property.
     This directory is created as needed, and ZFS automatically mounts the
     file system when the zfs mount -a command is invoked (without editing
     /etc/fstab).  The mountpoint property can be inherited, so if pool/home
     has a mount point of /export/stuff, then pool/home/user automatically
     inherits a mount point of /export/stuff/user.
 
if the pool name has a "root" dataset . when we create other dataset , the other dataset will be a sub dataset in 'root' dataset. but we will see output, example, zroot/home , this is a sub-dataset, we must find it in location "/zroot/" ("root" dataset ) ..the other sub-dataset will same . but when i run "ls /zroot/ " command, i just get nothing . no sub-dataset in there ? why ? thanks.

The zpool itself is just a collection of disks in some sort of stripe/raid configuration that can be used to store zfs blocks. The only way you can actually put any user data on it is to create datasets. When the pool is created, you automatically get one dataset with the same name that is mounted on /poolname. You can store files in that dataset, or create child datasets to organise the data further.

By default child datasets are mounted underneath their parent, so, assuming that zroot has a mountpoint of /zroot, zroot/home, would be accessed via /zroot/home.

However, in your case all of your child datasets have a different mount point set. For example your zroot/usr dataset is set to be mounted at /usr. This is why none of them appear under the /zroot directory.
 
zfsconcepts(7)
Code:
   ZFS File System Hierarchy
     A ZFS storage pool is a logical collection of devices that provide space
     for datasets.  A storage pool is also the root of the ZFS file system
     hierarchy.

     The root of the pool can be accessed as a file system, such as mounting
     and unmounting, taking snapshots, and setting properties.  The physical
     storage characteristics, however, are managed by the zpool(8) command.
[...]
   Mount Points
     [...]
     By default, file systems are mounted under /path, where path is the name
     of the file system in the ZFS namespace.  Directories are created and
     destroyed as needed.

     A file system can also have a mount point set in the mountpoint property.
     This directory is created as needed, and ZFS automatically mounts the
     file system when the zfs mount -a command is invoked (without editing
     /etc/fstab).  The mountpoint property can be inherited, so if pool/home
     has a mount point of /export/stuff, then pool/home/user automatically
     inherits a mount point of /export/stuff/user.
dear sko: thanks. that is very good solution.
 
The zpool itself is just a collection of disks in some sort of stripe/raid configuration that can be used to store zfs blocks. The only way you can actually put any user data on it is to create datasets. When the pool is created, you automatically get one dataset with the same name that is mounted on /poolname. You can store files in that dataset, or create child datasets to organise the data further.

By default child datasets are mounted underneath their parent, so, assuming that zroot has a mountpoint of /zroot, zroot/home, would be accessed via /zroot/home.

However, in your case all of your child datasets have a different mount point set. For example your zroot/usr dataset is set to be mounted at /usr. This is why none of them appear under the /zroot directory.
dear usdmalt :
thanks. i understand it. thanks.
 
Back
Top