d62269gc30_ag.pdf
TRANSCRIPT
-
8/16/2019 D62269GC30_ag.pdf
1/128
Oracle Solaris 10 ZFSAdministration
Activity Guide
D62269GC30
Edition 3.0
October 2010
D69176
-
8/16/2019 D62269GC30_ag.pdf
2/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Disclaimer
This document contains proprietary information and is protected by copyright and other intellectual property laws. You may copy andprint this document solely for your own use in an Oracle training course. The document may not be modified or altered in any way.Except where your use constitutes "fair use" under copyright law, you may not use, share, download, upload, copy, print, display,perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express authorizationof Oracle.
The information contained in this document is subject to change without notice. If you find any problems in the document, pleasereport them in writing to: Oracle University, 500 Oracle Parkway, Redwood Shores, California 94065 USA. This document is notwarranted to be error-free.
Restricted Rights Notice
If this documentation is delivered to the United States Government or anyone using the documentation on behalf of the UnitedStates Government, the following notice is applicable:
U.S. GOVERNMENT RIGHTSThe U.S. Government’s rights to use, modify, reproduce, release, perform, display, or disclose these training materials are restrictedby the terms of the applicable Oracle license agreement and/or the applicable U.S. Government contract.
Trademark Notice
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective
owners.
Author
Tammy Shannon
Technical Contributors and Reviewers
David Maxwell, Cindy Swearingen, Glynn Foster, Dominic Kay, Gary Riseborough
This book was published using: Oracle Tutor
-
8/16/2019 D62269GC30_ag.pdf
3/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Oracle Solaris 10 ZFS Administration Table of Contents
i
Table of Contents
Practices for Lesson 1: Course Introduction.................................................................................................1-1
Practices for Lesson 1 ....................................................................................................................................1-3
Practices for Lesson 2: Getting Started with ZFS .........................................................................................2-1
Practices for Lesson 2 ....................................................................................................................................2-3
Practices for Lesson 3: Mastering ZFS Basics..............................................................................................3-1
Practices for Lesson 3 ....................................................................................................................................3-3
Practices for Lesson 4: Managing ZFS Storage Pools .................................................................................4-1
Practices for Lesson 4 ....................................................................................................................................4-3
Practice 4-1: Working with ZFS Pools and Devices .......................................................................................4-4
Practice 4-2: Working with Mirrored Pools .....................................................................................................4-8
Practice 4-3: Managing Devices in Mirrored Pools.........................................................................................4-12
Practice 4-4: Destroying ZFS Storage Pools ..................................................................................................4-18
Practice 4-5: Working with RAID-Z Pools .......................................................................................................4-19
Practice 4-6: Managing Devices in RAID-Z Pools ..........................................................................................4-22
Practice 4-7: Working with the autoexpand Property .....................................................................................4-25
Practices for Lesson 5: Managing ZFS File Systems ...................................................................................5-1
Practices for Lesson 5 ....................................................................................................................................5-3
Practice 5-1: Creating, Renaming, and Destroying ZFS File Systems ...........................................................5-4
Practice 5-2: Working with ZFS Properties ....................................................................................................5-6
Practice 5-3: Demonstrating ZFS Property Inheritance ..................................................................................5-10
Practice 5-4: Mounting ZFS File Systems ......................................................................................................5-12
Practice 5-5: Sharing ZFS File Systems ........................................................................................................5-15
Practice 5-6: Working with ZFS Quotas and Reservations ............................................................................5-17
Practices for Lesson 6: Working with ZFS Snapshots and Clones .............................................................6-1
Practices for Lesson 6 ....................................................................................................................................6-3
Practice 6-1: Creating, Holding, and Destroying ZFS Snapshots ...................................................................6-4
Practice 6-2: Working with ZFS Snapshots ....................................................................................................6-7
Practice 6-3: Working with ZFS Clones ..........................................................................................................6-12
Practices for Lesson 7: Installing and Booting a ZFS Root File System ....................................................7-1
Practices for Lesson 7 ....................................................................................................................................7-3
Practice 7-1: Migrating a UFS Root File System to a ZFS Root File System .................................................7-4
Practice 7-2: Booting an Alternate ZFS Root File System ..............................................................................7-11
Practice 7-3: Creating a Mirrored ZFS Root Pool ...........................................................................................7-13
Practice 7-4: Performing Root Pool Recovery ................................................................................................7-17
Practices for Lesson 8: ZFS Troubleshooting and Data Recovery ..............................................................8-1
Practices for Lesson 8 ....................................................................................................................................8-3
Practice 8-1: Creating ZFS Pools and File Systems ......................................................................................8-4
Practice 8-2: Configuring syslog to Send FMD Messages to a File................................................................8-6
Practice 8-3: Working with a Disk Error in a Mirrored Pool ............................................................................8-7
Practice 8-4: Working with a Disk Error in a RAID-Z Pool ..............................................................................8-11
Practices for Lesson 9: ZFS Advanced Topics .............................................................................................9-1
Practices for Lesson 9 ....................................................................................................................................9-3
Practice 9-1: Working with ZFS Volumes .......................................................................................................9-4
-
8/16/2019 D62269GC30_ag.pdf
4/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Oracle Solaris 10 ZFS Administration Table of Contents
ii
Practice 9-2: Creating a Non-Global Zone .....................................................................................................9-5
Practice 9-3: Adding a ZFS File System to a Non-Global Zone .....................................................................9-8
Practice 9-4: Delegating a Dataset to a Non-Global Zone .............................................................................9-10
Practice 9-5: Removing the Zone and ZFS Configuration ..............................................................................9-12
-
8/16/2019 D62269GC30_ag.pdf
5/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Oracle Solaris 10 ZFS Administration Table of Contents
iii
Preface
Profile
Before You Begin This Course
Before you begin this course, you should be able to:
• Administer the Solaris 10 OS
• Manage file systems and local disk drives
• Perform system boot procedures
• Manage user administration
How This Course Is Organized
This is an instructor-led course featuring lecture and hands-on exercises. Online demonstrationsand written practice sessions reinforce the concepts and skills introduced.
-
8/16/2019 D62269GC30_ag.pdf
6/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Oracle Solaris 10 ZFS Administration Table of Contents
iv
Related Publications
Oracle Publications
Title Part Number
Oracle Solaris ZFS Administration Guide 819-5461
Additional Publications
• System release bulletins
• Installation and user’s guides
• Read-me files
• International Oracle User’s Group (IOUG) articles
• Oracle Magazine
-
8/16/2019 D62269GC30_ag.pdf
7/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 1: Course Introduction
Chapter 1 - Page 1
Practices for Lesson 1:Course Introduction
Chapter 1
-
8/16/2019 D62269GC30_ag.pdf
8/128
-
8/16/2019 D62269GC30_ag.pdf
9/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 1: Course Introduction
Chapter 1 - Page 3
Practices for Lesson 1
Practices Overview
There is no practice for Lesson 1.
-
8/16/2019 D62269GC30_ag.pdf
10/128
-
8/16/2019 D62269GC30_ag.pdf
11/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 2: Getting Started with ZFS
Chapter 2 - Page 1
Practices for Lesson 2:Getting Started with ZFS
Chapter 2
-
8/16/2019 D62269GC30_ag.pdf
12/128
-
8/16/2019 D62269GC30_ag.pdf
13/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 2: Getting Started with ZFS
Chapter 2 - Page 3
Practices for Lesson 2
Practices Overview
There is no practice for Lesson 2.
-
8/16/2019 D62269GC30_ag.pdf
14/128
-
8/16/2019 D62269GC30_ag.pdf
15/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 3: Mastering ZFS Basics
Chapter 3 - Page 1
Practices for Lesson 3:Mastering ZFS Basics
Chapter 3
-
8/16/2019 D62269GC30_ag.pdf
16/128
-
8/16/2019 D62269GC30_ag.pdf
17/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 3: Mastering ZFS Basics
Chapter 3 - Page 3
Practices for Lesson 3
Practices Overview
There is no practice for Lesson 3.
-
8/16/2019 D62269GC30_ag.pdf
18/128
-
8/16/2019 D62269GC30_ag.pdf
19/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 1
Practices for Lesson 4:Managing ZFS Storage Pools
Chapter 4
-
8/16/2019 D62269GC30_ag.pdf
20/128
-
8/16/2019 D62269GC30_ag.pdf
21/128
-
8/16/2019 D62269GC30_ag.pdf
22/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 4
Practice 4-1: Working with ZFS Pools and Devices
Overview
In this practice, you work with ZFS storage pools and devices.
Preparations
To complete this exercise, you must already have a general understanding of disk devices andfile systems used on Solaris systems and you must already be familiar with the format utility.
Some of the ZFS file system space accounting might be different from the student guideexamples. It is important to wait for each command to complete after writing large files to reviewreported file system space.
The disk storage used in this and subsequent exercises is provided by a Fibre Channel array.Because of this, the device names of the LUNs the array provides include world-wide names(WWNs) in the target portion of the name. For example:
/dev/rdsk/c0t226000C0FFA7C140d0s2
Use the luxadm probe command to display the list of these devices on your system. Forexample:
# luxadm probeNo Network Array enclosures found in /dev/es
Found Fibre Channel device(s):
Node WWN:206000c0ff07c140 Device Type:Disk device
Logical Path:/dev/rdsk/c0t226000C0FFA7C140d0s2
Node WWN:206000c0ff07c140 Device Type:Disk device
Logical Path:/dev/rdsk/c0t226000C0FFA7C140d1s2
Node WWN:206000c0ff07c140 Device Type:Disk device
Logical Path:/dev/rdsk/c0t226000C0FFA7C140d2s2
...
# luxadm probe | grep d0s2
Logical Path:/dev/rdsk/c0t226000C0FFA7C140d0s2
Logical Path:/dev/rdsk/c0t256000C0FFD7C140d0s2
Logical Path:/dev/rdsk/c1t216000C0FF87C140d0s2
Logical Path:/dev/rdsk/c1t266000C0FFF7C140d0s2
LUNs labeled d0 through d15 are approximately 7–8 GB in size. LUNs labeled d16 throughd30 are all 9 GB in size.
You will use only a subset of the LUNs listed, as directed by your instructor. It is important that
you use only the LUNs you are assigned. All LUNs attached to the Fibre Channel network areseen by all student systems, so it is important to avoid using LUNs that are in use on anothersystem.
To make it easier to know what LUNs to use, a script called make_disk_list in/opt/ses/lab/zfs generates a list of the LUNS that are assigned to you.
After your instructor indicates what LUN numbers to use, and which group of LUNs they should
come from, run make_disk_list. When prompted, enter your LUN numbers, separated by
-
8/16/2019 D62269GC30_ag.pdf
23/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 5
spaces. When prompted, enter a 1 or 2 to select the first or second group of 32 LUNs per
controller. The output is saved in a file named /opt/ses/lab/zfs/my_disks.
# cd /opt/ses/lab/zfs
# ./make_disk_list
Look for LUN number(s): 3 4 5 19 20 21
First or second LUN groups? (1 or 2): 1
Your assigned disks:
c1t226000C0FFA7C140d3
c2t216000C0FF87C140d3
c1t226000C0FFA7C140d4
c2t216000C0FF87C140d4
c1t226000C0FFA7C140d5
c2t216000C0FF87C140d5
c1t226000C0FFA7C140d19
c2t216000C0FF87C140d19
c1t226000C0FFA7C140d20
c2t216000C0FF87C140d20
c1t226000C0FFA7C140d21
c2t216000C0FF87C140d21
This list of disks is found in: /opt/ses/lab/zfs/my_disks
Refer to /opt/ses/lab/zfs/my_disks whenever you need to choose a disk to usethroughout the exercises in this course.
The list generated by make_disk_list contains device names that you can use as argumentsin ZFS commands. Specifically, these names lack a slice identifier. This is desirable when youwant to use whole disks in your ZFS configurations.
To use a whole disk that you identify directly from luxadm probe output, for example:
Logical Path:/dev/rdsk/c0t226000C0FFA7C140d0s2
You would omit the slice identifier and use device names similar to the following:
c0t226000C0FFA7C140d0
/dev/rdsk/c0t226000C0FFA7C140d0
If zpool commands return error messages indicating disks are in use by other pools, evaluatethe list of disks you specified. Be certain to use only those disks that have been assigned to
you. Except where directed in task steps to do so, do not use the -f option to override theseerrors. For example:
# zpool create firstpool c2t226000C0FFA7C140d0
invalid vdev specification
use ’-f’ to override the following errors:
/dev/dsk/c2t226000C0FFA7C140d0s0 is part of potentially activepool ’firstpool’
-
8/16/2019 D62269GC30_ag.pdf
24/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 6
is used by /dev/dsk/c2t226000C0FFA7C140d0s0 as zpool
LUNs from the array provide the same functions as disks. Throughout this and subsequentexercises, LUNs presented by the array are referred to as disks.
Please note that because these disks have been used by students in previous classes, youmight see “device-in-use” messages when performing pool operations that involve disks. Be
sure you are using the devices that are identified in your make_disk_list script. If you
determine that a device intended for your use is in use by an old pool, you can use the zpool-f option to force a pool operation.
Tasks
1. Use the zpool command to display the list of ZFS pools. Verify that no ZFS pool currentlyexists.
# zpool list
no pools available
2. Use the zfs command to display the list of ZFS file systems. Verify that no ZFS file systemcurrently exists.
# zfs list
no datasets available3. Display the list of your disks from /opt/ses/lab/zfs/my_disks.
# cat /opt/ses/lab/zfs/my_disks
4. Choose two of the 8-GB disks assigned to you that are attached to different controllers, and
use them to create a new ZFS mirrored pool called mirpool.
# zpool create mirpool mirror c1t226000C0FFA001ABd3 c2t216000C0FF8001ABd3
5. Use the zpool command to verify that the new pool exists.
# zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
mirpool 7.75G 76.5K 7.75G 0% ONLINE -6. Use the zfs command to list the new file system.
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
mirpool 72K 7.63G 21K /mirpool
7. Use the zpool status command with the -x option to display the status of mirpool.Run the command again without the -x option. Is mirpool healthy?
# zpool status -x
all pools are healthy
# zpool status
pool: mirpoolstate: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
mirpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
-
8/16/2019 D62269GC30_ag.pdf
25/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 7
c1t226000C0FFA001ABd3 ONLINE 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0
errors: No known data errors
The mirpool pool should be healthy. All devices should be in the ONLINE state. The
zpool status command should report that there are no known data errors, and withthe -x option, it should report that all pools are healthy.
8. From the output of commands in the previous step, make note of the disks that the
mirpool pool uses.
9. Use the df –h / command to identify the disk of the UFS root file system on your systemand make a note of it.
# df -h /
Filesystem size used avail capacity Mounted on/dev/dsk/c0t0d0s0 67G 4.4G 62G 7% /
10. Using the same disk that is in use by the UFS root file system /, attempt to create a pool
called newpool. What happens?# zpool create newpool c0t0d0
invalid vdev specification
use ’-f’ to override the following errors:
/dev/dsk/c0t0d0s0 is currently mounted on /. Please seeumount(1M).
/dev/dsk/c0t0d0s1 is currently used by swap. Please seeswap(1M).
-
8/16/2019 D62269GC30_ag.pdf
26/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 8
Practice 4-2: Working with Mirrored Pools
Overview
In this practice, you add a new mirror to an existing pool and add spares to that pool. You arethen asked to check the status and I/O statistics of the pool.
Tasks1. Use the zpool command to display the status of mirpool. Verify that the pool and its
devices are in the ONLINE state.
# zpool status
pool: mirpool
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
mirpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0c1t226000C0FFA001ABd3 ONLINE 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0
errors: No known data errors
2. Use the zpool command to display the size and space utilization for mirpool. What is thereported size?
# zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
mirpool 7.75G 78K 7.75G 0% ONLINE -
Identify the size of mirpool. In this example, the reported size should be 7.75 GB.
3. Display the list of your disks from /opt/ses/lab/zfs/my_disks. Identify a pair of 8 GBdisks assigned to you that you can use to add a new mirror to mirpool. Choose two disksthat are accessed through different controllers.
# cat /opt/ses/lab/zfs/my_disks
4. Add a new mirror to mirpool that uses the two 8-GB disks you identified in the previousstep.
# zpool add mirpool mirror c1t226000C0FFA001ABd4 c2t216000C0FF8001ABd4
5. Use the zpool command to display the size and space utilization for mirpool. What is the
new reported size, and how does it compare to the previous size of mirpool?
# zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
mirpool 15.5G 81K 15.5G 0% ONLINE -
-
8/16/2019 D62269GC30_ag.pdf
27/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 9
The size should be double the size previously reported.
6. Use the zpool command to display the status of mirpool. Are all of the devices it uses inthe ONLINE state?
# zpool status mirpool
pool: mirpool
state: ONLINE
scrub: none requestedconfig:
NAME STATE READ WRITE CKSUM
mirpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c1t226000C0FFA001ABd3 ONLINE 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
c1t226000C0FFA001ABd4 ONLINE 0 0 0
c2t216000C0FF8001ABd4 ONLINE 0 0 0
Yes, all of the devices in mirpool are online.
7. Display the list of your disks from /opt/ses/lab/zfs/my_disks. Identify a pair of 8-GBdisks assigned to you to add as spare disks to mirpool. Choose two disks that areaccessed through different controllers.
# cat /opt/ses/lab/zfs/my_disks
8. Add the 8-GB disks identified in the previous step as spares to mirpool.
# zpool add mirpool spare c1t226000C0FFA001ABd5 c2t216000C0FF8001ABd5
9. Use the zpool command to display the status of mirpool. What is the status of the newly-added spares?
# zpool status mirpool
pool: mirpool
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
mirpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0c1t226000C0FFA001ABd3 ONLINE 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
c1t226000C0FFA001ABd4 ONLINE 0 0 0
c2t216000C0FF8001ABd4 ONLINE 0 0 0
spares
-
8/16/2019 D62269GC30_ag.pdf
28/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 10
c1t226000C0FFA001ABd5 AVAIL
c2t216000C0FF8001ABd5 AVAIL
errors: No known data errors
The spares are available.
10. Use the zpool command to display I/O statistics and capacity for the top-level virtualdevices in mirpool. What is the available capacity reported for the two mirror devices?What is the capacity reported for the two spares?
# zpool iostat -v mirpool
capacity operations bandwidth
pool alloc avail read write read write
------------------------ ----- ----- ----- ----- ----- -----
mirpool 94.5K 15.5G 0 0 11 553
mirror 75K 7.75G 0 0 11 505
c1t226000C0FFA001ABd3 - - 0 0 97 1.64K
c2t216000C0FF8001ABd3 - - 0 0 66 1.64Kmirror 19.5K 7.75G 0 0 0 109
c1t226000C0FFA001ABd4 - - 0 0 151 3.19K
c2t216000C0FF8001ABd4 - - 0 0 151 3.19K
------------------------- ----- ----- ----- ----- ----- -----
The zpool iostat -v command reports 7.75 GB available on each mirror device.The spares do not show capacity until they are used.
11. Create a 2-GB file called /mirpool/file_2g.
# mkfile 2g /mirpool/file_2g
12. Display the I/O statistics and capacity for the virtual devices in mirpool. Has the data for
file_2g been distributed between the two mirror devices? If so, how has it beendistributed?
# zpool iostat -v mirpool
capacity operations bandwidth
pool alloc avail read write read write
------------------------ ----- ----- ----- ----- ----- -----
mirpool 2.00G 13.5G 0 30 16 3.51M
mirror 1.00G 6.75G 0 15 16 1.76M
c1t226000C0FFA001ABd3 - - 0 15 350 1.76M
c2t216000C0FF8001ABd3 - - 0 15 238 1.76M
mirror 1.00G 6.75G 0 24 0 2.85Mc1t226000C0FFA001ABd4 - - 0 24 387 2.86M
c2t216000C0FF8001ABd4 - - 0 24 387 2.86M
------------------------- ----- ----- ----- ----- ----- -----
The data for file_2g has been distributed evenly between the two mirror devices. 1GB of data has been placed on each mirror.
13. Use zpool to list the capacity summary for mirpool.
-
8/16/2019 D62269GC30_ag.pdf
29/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 11
# zpool list mirpool
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
mirpool 15.5G 2.00G 13.5G 12% ONLINE -
-
8/16/2019 D62269GC30_ag.pdf
30/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 12
Practice 4-3: Managing Devices in Mirrored Pools
Overview
In this practice, you detach and attach disk resources, look at device states, and monitor theresilvering process in mirror pools.
Tasks1. Display the list of your disks from /opt/ses/lab/zfs/my_disks. Identify a single
unused 9-GB disk assigned to you.
# cat /opt/ses/lab/zfs/my_disks
2. Use the zpool command to display the size and space utilization for mirpool. Make noteof the current size.
# zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
mirpool 15.5G 2.00G 13.5G 12% ONLINE -
3. Use the zpool status command to display the status of mirpool and identify the diskcomponents of the first 8-GB mirror device.
# zpool status mirpool
pool: mirpool
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
mirpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c1t226000C0FFA001ABd3 ONLINE 0 0 0c2t216000C0FF8001ABd3 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
c1t226000C0FFA001ABd4 ONLINE 0 0 0
c2t216000C0FF8001ABd4 ONLINE 0 0 0
spares
c1t226000C0FFA001ABd5 AVAIL
c2t216000C0FF8001ABd5 AVAIL
errors: No known data errors
4. Use the zpool command to attach the unused 9-GB disk you identified in step 1 to the first8-GB mirror.
# zpool attach mirpool c2t216000C0FF8001ABd3 c1t226000C0FFA001ABd19
5. Display the status of mirpool. What resilvering activity does zpool report?# zpool status mirpool
pool: mirpool
-
8/16/2019 D62269GC30_ag.pdf
31/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 13
state: ONLINE
status: One or more devices is currently being resilvered. The pool willcontinue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
scrub: resilver in progress for 0h0m, 77.42% done, 0h0m to go
config:
NAME STATE READ WRITE CKSUMmirpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c1t226000C0FFA001ABd3 ONLINE 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0
c1t226000C0FFA001ABd19 ONLINE 0 0 0 785M resilvered
mirror-1 ONLINE 0 0 0
c1t226000C0FFA001ABd4 ONLINE 0 0 0
c2t216000C0FF8001ABd4 ONLINE 0 0 0
spares
c1t226000C0FFA001ABd5 AVAIL
c2t216000C0FF8001ABd5 AVAIL
errors: No known data errors
Messages vary depending on when you run the zpool status command during theresilvering process. As resilvering proceeds, the command reports how far along theprocess is, and gives advice about actions to take. Once complete, messages indicatethat the process was successful, and when it finished.
Note: After the resilver process reports 100% complete, it may take a few seconds forthe status line to clear.
6. Use the zpool command to display the size and space utilization for mirpool. Does thesize reported differ from the size listed in step 2? If not, why not?
# zpool list mirpool
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
mirpool 15.5G 2.00G 13.5G 12% ONLINE -
No, the size reported is still 15.5 GB. The 9-GB drive makes the first mirror device athree-way mirror, but does not increase its capacity.
7. Display the I/O statistics and capacity for the virtual devices in mirpool. Using the sum ofthe allocated and free columns for each mirror device, compare the sizes of the two 8-GBmirrors. What can you say about how much of the space might be used or wasted on thenew 9-GB disk?
# zpool iostat -v mirpoolcapacity operations bandwidth
pool alloc free read write read write
-------------------------- ----- ----- ----- ----- ----- -----
mirpool 2.00G 13.5G 8 19 1.09M 2.19M
mirror 1.00G 6.75G 8 10 1.09M 1.09M
c1t226000C0FFA001ABd3 - - 5 9 746K 1.10M
-
8/16/2019 D62269GC30_ag.pdf
32/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 14
c2t216000C0FF8001ABd3 - - 2 9 377K 1.10M
c1t226000C0FFA001ABd19 - - 0 56 1.75K 6.62M
mirror 1.00G 6.75G 0 12 234 1.44M
c1t226000C0FFA001ABd4 - - 0 12 5.31K 1.44M
c2t216000C0FF8001ABd4 - - 0 12 1.54K 1.44M
-------------------------- ----- ----- ----- ----- ----- -----
The 9-GB disk is part of the first 8-GB mirror. Because the disks are unequal sizes, only8 GB of that disk can be used. 1 GB is wasted space.
8. Use the zpool command to detach the single 9-GB disk from the first 8-GB mirror inmirpool.
# zpool detach mirpool c1t226000C0FFA001ABd19
9. Display the I/O statistics and capacity for the virtual devices in mirpool. Have theallocated and free values changed?
# zpool iostat -v mirpool
capacity operations bandwidth
pool alloc free read write read write
------------------------- ----- ----- ----- ----- ----- -----mirpool 2.00G 13.5G 8 18 1.01M 2.02M
mirror 1.00G 6.75G 8 9 1.01M 1.01M
c1t226000C0FFA001ABd3 - - 5 9 690K 1.02M
c2t216000C0FF8001ABd3 - - 2 9 349K 1.02M
mirror 1.00G 6.75G 0 11 211 1.30M
c1t226000C0FFA001ABd4 - - 0 11 4.80K 1.30M
c2t216000C0FF8001ABd4 - - 0 11 1.40K 1.30M
------------------------- ----- ----- ----- ----- ----- -----
No, the values have not changed.
10. Detach the first 8-GB disk in the first 8-GB mirror device listed in mirpool.
# zpool detach mirpool c1t226000C0FFA001ABd3
11. Display the status of mirpool. Are all of the devices and the pool itself in the ONLINE state?
# zpool status mirpool
pool: mirpool
state: ONLINE
scrub: resilver completed after 0h0m with 0 errors on Wed Sep 810:39:29 2010
config:
NAME STATE READ WRITE CKSUM
mirpool ONLINE 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c1t226000C0FFA001ABd4 ONLINE 0 0 0
c2t216000C0FF8001ABd4 ONLINE 0 0 0
-
8/16/2019 D62269GC30_ag.pdf
33/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 15
spares
c1t226000C0FFA001ABd5 AVAIL
c2t216000C0FF8001ABd5 AVAIL
errors: No known data errors
Yes, all devices and mirpool itself are in the ONLINE state.
12. Attempt to detach the single disk that is now functioning as a top-level mirror device in
mirpool. What happens and why?
# zpool detach mirpool c2t216000C0FF8001ABd3
cannot detach c2t216000C0FF8001ABd3: only applicable to mirrorand replacing vdevs
The attempt fails because the disk is participating in the pool as a non-replicated object.
13. Attempt to take offline the single disk that was part of the first top-level mirror device in
mirpool. What happens and why?
# zpool offline mirpool c2t216000C0FF8001ABd3 cannot offline c2t216000C0FF8001ABd3: no valid replicas
The attempt fails because the disk is participating in the pool as a non-replicated object.
14. Attempt to take offline the second disk in the remaining second 8-GB mirror device in
mirpool.
# zpool offline mirpool c2t216000C0FF8001ABd4
This operation succeeds because a disk remains as a replicated object.
15. Display the status of mirpool. Are all of the devices and the pool itself in the ONLINE state?
# zpool status mirpoolpool: mirpool
state: DEGRADED
status: One or more devices has been taken offline by theadministrator. Sufficient replicas exist for the poolto continue functioning in a degraded state.
action: Online the device using ’zpool online’ or replace thedevice with ’zpool replace’.
scrub: resilver completed after 0h0m with 0 errors on Wed Sep 810:39:29 2010
config:
NAME STATE READ WRITE CKSUM
mirpool DEGRADED 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0
mirror-0 DEGRADED 0 0 0
c1t226000C0FFA001ABd4 ONLINE 0 0 0
c2t216000C0FF8001ABd4 OFFLINE 0 0 0
-
8/16/2019 D62269GC30_ag.pdf
34/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 16
spares
c1t226000C0FFA001ABd5 AVAIL
c2t216000C0FF8001ABd5 AVAIL
errors: No known data errors
No, the disk is OFFLINE, and the mirror that contains the disk is in the DEGRADED state.Therefore, the pool itself is in the DEGRADED state.
16. Display the I/O statistics and capacity for the virtual devices in mirpool. Make note of theused capacity of the top-level devices.
# zpool iostat -v mirpool
capacity operations bandwidth
pool alloc free read write read write
------------------------- ----- ----- ----- ----- ----- -----
mirpool 2.00G 13.5G 2 15 300K 1.74M
c2t216000C0FF8001ABd3 1.00G 6.75G 2 7 300K 894K
mirror 1.00G 6.75G 0 9 174 1.07Mc1t226000C0FFA001ABd4 - - 0 9 4.10K 1.08M
c2t216000C0FF8001ABd4 - - 0 9 1.15K 1.08M
------------------------- ----- ----- ----- ----- ----- -----
17. Create a new 600-MB file called /mirpool/file_600m.
# mkfile 600m /mirpool/file_600m
18. Display the I/O statistics and capacity for the virtual devices in mirpool. Verify that theused capacity has increased, and that the single 8-GB mirror virtual device now contains1.59 GB of data.
# zpool iostat -v mirpool
capacity operations bandwidthpool alloc free read write read write
------------------------- ----- ----- ----- ----- ----- -----
mirpool 2.59G 12.9G 2 18 280K 2.10M
c2t216000C0FF8001ABd3 1.59G 6.16G 2 11 280K 1.29M
mirror 1.00G 6.75G 0 8 160 1008K
c1t226000C0FFA001ABd4 - - 0 8 3.77K 1012K
c2t216000C0FF8001ABd4 - - 0 8 1.06K 1012K
------------------------- ----- ----- ----- ----- ----- -----
19. Bring the disk that is currently OFFLINE in mirpool back to the ONLINE state.
# zpool online mirpool c2t216000C0FF8001ABd4
20. Display the status of mirpool. Are all of the devices and the pool itself in the ONLINE state? Did the resilver operation complete successfully?
# zpool status mirpool
pool: mirpool
state: ONLINE
scrub: resilver completed after 0h0m with 0 errors on Wed Sep 8 11:11:35 2010
config:
-
8/16/2019 D62269GC30_ag.pdf
35/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 17
NAME STATE READ WRITE CKSUM
mirpool ONLINE 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
c1t226000C0FFA001ABd4 ONLINE 0 0 0
c2t216000C0FF8001ABd4 ONLINE 0 0 0 59.5K resilvered
sparesc1t226000C0FFA001ABd5 AVAIL
c2t216000C0FF8001ABd5 AVAIL
errors: No known data errors
All devices and mirpool itself are in the ONLINE state, and the resilver operationcompleted successfully.
21. Use the zpool history command to identify the disk that you detached from the firstmirror device in mirpool.
# zpool history
.
.
.
2010-08-10.10:43:48 zpool detach mirpool c1t226000C0FFA001ABd3
22. Attach the disk you identified in the previous step to the single 8 GB disk in mirpool.
# zpool attach mirpool c2t216000C0FF8001ABd3 c1t226000C0FFA001ABd3
23. Monitor the status of mirpool as the resilver process proceeds and verify that it completessuccessfully.
# zpool status -v mirpool
pool: mirpoolstate: ONLINE
scrub: resilver completed after 0h0m with 0 errors on Wed Sep 8 11:16:21 2010
config:
NAME STATE READ WRITE CKSUM
mirpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0
c1t226000C0FFA001ABd3 ONLINE 0 0 0 1.59G resilvered
mirror-1 ONLINE 0 0 0
c1t226000C0FFA001ABd4 ONLINE 0 0 0
c2t216000C0FF8001ABd4 ONLINE 0 0 0
spares
c1t226000C0FFA001ABd5 AVAIL
c2t216000C0FF8001ABd5 AVAIL
errors: No known data errors
-
8/16/2019 D62269GC30_ag.pdf
36/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 18
Practice 4-4: Destroying ZFS Storage Pools
Overview
In this practice, you destroy a ZFS storage pool, restore it using the GUID, and then destroy itfor a final time.
Tasks1. Use the zpool list command to verify that mirpool is the only pool that exists on your
system.
# zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
mirpool 15.5G 2.59G 12.9G 16% ONLINE -
2. Change directory to /mirpool.
# cd /mirpool
3. Attempt to destroy the mirpool pool. What happens and why?
# zpool destroy mirpool
cannot unmount ’/mirpool’: Device busycould not destroy ’mirpool’: could not unmount datasets
The attempt to destroy mirpool fails because the /mirpool file system is busy.
4. Change directory to /.
# cd /
5. Identify the numeric ID or GUID of mirpool and make a note of it.
# zpool get guid mirpool
NAME PROPERTY VALUE SOURCE
mirpool guid 9398228700118830689 default
6. Destroy mirpool. Use the zpool list command to verify that mirpool no longerexists.
# zpool destroy mirpool
# zpool list
no pools available
7. Use the zpool command to restore mirpool by specifying the GUID.
# zpool import -D 9398228700118830689
If more than one pool with the same name exists in the list of pools that can be imported,then import the pool by the GUID that was identified above.
8. Confirm that mirpool is restored.
# zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
mirpool 15.5G 2.59G 12.9G 16% ONLINE -
9. Destroy mirpool again. Use the zpool list command to verify that mirpool no longerexists.
# zpool destroy mirpool
# zpool list
no pools available
-
8/16/2019 D62269GC30_ag.pdf
37/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 19
Practice 4-5: Working with RAID-Z Pools
Overview
In this practice, you build two separate ZFS pools that are composed of RAID-Z and RAID-Z2top-level devices, and then distribute data in those pools.
Tasks1. Display the list of your disks from /opt/ses/lab/zfs/my_disks. Identify six of the 8-GB
disks assigned to you.
# cat /opt/ses/lab/zfs/my_disks
2. Create a new pool called rzpool that contains two RAID-Z devices of three disks each.
# zpool create rzpool raidz c1t226000C0FFA001ABd3c1t226000C0FFA001ABd4 c1t226000C0FFA001ABd5 raidz c2t216000C0FF8001ABd3 c2t216000C0FF8001ABd4
c2t216000C0FF8001ABd5
3. Use the zpool list command to display the size and space utilization for rzpool. Whatis the reported size, and how much space has been used?
# zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
rzpool 46.8G 147K 46.7G 0% ONLINE -
If you used six 8-GB disks for rzpool, as in this example, the available pool capacity isapproximately 46 GB.
4. Use the zfs list command to identify the disk space that is available to ZFS filesystems.
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rzpool 91.9K 30.6G 28.0K /rzpool
The pool space that is available to ZFS file systems is decreased due to the space thatis consumed by the two RAID-Z devices for parity.
5. Create a 1-GB file called /rzpool/file_1g.
# mkfile 1g /rzpool/file_1g
6. Use the zpool list command to display the size and space utilization for rzpool. Howmuch space has been used to store the 1-GB file you just created?
# zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
rzpool 46.8G 1.50G 45.2G 3% ONLINE -
1.5 GB of space has been used to store the 1 GB file.
7. Display the I/O statistics and capacity for the virtual devices in rzpool.
# zpool iostat -v rzpool
capacity operations bandwidth
pool alloc free read write read write
------------------------- ----- ----- ----- ----- ----- -----
rzpool 1.50G 45.2G 0 44 48 5.16M
-
8/16/2019 D62269GC30_ag.pdf
38/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 20
raidz1 768M 22.6G 0 22 18 2.58M
c1t226000C0FFA001ABd3 - - 0 11 1.01K 1.30M
c1t226000C0FFA001ABd4 - - 0 11 1.01K 1.30M
c1t226000C0FFA001ABd5 - - 0 11 1.01K 1.30M
raidz1 769M 22.6G 0 22 30 2.58M
c2t216000C0FF8001ABd3 - - 0 11 1.01K 1.30M
c2t216000C0FF8001ABd4 - - 0 11 1.01K 1.30M
c2t216000C0FF8001ABd5 - - 0 11 1.01K 1.30M
------------------------- ----- ----- ----- ----- ----- -----
The data is written across each RAID-Z device.
8. Use the zpool command to destroy the rzpool. Confirm that the pool is destroyed.
# zpool destroy rzpool
# zpool list
no pools available
9. Display the list of your disks from /opt/ses/lab/zfs/my_disks. Identify six 8-GB disksassigned to you to create a RAID-Z2 pool with 1 RAID-Z2 device of six disks and two disks
designated as spares.
# cat /opt/ses/lab/zfs/my_disks
10. Use the disks you identified in the previous step to create the RAID-Z2 pool called rzpool with one RAID–Z2 device of six 8-GB disks and two 9-GB spare disks.
# zpool create rzpool raidz2 c1t226000C0FFA001ABd3c1t226000C0FFA001ABd4 c1t226000C0FFA001ABd5
c2t216000C0FF8001ABd3 c2t216000C0FF8001ABd4
c2t216000C0FF8001ABd5 spare c1t226000C0FFA001ABd19c2t216000C0FF8001ABd19
11. Use the zpool command to display the status of rzpool.
# zpool status
pool: rzpool
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
rzpool ONLINE 0 0 0
raidz2-0 ONLINE 0 0 0
c1t226000C0FFA001ABd3 ONLINE 0 0 0
c1t226000C0FFA001ABd4 ONLINE 0 0 0
c1t226000C0FFA001ABd5 ONLINE 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0
c2t216000C0FF8001ABd4 ONLINE 0 0 0
c2t216000C0FF8001ABd5 ONLINE 0 0 0
spares
c1t226000C0FFA001ABd19 AVAIL
-
8/16/2019 D62269GC30_ag.pdf
39/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 21
c2t216000C0FF8001ABd19 AVAIL
errors: No known data errors
12. Use the zpool list command to display the size and space utilization for rzpool. Whatis the new reported size?
# zpool listNAME SIZE ALLOC FREE CAP HEALTH ALTROOT
rzpool 46.8G 212K 46.7G 0% ONLINE -
With six 8-GB disks, the pool capacity is approximately 46.8 GB.
13. Use the zfs list command to display the space available for ZFS file systems inrzpool. What is the reported size?
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rzpool 132K 30.6G 42.0K /rzpool
The disk space that is available to ZFS file systems is approximately 30.6 GB due to thespace that is consumed by the RAID-Z2 parity information.
14. Create a 2-GB file called /rzpool/file_2g.
# mkfile 2g /rzpool/file_2g
15. Display the I/O statistics and capacity for the top-level virtual devices in rzpool. How muchspace has been used to store the 2-GB file you just made?
# zpool iostat -v rzpool
capacity operations bandwidth
pool alloc free read write read write
------------------------- ----- ----- ----- ----- ----- -----rzpool 3.00G 43.7G 0 69 38 8.10M
raidz2 3.00G 43.7G 0 69 38 8.10M
c1t226000C0FFA001ABd3 - - 0 18 550 2.03M
c1t226000C0FFA001ABd4 - - 0 18 550 2.03M
c1t226000C0FFA001ABd5 - - 0 18 809 2.03M
c2t216000C0FF8001ABd3 - - 0 18 809 2.03M
c2t216000C0FF8001ABd4 - - 0 18 550 2.03M
c2t216000C0FF8001ABd5 - - 0 18 809 2.03M
------------------------- ----- ----- ----- ----- ----- -----
A total of 3.0 GB of space has been used to store the new 2-GB file.
-
8/16/2019 D62269GC30_ag.pdf
40/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 22
Practice 4-6: Managing Devices in RAID-Z Pools
Overview
In this practice, you take disk devices offline and bring them online in ZFS pools that arecomposed of RAID-Z top-level devices. You also monitor the resilvering process in these pools.
Tasks1. Display the list of your disks from /opt/ses/lab/zfs/my_disks. Identify a single 9-GB
disk assigned to you that is currently not in use.
# cat /opt/ses/lab/zfs/my_disks
2. Attempt to attach the 9–GB disk that you identified in the previous step to the RAID-Z2
device in rzpool. What happens and why?
# zpool attach rzpool c2t216000C0FF8001ABd5 c1t226000C0FFA001ABd20 cannot attach c1t226000C0FFA001ABd20 toc2t216000C0FF8001ABd5: can only attach to mirrors and top-leveldisks
The attempt fails because the attach operation is not applicable to RAID-Z devices. The
same is true of a zpool detach operation.3. Display the status of rzpool. Verify that all devices and the pool are online.
# zpool status
pool: rzpool
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
rzpool ONLINE 0 0 0
raidz2-0 ONLINE 0 0 0c1t226000C0FFA001ABd3 ONLINE 0 0 0
c1t226000C0FFA001ABd4 ONLINE 0 0 0
c1t226000C0FFA001ABd5 ONLINE 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0
c2t216000C0FF8001ABd4 ONLINE 0 0 0
c2t216000C0FF8001ABd5 ONLINE 0 0 0spares
c1t226000C0FFA001ABd19 AVAIL
c2t216000C0FF8001ABd19 AVAIL
errors: No known data errors
4. Use the zpool command to take the sixth disk in the RAID-Z2 device in rzpool offline.
# zpool offline rzpool c2t216000C0FF8001ABd5
5. Display the status of rzpool. What state is the pool in and why?
# zpool status
-
8/16/2019 D62269GC30_ag.pdf
41/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 23
pool: rzpool
state: DEGRADED
status: One or more devices has been taken offline by theadministrator. Sufficient replicas exist for the poolto continue functioning in a degraded state.
action: Online the device using 'zpool online' or replace the
device with 'zpool replace'.scrub: none requested
config:
NAME STATE READ WRITE CKSUM
rzpool DEGRADED 0 0 0
raidz2-0 DEGRADED 0 0 0
c1t226000C0FFA001ABd3 ONLINE 0 0 0
c1t226000C0FFA001ABd4 ONLINE 0 0 0
c1t226000C0FFA001ABd5 ONLINE 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0c2t216000C0FF8001ABd4 ONLINE 0 0 0
c2t216000C0FF8001ABd5 OFFLINE 0 0 0spares
c1t226000C0FFA001ABd19 AVAIL
c2t216000C0FF8001ABd19 AVAIL
errors: No known data errors
The pool is in a degraded state because one of the devices has been taken offline;however, because sufficient replicas exist, the pool will continue to function in adegraded state.
6. Use the zpool command to bring the off-line disk back online.
# zpool online rzpool c2t216000C0FF8001ABd5
7. Display the status of rzpool, and monitor the resilvering process until it completes. Verifythat the pool and all devices are in the ONLINE state.
# zpool status rzpool
pool: rzpool
state: ONLINE
scrub: resilver completed after 0h0m with 0 errors on Thu Sep 9 14:30:37 2010
config:
NAME STATE READ WRITE CKSUM
rzpool ONLINE 0 0 0
raidz2-0 ONLINE 0 0 0
c1t226000C0FFA001ABd3 ONLINE 0 0 0
c1t226000C0FFA001ABd4 ONLINE 0 0 0
c1t226000C0FFA001ABd5 ONLINE 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0
c2t216000C0FF8001ABd4 ONLINE 0 0 0
-
8/16/2019 D62269GC30_ag.pdf
42/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 24
c2t216000C0FF8001ABd5 ONLINE 0 0 0 6.50Kresilvered
spares
c1t226000C0FFA001ABd19 AVAIL
c2t216000C0FF8001ABd19 AVAIL
errors: No known data errors
8. Destroy the rzpool pool and confirm that it is destroyed.# zpool destroy rzpool
# zpool list
no pools available
-
8/16/2019 D62269GC30_ag.pdf
43/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 25
Practice 4-7: Working with the autoexpand Property
Overview
In this practice, you familiarize yourself with how the autoexpand property works. First, youcreate a pool with an 8-GB disk, leaving the autoexpand property to its default setting of off.You then replace the disk with a 9-GB disk. Next, you enable the autoexpand property to see
how the pool size is expanded.
Tasks
1. Create a new pool called mypool that contains one 8-GB disk from your list of disks foundin /opt/ses/lab/zfs/my_disks.
# cat /opt/ses/lab/zfs/my_disks
# zpool create mypool c1t226000C0FFA001ABd0
2. Use the zpool list command to verify that the new pool exists.
# zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
mypool 7.75G 76.5K 7.75G 0% ONLINE -Make note of the size of the pool.
3. Display the properties for mypool and make note of the autoexpand property setting.
# zpool get all mypool
NAME PROPERTY VALUE SOURCE
mypool size 7.75G -
mypool capacity 0% -
mypool altroot - default
mypool health ONLINE -
mypool guid 4117010077574798133 default
mypool version 22 defaultmypool bootfs - default
mypool delegation on default
mypool autoreplace off default
mypool cachefile - default
mypool failmode wait default
mypool listsnapshots on default
mypool autoexpand off default
mypool free 7.75G -
mypool allocated 95.5K -
The autoexpand property is set to its default setting of off.
4. Replace the 8-GB disk with one of the 9-GB disks from your list of disks.
# zpool replace mypool c1t226000C0FFA001ABd0c1t226000C0FFA001ABd16
5. Run the zpool list command again. Do you notice any change in the size of the pool? Ifnot, why?
# zpool list
-
8/16/2019 D62269GC30_ag.pdf
44/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 4: Managing ZFS Storage Pools
Chapter 4 - Page 26
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
mypool 7.75G 87K 7.75G 0% ONLINE -
You see no change in the size of the pool because you have not yet enabled the
autoexpand property.
6. Set the autoexpand property to on and then rerun the zpool list command. Has therebeen a change in the size of the pool?
# zpool set autoexpand=on mypool # zpool list
NAME SIZE ALLOC FREE CAP HEALTH ALTROOT
mypool 8.75G 117K 8.75G 0% ONLINE -
The 1-GB increase is now reflected in the zpool list output.
7. Destroy mypool, and then use the zpool list command to verify that the pool no longerexists.
# zpool destroy mypool
# zpool list
no pools available
-
8/16/2019 D62269GC30_ag.pdf
45/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 1
Practices for Lesson 5:Managing ZFS File Systems
Chapter 5
-
8/16/2019 D62269GC30_ag.pdf
46/128
-
8/16/2019 D62269GC30_ag.pdf
47/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 3
Practices for Lesson 5
Practices Overview
In these practices, you will create, rename, mount, unmount, and destroy ZFS files systems.You will also work with ZFS properties, quotas, and reservations.
PreparationIf the systems used for this exercise have been re-initialized, it will be necessary to run the
make_disk_list script in /opt/ses/lab/zfs. Your instructor will indicate if this isnecessary, and will assign disks to you before you run the script.
-
8/16/2019 D62269GC30_ag.pdf
48/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 4
Practice 5-1: Creating, Renaming, and Destroying ZFS File Systems
Overview
In this practice, you create, rename, and destroy ZFS files systems
Tasks
1. Review the list of your disks from /opt/ses/lab/zfs/my_disks. Identify six 8-GB disksassigned to you.
# cat /opt/ses/lab/zfs/my_disks
2. Use the six 8-GB disks you identified in the previous step to create a pool that contains
three mirror devices. Name the pool mirpool.
# zpool create mirpool mirror c1t226000C0FFA001ABd3c2t216000C0FF8001ABd3 mirror c1t226000C0FFA001ABd4c2t216000C0FF8001ABd4 mirror c1t226000C0FFA001ABd5c2t216000C0FF8001ABd5
3. Verify that mirpool and all of its devices are in the ONLINE state.
# zpool status
pool: mirpool
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
mirpool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
c1t226000C0FFA001ABd3 ONLINE 0 0 0
c2t216000C0FF8001ABd3 ONLINE 0 0 0
mirror-1 ONLINE 0 0 0
c1t226000C0FFA001ABd4 ONLINE 0 0 0
c2t216000C0FF8001ABd4 ONLINE 0 0 0
mirror-2 ONLINE 0 0 0
c1t226000C0FFA001ABd5 ONLINE 0 0 0
c2t216000C0FF8001ABd5 ONLINE 0 0 0
errors: No known data errors
4. List the ZFS file systems that currently exist.
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
mirpool 78K 22.9G 21K /mirpool
5. Create a file system named mirpool/users with a mount point of /user. Confirm thatthe file system is created.
# zfs create -o mountpoint=/users mirpool/users
# zfs list -r mirpool
NAME USED AVAIL REFER MOUNTPOINT
-
8/16/2019 D62269GC30_ag.pdf
49/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 5
mirpool 120K 22.9G 21K /mirpool
mirpool/users 21K 22.9G 21K /users
6. Create an intermediate file system and descendent file systems named
mirpool/users/it/admin1 and mirpool/users/it/admin2. Confirm that the filesystems are created.
# zfs create -p mirpool/users/it/admin1
# zfs create mirpool/users/it/admin2# zfs list -r mirpool
NAME USED AVAIL REFER MOUNTPOINT
mirpool 204K 22.9G 21K /mirpool
mirpool/users 88K 22.9G 23K /users
mirpool/users/it 65K 22.9G 23K /users/it
mirpool/users/it/admin1 21K 22.9G 21K /users/it/admin1
mirpool/users/it/admin2 21K 22.9G 21K /users/it/admin2
7. Rename the mirpool/users/it file system to mirpool/users/staff. Confirm thatthe file system name has changed.
# zfs rename mirpool/users/it mirpool/users/staff# zfs list -r mirpool
NAME USED AVAIL REFER MOUNTPOINT
mirpool 206K 22.9G 21K /mirpool
mirpool/users 89K 22.9G 23K /users
mirpool/users/staff 66K 22.9G 24K /users/staff
mirpool/users/staff/admin1 21K 22.9G 21K /users/staff/admin1
mirpool/users/staff/admin2 21K 22.9G 21K /users/staff/admin2
8. Attempt to destroy the mirpool/users/staff file system. What happens and why?
# zfs destroy mirpool/users/staff
cannot destroy ’mirpool/users/staff’: filesystem has children
use ’-r’ to destroy the following datasets:
mirpool/users/staff/admin1
mirpool/users/staff/admin2
The descendent file systems prevent the staff file system from being destroyed.
9. Destroy the mirpool/users/staff file system and descendent file systems.
# zfs destroy -r mirpool/users/staff
Care should be taken when destroying file systems. No feature currently exists torecover a destroyed file system other than restoring from a snapshot or a backup copy.
10. Destroy the mirpool/users file system. Confirm that the file systems are destroyed.
# zfs destroy mirpool/users# zfs list -r mirpool
NAME USED AVAIL REFER MOUNTPOINT
mirpool 84K 22.9G 21K /mirpool
-
8/16/2019 D62269GC30_ag.pdf
50/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 6
Practice 5-2: Working with ZFS Properties
Overview
In this practice, you set and display ZFS properties.
Tasks
1. Use the zfs get command to display all of the properties for the mirpool file system. Doall the properties use the same source? If so, which source is it, and why?
# zfs get all mirpool
NAME PROPERTY VALUE SOURCE
mirpool type filesystem -
mirpool creation Fri Sep 17 15:00 2010 -
mirpool used 84K -
mirpool available 22.9G -
mirpool referenced 21K -
mirpool compressratio 1.00x -
mirpool mounted yes -mirpool quota none default
All of the settable properties have the same source, default, because none of theproperties have been set manually or inherited.
2. Create a new UFS directory called /class. Confirm that the new directory is created.
# mkdir /class
# ls /class
3. Use the tar command to create an archive of the /usr/lib directory, and save thearchive as /class/archive.tar. Use the -k option to limit the size of this archive to 820
MB. You will use this file to demonstrate how the compression property functions in ZFS filesystems.
# tar cfk /class/archive.tar 839680 /usr/lib
tar: please insert new volume, then press RETURN.(Enter Control-C)
Note: The tar command prompts you to press RETURN when it has created an archiveof the size (in kilobytes) you specified. Enter Control-C in response to this prompt.Doing so prevents tar from overwriting archive.tar with the next set of files thatexceed the limit you specified.
4. Use the zfs list command to list the space currently used by mirpool. Make note ofthe value indicated.
# zfs list mirpool
NAME USED AVAIL REFER MOUNTPOINT
mirpool 204K 22.9G 21K /mirpool
5. Create a directory named /mirpool/cmp to hold the files that you will copy.
# mkdir /mirpool/cmp
6. Use ls with the -lh options to list the size of /class/archive.tar. Make note of thesize displayed.
-
8/16/2019 D62269GC30_ag.pdf
51/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 7
# ls -lh /class/archive.tar
-rw-r--r-- 1 root root 820M Sep 17 15:15 /class/archive.tar
7. Use the zfs get command to display the current settings of the compression andcompressratio properties for mirpool. Verify that compression is off, and thecompression ratio is 1.00x.
# zfs get compression,compressratio mirpool
NAME PROPERTY VALUE SOURCEmirpool compression off default
mirpool compressratio 1.00x -
8. Copy /class/archive.tar to /mirpool/cmp/archive1.tar, and list/mirpool/cmp/archive1.tar to display its size.
# cp /class/archive.tar /mirpool/cmp/archive1.tar
# ls -lh /mirpool/cmp/archive1.tar
-rw-r--r-- 1 root root 820M Sep 17 15:22/mirpool/cmp/archive1.tar
9. Use the zfs list command to list the space used by mirpool. Does the space used
match the size of /mirpool/cmp/archive1.tar?# zfs list
NAME USED AVAIL REFER MOUNTPOINT
mirpool 821M 22.1G 821M /mirpool
Yes, the size of /mirpool/cmp/archive1.tar and the space used in mirpool match (within rounding approximation tolerance).
10. Use zfs get to verify that the compression ratio for mirpool is still 1.00x.
# zfs get compressratio mirpool
NAME PROPERTY VALUE SOURCE
mirpool compressratio 1.00x -
11. Set the compression property for mirpool to gzip, and verify that the new value is set.# zfs set compression=gzip mirpool
# zfs get compression mirpool
NAME PROPERTY VALUE SOURCE
mirpool compression gzip local
12. Copy /class/archive.tar to /mirpool/cmp/archive2.tar, and list all files in/mirpool/cmp to display their sizes. Are the files in /mirpool/cmp the same size?
# cp /class/archive.tar /mirpool/cmp/archive2.tar
# ls -lh /mirpool/cmp/
total 2387014
-rw-r--r-- 1 root root 820M Sep 17 15:22 archive1.tar-rw-r--r-- 1 root root 820M Sep 17 15:25 archive2.tar
Yes, the archive1.tar and archive2.tar files are the same size.
13. Use the zfs list command to list the space used by mirpool. Does the space usedmatch the sum of the size of the two files in /mirpool/cmp?
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
-
8/16/2019 D62269GC30_ag.pdf
52/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 8
mirpool 1.14G 21.7G 1.14G /mirpool
No, zfs list reports 1.14 GB used, where the sum of the size of the two files isapproximately 1.64 GB.
14. Use the zfs get command to display the current setting of the compressratio propertyfor mirpool. What is the current compression ratio?
# zfs get compressratio mirpool
NAME PROPERTY VALUE SOURCEmirpool compressratio 1.40x -
The compression ratio is currently 1.40x in this example.
15. Copy /class/archive.tar to /mirpool/cmp/archive3.tar, and list all files in/mirpool/cmp to display their sizes. Are the files in /mirpool/cmp the same size?
# cp /class/archive.tar /mirpool/cmp/archive3.tar
# ls -lh /mirpool/cmp/*
-rw-r--r-- 1 root root 820M Sep 17 15:22/mirpool/cmp/archive1.tar
-rw-r--r-- 1 root root 820M Sep 17 15:25
/mirpool/cmp/archive2.tar-rw-r--r-- 1 root root 820M Sep 17 15:30/mirpool/cmp/archive3.tar
Yes, the three files are the same size.
16. Use the du -h command to display the space used by the files in /mirpool/cmp. Howdoes the space these files use compare?
# du -h /mirpool/cmp/*
821M /mirpool/cmp/archive1.tar
345M /mirpool/cmp/archive2.tar
345M /mirpool/cmp/archive3.tar
The archive1.tar file uses 821 MB of space and the other two files use 345 MB eachin this example.
17. Use the zfs get command to display the current value of the compressratio propertyfor mirpool. What is the current compression ratio? How has it changed and why?
# zfs get compressratio mirpool
NAME PROPERTY VALUE SOURCE
mirpool compressratio 1.62x -
The compression ratio has increased to 1.62x with the addition of the secondcompressed file. A larger proportion of the data in the pool is now compressed.
18. Remove the /mirpool/cmp/archive1.tar file.
# rm /mirpool/cmp/archive1.tar
19. Use the zfs get command to display the current value of the compressratio propertyfor mirpool. What is the current compression ratio and how has it changed?
# zfs get compressratio mirpool
NAME PROPERTY VALUE SOURCE
mirpool compressratio 2.37x -
The compression ratio has increased to 2.37x with the removal of the uncompressed file.
-
8/16/2019 D62269GC30_ag.pdf
53/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 9
20. Use the zfs list command to list the space used by mirpool, and du -h to list thespace used by the remaining two files in /mirpool/cmp. Does the used value reported byzfs list reflect the sum of the space used by the two files in /mirpool/cmp?
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
mirpool 690M 22.2G 690M /mirpool
# du -h /mirpool/cmp/*345M /mirpool/cmp/archive2.tar
345M /mirpool/cmp/archive3.tar
Yes, the two values correlate. The two compressed archives consume approximately690 MB.
21. Remove the mirpool/cmp directory.
# rm -rf /mirpool/cmp
-
8/16/2019 D62269GC30_ag.pdf
54/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 10
Practice 5-3: Demonstrating ZFS Property Inheritance
Overview
In this practice, you set and display properties.
Tasks
1. Use the zfs get command to display the current setting of the compression property formirpool. What source is listed for it?
# zfs get compression mirpool
NAME PROPERTY VALUE SOURCE
mirpool compression gzip local
The compression property lists the local source.
2. Use the zfs list command to verify that mirpool is the only ZFS file system currentlyavailable.
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
mirpool 128K 22.9G 22K /mirpool
3. Use the zfs command to create a new file system named mirpool/fs1.
# zfs create mirpool/fs1
4. Use zfs get to display all properties for mirpool/fs1. Do all of the properties list thesame source? What inheritance, if any, is described in the source list?
# zfs get all mirpool/fs1
NAME PROPERTY VALUE SOURCE
mirpool/fs1 type filesystem -
mirpool/fs1 creation Fri Sep 17 15:35 2010 -
mirpool/fs1 used 21K -
mirpool/fs1 available 22.9G -
mirpool/fs1 referenced 21K -
mirpool/fs1 compressratio 1.00x -
mirpool/fs1 mounted yes -
mirpool/fs1 quota none default
mirpool/fs1 reservation none default
mirpool/fs1 recordsize 128K default
mirpool/fs1 mountpoint /mirpool/fs1 default
mirpool/fs1 sharenfs off default
mirpool/fs1 checksum on default
mirpool/fs1 compression gzip inherited frommirpool
The compression property differs from the others that list the default source. The
compression property for mirpool/fs1 is inherited from mirpool.
5. Use the zfs command to create a new file system named mirpool/fs1/fs2.
# zfs create mirpool/fs1/fs2
6. Set the compression property for the mirpool/fs1 file system to off.
# zfs set compression=off mirpool/fs1
-
8/16/2019 D62269GC30_ag.pdf
55/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 11
7. Use the zfs get command to display the compression property for all file systemsbelow mirpool. Has this property been inherited among the file systems listed?
# zfs get -r compression mirpool
NAME PROPERTY VALUE SOURCE
mirpool compression gzip local
mirpool/fs1 compression off local
mirpool/fs1/fs2 compression off inherited from mirpool/fs1The mirpool/fs1/fs2 file system now inherits the compression value frommirpool/fs1.
8. Set the compression property for the mirpool/fs1/fs2 file system to gzip.
# zfs set compression=gzip mirpool/fs1/fs2
9. Use the zfs get command to display the compression property for all file systemsbelow mirpool. Has this property been inherited among the file systems listed?
# zfs get -r compression mirpool
NAME PROPERTY VALUE SOURCE
mirpool compression gzip local
mirpool/fs1 compression off localmirpool/fs1/fs2 compression gzip local
None of the three file systems inherit the compression property setting. All are locallyset.
10. Use a single zfs inherit command to cause mirpool/fs1 and mirpool/fs1/fs2 toinherit their compression values from mirpool.
# zfs inherit -r compression mirpool/fs1
11. Use zfs get to verify that mirpool/fs1 and mirpool/fs1/fs2 now inherit theircompression value from mirpool.
# zfs get -r compression mirpool
NAME PROPERTY VALUE SOURCEmirpool compression gzip local
mirpool/fs1 compression gzip inherited from mirpool
mirpool/fs1/fs2 compression gzip inherited from mirpool
12. Set the compression property to off on mirpool.
# zfs set compression=off mirpool
13. Confirm that compression is disabled for mirpool and its descendents.
# zfs get -r compression mirpool
NAME PROPERTY VALUE SOURCE
mirpool compression off local
mirpool/fs1 compression off inherited from mirpool
mirpool/fs1/fs2 compression off inherited from mirpool
-
8/16/2019 D62269GC30_ag.pdf
56/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 12
Practice 5-4: Mounting ZFS File Systems
Overview
In this practice, you mount and unmount ZFS file systems.
Tasks
1. Use the zfs set command to set the mountpoint property for mirpool to /home1. Thenlist the properties for mirpool/fs1.
# zfs set mountpoint=/home1 mirpool
# zfs get -r mountpoint mirpool
NAME PROPERTY VALUE SOURCE
mirpool mountpoint /home1 local
mirpool/fs1 mountpoint /home1/fs1 inherited from mirpool
mirpool/fs1/fs2 mountpoint /home1/fs1/fs2 inherited from mirpool
2. Use the zfs mount command to verify the mount points of mirpool file systems.
# zfs mount | grep mirpool
mirpool /home1mirpool/fs1 /home1/fs1
mirpool/fs1/fs2 /home1/fs1/fs2
3. Use the zfs get command to display the mountpoint and mounted properties formirpool. Verify that the values match the information displayed in the previous step. Whatsource is listed for the mountpoint property, and why?
# zfs get mountpoint,mounted mirpool
NAME PROPERTY VALUE SOURCE
mirpool mountpoint /home1 local
mirpool mounted yes -
The mountpoint property used the local source because you set the mount point toa directory different from what would be used by default.
4. Examine the /etc/vfstab file and verify that no entry for mirpool exists in it.
# grep mirpool /etc/vfstab
5. Use zfs unmount to unmount the mirpool file system and verify that it has beenunmounted.
# zfs unmount /home1
# zfs mount | grep mirpool
6. Use zfs mount to mount the mirpool file system and verify that it has been mounted as/home1.
# zfs mount -a# zfs mount | grep mirpool
mirpool /home1
mirpool/fs1 /home1/fs1
mirpool/fs1/fs2 /home1/fs1/fs2
7. Create a new file system named mirpool/fsa.
# zfs create mirpool/fsa
-
8/16/2019 D62269GC30_ag.pdf
57/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 13
8. Use zfs mount to verify that the new file systems have been mounted below /home1.
# zfs mount | grep mirpool
mirpool /home1
mirpool/fs1 /home1/fs1
mirpool/fs1/fs2 /home1/fs1/fs2
mirpool/fsa /home1/fsa
9. Attempt to use the umount command to unmount /home1/fsa. What happens?
# umount /home1/fsa
# mount | grep fsa
The /home1/fsa file system unmounts.
10. Attempt to use the mount command to mount mirpool/fsa as /home/fsa. Whathappens and why?
# mount -F zfs mirpool/fsa /home1/fsa
filesystem ’mirpool/fsa’ cannot be mounted using ’mount -F zfs’
Use ’zfs set mountpoint=/home1/fsa’ instead.
If you must use ’mount -F zfs’ or /etc/vfstab, use ’zfs setmountpoint=legacy’.
See zfs(1M) for more information.
The attempt fails because you cannot use the mount command to mount a ZFS filesystem whose mountpoint property is not set to legacy.
11. Set the mountpoint property for mirpool/fsa to legacy.
# zfs set mountpoint=legacy mirpool/fsa
12. Attempt to use zfs mount to mount mirpool/fsa. What happens and why?
# zfs mount mirpool/fsa
cannot mount ’mirpool/fsa’: legacy mountpoint
use mount(1M) to mount this filesystem
The zfs mount attempt fails because the mountpoint property for mirpool/fsa isset to legacy.
13. Use the zfs inherit command to recursively unset the mountpoint property for filesystems associated with mirpool.
# zfs inherit -r mountpoint mirpool
14. Use zfs mount command to list the currently mounted ZFS file systems. How are the filesystems associated with mirpool mounted?
# zfs mount | grep mirpool
mirpool /mirpool
mirpool/fs1 /mirpool/fs1
mirpool/fs1/fs2 /mirpool/fs1/fs2
mirpool/fsa /mirpool/fsa
All of the mirpool file systems are mounted at their default locations.
15. Use zfs get to display the mountpoint property for file systems in mirpool. Whatsource is now listed for these file systems?
# zfs get -r mountpoint mirpool
NAME PROPERTY VALUE SOURCE
-
8/16/2019 D62269GC30_ag.pdf
58/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 14
mirpool mountpoint /mirpool default
mirpool/fs1 mountpoint /mirpool/fs1 default
mirpool/fs1/fs2 mountpoint /mirpool/fs1/fs2 default
mirpool/fsa mountpoint /mirpool/fsa default
The default source is listed for the file systems.
16. Use zfs get to display the readonly property for mirpool/fsa, and verify that the
readonly property is off.
# zfs get readonly mirpool/fsa
NAME PROPERTY VALUE SOURCE
mirpool/fsa readonly off default
17. Use the mount command to display the mount options used for mirpool/fsa. Verify thatthe options include read/write permissions.
# mount | grep mirpool/fsa
/mirpool/fsa on mirpool/fsaread/write/setuid/devices/nonbmand/exec/xattr/atime/dev= ...
18. Set the readonly property to on for the mirpool/fsa file system.
# zfs set readonly=on mirpool/fsa
19. Attempt to create a new file, /mirpool/fsa/file2. What happens and why?
# touch /mirpool/fsa/file2
touch: cannot create /mirpool/fsa/file2: Read-only file system
The attempt fails because the readonly property of the file system is set to on.
20. Use the mount command to display the mount options used for mirpool/fsa. Verify thatthe options now reflect read-only permission.
# mount | grep mirpool/fsa
/mirpool/fsa on mirpool/fsa readonly/setuid/devices/nonbmand/exec/xattr/atime/dev= ...
21. Destroy the mirpool/fsa file system.# zfs destroy mirpool/fsa
-
8/16/2019 D62269GC30_ag.pdf
59/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 15
Practice 5-5: Sharing ZFS File Systems
Overview
In this practice, you share and unshare ZFS file systems.
Tasks
1. Use the zfs get command to display the sharenfs property for the mirpool filesystems. Is this property currently inherited?
# zfs get -r sharenfs mirpool
NAME PROPERTY VALUE SOURCE
mirpool sharenfs off default
mirpool/fs1 sharenfs off default
mirpool/fs1/fs2 sharenfs off default
No, the file systems use the default source for the sharenfs property.
2. Attempt to share the mirpool/fs1 file system by using the zfs share command. Whathappens and why?
# zfs share mirpool/fs1cannot share ’mirpool/fs1’: legacy share
use share(1M) to share this filesystem, or set sharenfs propertyon
The attempt fails because ZFS file systems are not shared by default. With the
sharenfs property set to off, the file system is managed as a legacy share.
3. Set the sharenfs property for the mirpool/fs1 file system to on.
# zfs set sharenfs=on mirpool/fs1
4. Use the zfs get command to display the sharenfs property for all file systems belowmirpool. How has the property you set in the previous command been inherited?
# zfs get -r sharenfs mirpoolNAME PROPERTY VALUE SOURCE
mirpool sharenfs off default
mirpool/fs1 sharenfs on local
mirpool/fs1/fs2 sharenfs on inherited from mirpool/fs1
The mirpool/fs1 and mirpool/fs1/fs2 file systems have sharenfs set to on,and mirpool/fs1/fs2 inherits this property from mirpool/fs1.
5. Use the share command to verify the list of NFS shared file systems.
# share
- /mirpool/fs1 rw ""
- /mirpool/fs1/fs2 rw ""6. Use a single zfs inherit command to cause mirpool/fs1 and mirpool/fs1/fs2 to
inherit their sharenfs values from mirpool.
# zfs inherit -r sharenfs mirpool/fs1
7. Use the zfs get command to display the sharenfs property for all file systems belowmirpool. What is the source and value for the sharenfs property listed for the three filesystems?
# zfs get -r sharenfs mirpool
-
8/16/2019 D62269GC30_ag.pdf
60/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 16
NAME PROPERTY VALUE SOURCE
mirpool sharenfs off default
mirpool/fs1 sharenfs off default
mirpool/fs1/fs2 sharenfs off default
The default source is listed for all three file systems, and all are set to off.
8. Verify that no file system is currently shared.
# share
9. Use the ifconfig -a command to identify the IP address your system is using, anddetermine the network portion of that IP address.
# ifconfig -a
lo0: flags=2001000849(UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL) mtu8232 index 1
inet 127.0.0.1 netmask ff000000
bge0: flags=1000843(UP,BROADCAST,RUNNING,MULTICAST,IPv4) mtu 1500index 2
inet 192.168.201.25 netmask ffffff00 broadcast 192.168.201.255
ether 0:3:ba:59:94:15
In this example, the network address is 192.168.201.
10. Use zfs set to share the mirpool/fs1/fs2 file system as read only for everyoneexcept the systems on your same network, and set the anon option to 0.
# zfs set sharenfs=ro,[email protected],anon=0 mirpool/fs1/fs2
11. Use the zfs get command to display the sharenfs property for all file systems belowmirpool. Make note of the sharenfs options listed for mirpool/fs1/fs2.
# zfs get -r sharenfs mirpool
NAME PROPERTY VALUE SOURCE
mirpool sharenfs off default
mirpool/fs1 sharenfs off default
mirpool/fs1/fs2 sharenfs ro,[email protected],anon=0 local
12. Use the share command to display the list of NFS shared file systems. Verify that theshare options listed for /mirpool/fs1/fs2 match the options listed formirpool/fs1/fs2 in the previous command.
# share
- /mirpool/fs1/fs2 anon=0,sec=sys,ro,[email protected] ""
13. Use zfs unshare to unshare mirpool/fs1/fs2.
# zfs unshare mirpool/fs1/fs2
14. Verify that no file system is currently shared.
# share
15. Destroy the mirpool/fs1 and descendent file system.# zfs destroy -r mirpool/fs1
16. Use the zpool command to identify who destroyed the file systems.
# zpool history -l | grep destroy
2010-09-09.15:14:48 zfs destroy -r mirpool/fs1 [user root onhost01:global]
The user is identified as [user root on host01:global].
-
8/16/2019 D62269GC30_ag.pdf
61/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 17
Practice 5-6: Working with ZFS Quotas and Reservations
Overview
In this practice, you set and display ZFS quotas and reservations.
Tasks
1. Set the mirpool mount point to /users. Then create six new file systems: mirpool/mkt,mirpool/edu, mirpool/mkt/usera, mirpool/mkt/userb, mirpool/edu/userc,and mirpool/edu/userd.
# zfs set mountpoint=/users mirpool
# zfs create -p mirpool/mkt/usera
# zfs create mirpool/mkt/userb
# zfs create -p mirpool/edu/userc
# zfs create mirpool/edu/userd
2. List the descendent mirpool file systems. What is the amount of available space listed forall of them?
# zfs list -r mirpoolNAME USED AVAIL REFER MOUNTPOINT
mirpool 330K 22.9G 24K /users
mirpool/edu 65K 22.9G 23K /users/edu
mirpool/edu/userc 21K 22.9G 21K /users/edu/userc
mirpool/edu/userd 21K 22.9G 21K /users/edu/userd
mirpool/mkt 66K 22.9G 24K /users/mkt
mirpool/mkt/usera 21K 22.9G 21K /users/mkt/usera
mirpool/mkt/userb 21K 22.9G 21K /users/mkt/userb
22.9 GB is available to all of the mirpool file systems in this example.
3. Set an 8-GB reservation on the mirpool/mkt and mirpool/edu file systems and verifythe settings you made.
# zfs set reservation=8g mirpool/mkt mirpool/edu
# zfs get -r reservation mirpool
NAME PROPERTY VALUE SOURCE
mirpool reservation none default
mirpool/edu reservation 8G local
mirpool/edu/userc reservation none default
mirpool/edu/userd reservation none default
mirpool/mkt reservation 8G local
mirpool/mkt/usera reservation none defaultmirpool/mkt/userb reservation none default
4. Use the zfs list command to list the space used by descendent mirpool file systems.In the USED column, which file system accounts for the two reservations you just made?Why is 14.9 GB available to the file systems below both mirpool/mkt and mirpool/edu,when they both reserve 8 GB from the 22.9 GB of total space in mirpool?
# zfs list -r mirpool
-
8/16/2019 D62269GC30_ag.pdf
62/128
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.
Practices for Lesson 5: Managing ZFS File Systems
Chapter 5 - Page 18
NAME USED AVAIL REFER MOUNTPOINT
mirpool 16.0G 6.89G 24K /users
mirpool/edu 66K 14.9G 24K /users/edu
mirpool/edu/userc 21K 14.9G 21K /users/edu/userc
mirpool/edu/userd 21K 14.9G 21K /users/edu/userd
mirpool/mkt 66K 14.9G 24K /users/mkt
mirpool/mkt/usera 21K 14.9G 21K /users/mkt/usera
mirpool/mkt/userb 21K 14.9G 21K /users/mkt/userb
The 16 GB of space reserved is reflected in the USED column for the mirpool (/users) file system. The reservations guarantee mirpool/mkt and mirpool/edu each have 8 GB of space reserved, and the 6.89 GB of remaining unreserved space in
mirpool is available to either mirpool/mkt or mirpool/edu.
5. Set a 4-GB reservation on the mirpool/mkt/usera and mirpool/edu/userc filesystems, and verify the settings you made.
# zfs set reservation=4g mirpool/mkt/usera mirpool/edu/userc
# zfs get -r reservation mirpool
NAME PROPERTY VALUE SOURCEmirpool reservation none default
mirpool/edu reservation 8G local
mirpool/edu/userc reservation 4G local
mirpool/edu/userd reservation none default
mirpool/mkt reservation 8G local
mirpool/mkt/usera reservation 4G local
mirpool/mkt/userb reservation none default
6. Use the zfs list command to list the space used by descendent mirpool file systems.In the USED column, which file systems account for the two reservations you just made?
Why has the space available to mirpool/mkt and mirpool/edu been reduced to 10.9GB from14.9 GB?
# zfs list -r mirpool
NAME USED AVAIL REFER MOUNTPOINT
mirpool 16.0G 6.89G 24K /users
mirpool/edu 4.00G 10.9G 24K /users/edu
mirpool/edu/userc 21K 14.9G 21K /users/edu/userc
mirpool/edu/userd 21K 10.9G 21K /users/edu/userd
mirpool/mkt 4.00G 10.9G 24K /users/mkt
mirpool/mkt/usera 21K 14.9G 21K /users/mkt/usera
mirpool/mkt/userb 21K 10.9G 21K /users/mkt/userbThe mirpool/mkt and mirpool/edu file systems account for the two 4-GBreservations made in