[Level 2] How to get ZFS clone file system?

Now I have use VirtualBox with ZFS clone file system.
So sometimes, I have to figure out which file system is native, which file system is clone.
Therefore, I write a script to list the ZFS clone file system.

#!/usr/bin/bash
showUsage() {
  cat <
<EOF
Usage:
  $0 pool_name
Ex.
  $0 rpool
EOF
}

######################################################## main

[ $# -lt 1 ] && echo "Error without parameters, exit program..." && showUsage && exit 1
sPoolname=$1 #sPoolname=${1:-rpool}
echo "get pool($sPoolname)..."
zfs get -r origin $sPoolname | egrep -v -- 'origin[ ]+-[ ]+-$'


The you can use the command to find out the clone file system.
# getCloneFS.sh rpool

get pool(rpool)...
NAME                                          PROPERTY  VALUE                                         SOURCE
rpool/ROOT/opensolaris                        origin    rpool/ROOT/opensolaris-1@2009-11-18-05:46:35  -
#





Wish this helps.

regards,
Stanley Huang

Comments

Popular posts from this blog

[Level 2] Shell Interactive With Zenity Episode 5 -- list

[Level 2] iif in Python