Vic/zfs faq

From Summerseas

Jump to: navigation, search

Back to Vic's Start Page

Contents

ZFS FAQ

How do I create a simple stripe zpool?

  • zpool create Simple:Stripe c1t500A09858290C139d198 c1t500A09858290C139d197 \
  • c1t500A09858290C139d196 c1t500A09858290C139d195 c1t500A09858290C139d194 \
  • c1t500A09858290C139d193 c1t500A09858290C139d192
[root@shsun07--->]df -h /Simple:Stripe
Filesystem             size   used  avail capacity  Mounted on
Simple:Stripe           14G    24K    14G     1%    /Simple:Stripe
  • Discussion - Best practice is to always create zpools with whole disks. Zpools may be created with slices or even files within a UFS filesystem however this would greatly limit ZFS functionality. For example it zpools are sharing disks with UFS then the zpool can not be exported and imported on another host.

How do I grow a zpool?

  • zpool add Simple:Stripe c1t500A09858290C139d174
[root@shsun07--->]df -h /Simple:Stripe
Filesystem             size   used  avail capacity  Mounted on
Simple:Stripe           16G    24K    16G     1%    /Simple:Stripe

How can I check the health of a zpool?

[root@shsun07--->]zpool status Simple:Stripe
  pool: Simple:Stripe
 state: ONLINE
 scrub: none requested
config:

        NAME                       STATE     READ WRITE CKSUM
        Simple:Stripe              ONLINE       0     0     0
          c1t500A09858290C139d198  ONLINE       0     0     0
          c1t500A09858290C139d197  ONLINE       0     0     0
          c1t500A09858290C139d196  ONLINE       0     0     0
          c1t500A09858290C139d195  ONLINE       0     0     0
          c1t500A09858290C139d194  ONLINE       0     0     0
          c1t500A09858290C139d193  ONLINE       0     0     0
          c1t500A09858290C139d192  ONLINE       0     0     0
          c1t500A09858290C139d174  ONLINE       0     0     0

errors: No known data errors

Can I measure disk performance within a zpool?

[root@shsun07--->]zpool iostat -v Simple:Stripe   
                              capacity     operations    bandwidth
pool                        used  avail   read  write   read  write
-------------------------  -----  -----  -----  -----  -----  -----
Simple:Stripe               189K  15.9G      0      1      0  18.5K
  c1t500A09858290C139d198    90K  1.98G      0      0      0  2.46K
  c1t500A09858290C139d197    29K  1.98G      0      0      0  2.28K
  c1t500A09858290C139d196  2.50K  1.98G      0      0      0  2.18K
  c1t500A09858290C139d195      0  1.98G      0      0      0  2.17K
  c1t500A09858290C139d194      0  1.98G      0      0      0  2.17K
  c1t500A09858290C139d193      0  1.98G      0      0      0  2.17K
  c1t500A09858290C139d192  67.5K  1.98G      0      0      0  2.40K
  c1t500A09858290C139d174      0  1.98G      0      0      0  3.81K
-------------------------  -----  -----  -----  -----  -----  -----

How do I see previously configured zpools?

[root@shsun07--->]zpool list
NAME                    SIZE    USED   AVAIL    CAP  HEALTH     ALTROOT
Simple:Stripe          15.9G    189K   15.9G     0%  ONLINE     -

Can zpools be exported and imported?

  • zpool export Simple:Stripe
  • zpool import Simple:Stripe

How do I see zpools available to be imported?

  • zpool import

How do I create zfs filesystems

[root@shsun07--->]zfs create Simple:Stripe/home
[root@shsun07--->]df -h Simple:Stripe/home
Filesystem             size   used  avail capacity  Mounted on
Simple:Stripe           16G    26K    16G     1%    /Simple:Stripe

How can I list existing zfs filesystems

[root@shsun07--->]zfs list
NAME                   USED  AVAIL  REFER  MOUNTPOINT
Simple:Stripe          114K  15.6G  26.5K  /Simple:Stripe
Simple:Stripe/home    24.5K  15.6G  24.5K  /Simple:Stripe/home

Can I change the mountpoint for a zfs filesystem, /Simple:Stripe/home looks stupid

[root@shsun07--->]zfs set mountpoint=/zhome Simple:Stripe/home
[root@shsun07--->]zfs list
NAME                   USED  AVAIL  REFER  MOUNTPOINT
Simple:Stripe          120K  15.6G  26.5K  /Simple:Stripe
Simple:Stripe/home    24.5K  15.6G  24.5K  /zhome

How do I share zfs filesystems

[root@shsun07--->]zfs set sharenfs=on Simple:Stripe/home
[root@shsun07--->]showmount -e
export list for shsun07:
/zhome (everyone)

What is a zvol

  • A zvol is a virtual disk device with a zfs filesystem as the backing store.

How do I create a zvol?

[root@shsun07--->]zfs create -V 5g Simple:Stripe/vdisk
[root@shsun07--->]file /dev/zvol/rdsk/Simple\:Stripe/vdisk 
/dev/zvol/rdsk/Simple:Stripe/vdisk:     character special (256/1)
  • The zvol named vdisk can now be newfs'd and mounted traditionally or used as raw space.

How do I create a snapshot?


[root@shsun15--->]zfs set snapdir=visible oracle_db/training

[root@shsun15--->]zfs snapshot oracle_db/training@Friday315pm


[root@shsun15--->]zfs list
NAME                   USED  AVAIL  REFER  MOUNTPOINT
SimpleStripe            79K  9.77G  24.5K  /SimpleStripe
oracle_db             56.8M  13.6G  25.5K  /oracle_db
oracle_db/training    56.7M  13.6G  56.7M  /oracle_db/training
oracle_db/training@Friday315pm      0      -  56.7M  -
oracle_logs            175K  9.77G  28.5K  /oracle_logs
oracle_logs/log_1     24.5K  9.77G  24.5K  /oracle_logs/log_1
oracle_logs/log_2     24.5K  9.77G  24.5K  /oracle_logs/log_2
oracle_logs/log_3     24.5K  9.77G  24.5K  /oracle_logs/log_3

[root@shsun15--->]ls -l /oracle_db/training/release
-r--r--r--   1 root     sys          242 Nov 14 18:02 /oracle_db/training/release

[root@shsun15--->]ls -l /oracle_db/training/.zfs/snapshot/Friday315pm/release
-r--r--r--   1 root     sys          242 Nov 14 18:02 /oracle_db/training/.zfs/snapshot/Friday315pm/release

  • Note - The default snapdir property is hidden. To make the .zfs directory visible to users change this property to "visible".
Personal tools