Creating a Basic Storage Pool
# zpool create tank /dev/rdsk/cxtxdxs2 or # zpool create xx cxtxdxs2
cxtxdxs2 is the raw device disk in the /dev/rdsk directory.
Default mount point of a storage pool
When you run the preceding command to create a storage pool, the default mount point of the top-level file system is /pool-name. If the directory does not exist, the system automatically creates the directory.
To create a storage pool using a different default mount point, use the
# zpool create -m /xx/zfs tank cxtxdxs2
In this way, you can create a pool named tank and a ZFS file system with the mount point /xx/zfs.
Basic Query Commands
# zpool list NAME SIZE ALLOC FREE CAP HEALTH ALTROOT tank 80.0G 22.3G 47.7G 28% ONLINE - dozer 1.2T 384G 816G 32% ONLINE -
Basic Status Query Commands
# zpool status tank pool: tank state: ONLINE scrub: none requested config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
Creating a ZFS File System
# zfs create tank/jj
The parameter is pool-name/[filesystem-name]/filesystem-name.
In this way, a JJ file system can be created in the tank file system and a mount path is automatically created for mounting.
You can also customize the file system mount point when creating it.
# zfs create -o mountpoint=/export/zfs tank
ZFS automatic mount point
# zfs create pool/filesystem # zfs get mountpoint pool/filesystem
NAME PROPERTY VALUE SOURCE
pool/filesystem mountpoint /pool/filesystem default
You can also manually reset the mount point.
# zfs set mountpoint=/mnt pool/filesystem # zfs get mountpoint pool/filesystem
NAME PROPERTY VALUE SOURCE
pool/filesystem mountpoint /mnt local
Before resetting the mount point, you need to unmount the file system. After the setting is complete, the file system is automatically mounted.
Mounting a ZFS File System
# zfs mount tank is automatically mounted to the default or set mount point. # zfs mount -a mounts all ZFS file systems.
Unmounting can be directly canceled by using the traditional umount command.
List ZFS Basic Information
# zfs list users 2.00G 64.9G 32K /users users/home 2.00G 64.9G 35K /users/home users/home/cindy 548K 64.9G 548K /users/home/cindy users/home/mark 1.00G 64.9G 1.00G /users/home/mark users/home/neil 1.00G 64.9G 1.00G /users/home/neil
Precautions:
1. The name and mount point of the ZFS file system can be changed, but the name of the Zpool that originally created the ZFS file system cannot be changed.
2. If the zpool status is failed, run the zpool destroy -f command to forcibly delete the zpool status. If the backend storage is faulty, the zpool status will enter the suspend state and cannot be deleted. You can restart the host or restore the disks in the zpool status.
3. If you need to test storage on ZFS for data protection, you must run the zpool export command after unmounting the source ZFS. Otherwise, Zpool is always in the online state. In this case, reverse synchronization or rollback will cause host I/O conflicts and data inconsistency and damage the source ZFS.
4. After step 3 is performed, map the target LUN again and run the zpool import command to enable the LUN to be automatically mounted based on the source ZFS device.
