Académique Documents
Professionnel Documents
Culture Documents
Col's Tech
Recommended Reads
Updated on 21 Aug '08 - Added section on sharing
information following a comment.
Updated on 11 Sept '07 - Updated to show functionality
available in Nevada build 71.
This came round on one of the many internal aliases Thanks Jim Laurent
The three primary goals of ZFS are:
Why
Get familiar with command structure and options
My #tech Tweets
Create some "virtual devices" or vdevs as
described in the zpool documentation. These can
also be real disk slices if you have them available.
CAP
HEALTH
0%
ONLINE
status -v
myzfs
ONLINE
none requested
NAME
myzfs
/disk1
/disk2
STATE
ONLINE
ONLINE
ONLINE
# zpool
# zpool
NAME
ALTROOT
myzfs
# zpool
pool:
state:
scrub:
config:
112K
95.4M
0%
ONLINE
status -v
myzfs
ONLINE
none requested
NAME
myzfs
mirror
/disk1
/disk2
/disk3
STATE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
Tag Cloud
STATE
ONLINE
ONLINE
ONLINE
ONLINE
OpenSolaris
Operating Systems
Oracle PHP
Security
Software
# zpool attach myzfs /disk1 /disk3
# zpool status -v
pool: myzfs
state: ONLINE
scrub: resilver completed with 0 errors on Tue Sep
11 13:31:49 2007
config:
NAME
myzfs
mirror
/disk1
/disk2
/disk3
STATE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
STATE
ONLINE
ONLINE
ONLINE
ONLINE
AVAIL
shorts
techie update
Ads by Google
Other Stuff
Subscribe to my feed
NAME
myzfs
mirror
/disk1
/disk2
performance plugin
ZFS Storage
ZFS iSCSI
Above Ground Pools
STATE
DEGRADED
DEGRADED
OFFLINE
ONLINE
STATE
ONLINE
ONLINE
ONLINE
ONLINE
STATE
ONLINE
ONLINE
ONLINE
ONLINE
AVAIL
CAP
HEALTH
95.4M
0%
ONLINE
http://www.opensolaris.org/os/community/zfs/version/N
Where 'N' is the version number.
# zpool iostat 5
capacity
operations
bandwidth
pool
used avail
read write
read write
---------- ----- ----- ----- ----- ----- -- Get I/O statistics for the pool
--myzfs
112K 95.4M
0
4
26 11.4K
myzfs
112K 95.4M
0
0
0
0
myzfs
112K 95.4M
0
0
0
0
# zfs create myzfs/colin
# df -h
Filesystem
kbytes
used
avail capacity
Mounted on
...
myzfs/colin 64M
18K
63M
1%
/myzfs/colin
# zfs list
NAME
myzfs
myzfs/colin
USED
139K
18K
AVAIL
63.4M
63.4M
REFER
19K
18K
MOUNTPOINT
/myzfs
/myzfs/colin
STATE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
ONLINE
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
REFER
21K
18K
18K
MOUNTPOINT
/myzfs
/myzfs/colin
/myzfs/colin2
MOUNTPOINT
/myzfs
/myzfs/colin
/myzfs/colin2
Rollback to a snapshot.
0
18K
0
20.0M
139M
18K
18K
18K
/myzfs/colin2
/myzfs/colin3
REFER
22K
18K
18K
18K
MOUNTPOINT
/myzfs
/myzfs/colin
/myzfs/colin3
Destroy a filesystem
REFER
21K
18K
18K
18K
MOUNTPOINT
Promte a clone filesystem to no longer be a
/myzfs
/myzfs/colin dependent on it's "origin" snapshot. This now
/myzfs/colin3
associates makes the snapshot a child of the
REFER
21K
18K
18K
MOUNTPOINT
filesystem.
/myzfs
/myzfs/colin3
-
PROPERTY
VALUE
type
filesystem
creation
used
146K
available
159M
referenced
20K
20K
159M
1%
20K
159M
1%
18K
159M
1%
# zpool history
History for 'myzfs':
2007-09-11.15:35:50 zpool create myzfs mirror /disk1
/disk2 /disk3
2007-09-11.15:36:00 zpool detach myzfs /disk3
2007-09-11.15:36:10 zpool attach myzfs /disk1 /disk3
2007-09-11.15:36:53 zpool detach myzfs /disk3
2007-09-11.15:36:59 zpool add myzfs spare /disk3
2007-09-11.15:37:09 zpool remove myzfs /disk3
2007-09-11.15:37:18 zpool offline myzfs /disk1
2007-09-11.15:37:27 zpool online myzfs /disk1
2007-09-11.15:37:37 zpool replace myzfs /disk1
/disk3
2007-09-11.15:37:47 zpool scrub myzfs
2007-09-11.15:37:57 zpool export myzfs
2007-09-11.15:38:05 zpool import -d / myzfs
2007-09-11.15:38:52 zfs create myzfs/colin
2007-09-11.15:39:27 zpool add myzfs mirror /disk1
/disk5
2007-09-11.15:39:38 zfs create myzfs/colin2
2007-09-11.15:39:50 zfs set reservation=20m
myzfs/colin
2007-09-11.15:40:18 zfs set quota=20m myzfs/colin2
2007-09-11.15:40:35 zfs set compression=on
myzfs/colin2
2007-09-11.15:40:48 zfs snapshot myzfs/colin@test
2007-09-11.15:40:59 zfs rollback myzfs/colin@test
2007-09-11.15:41:11 zfs clone myzfs/colin@test
myzfs/colin3
2007-09-11.15:41:25 zfs destroy myzfs/colin2
2007-09-11.15:42:12 zfs promote myzfs/colin3
2007-09-11.15:42:26 zfs rename myzfs/colin3
myzfs/bob
2007-09-11.15:42:57 zfs destroy myzfs/colin
2007-09-11.15:43:23 zfs rename myzfs/bob@test
myzfs/bob@newtest
2007-09-11.15:44:30 zfs receive myzfs/backup
How do you properly share a ZFS pool? I've got a pool that I created using
zpool create sata /dev/dsk/c6d0 /dev/dsk/c7d0
zfs create /sata/satapool
I'm trying to use a ZFS pool on an OpenSolaris server from a Windows XP PC with UNIX services installed.
... and then access the filesystem from your XP machine over NFS
OR
# zfs set sharesmb=on /sata/satapool
... and then access the filesystem from your XP machine over CIFS/SMB (you shouldn't need USFW for this).
This last one does require you to be running a certain level of OpenSolaris/SolarisExpress, but I can't
remember which rev off the top of my head. Check which rev of nevada introduces native CIFS support.
How about creating and ALT BE for LiveUpgrade while using ZFS?
Does it require two different zpools, and if so, if you only have two disks this would force you into handing disk
slices off to ZFS (something ZFS prefers you don't do for performance reasons).
Brooke: If you're using ZFS for a boot disk, you have to use slices anyway at the moment (see my HOWTO:
Migrate a UFS Root Filesystem to ZFS post), so yes, you'll need to use slices for the LU. This isn't the case in
OpenSolaris though as it uses a different upgrade mechanism taking better advantage of ZFS snapshots.
Great cheat sheet! My only question is if your OS drive gets borked for one reason or another, what's the best
way to get your ZFS pool back online? Is it as simple as reinstalling the OS and then importing the ZFS pool,
or can you not do that since you (probably) did not export the pool prior to the OS dying? Do you need to
recreate the pool with the various vdevs that compose it?
Dave: Assuming you've rebuilt your OS, you should be able to import it again into the newly built OS. zpool
import alone should list it and you can then attempting to import it using zpool import [poolname] . If this fails
because it wasn't cleanly exported, you can force it with the -f option.
Colin,
Thank you for a great resource. I just had the same problem as Dave at #7 and have managed to restore my
zfs pool without resorting to my tape drives. Marvellous!
10
Hi Colin,
I may sound wierd but I have to ask you one query. Can we created zfs pools on a server with UFS installed?
Thanks,
Pala.
11
@Pala
Yes you can, but you'll need to use a disk or slice that is not currently in use by a UFS filesystem as you'll lose
the data on that disk/slice.
For testing or educational purposes, you could use files on a UFS filesystem as "virtual disk devices" like I do
right at the beginning of this cheatsheet, but I wouldn't recommend this for production use as the performance
will be quite poor in comparison.
12
Colin,
Thank you for clarification. Are you going to post us regarding the zones/containers in near future?
Cheers,
Pala.
13
14
Great stuff, Colin! What's your recommendation on migrating a ZFS pool from devices on one san array to
devices on another array? A couple of constraints: 1) online migration is preferred. 2) new devices are smaller
size than existing devices. 3) the number of new devices in the pool is greater than the number of existing
devices in the pool (due to the smaller size of the new devices)
Thoughts?
15
@stc As your underlying devices are changing, you're best method is a "zfs send | zfs receive" to effectively
backup and restore in one go. Sadly no online migration, but once you have your two copies, you can just
export the old and import/change the new's mount point to that of the old.
16
Hey Colin, I just setup a 4 disk raid5 pool. Then I noticed somehow using the create command only three of the
four disks were added (After I imported the pool and filled it with data). Can I add in the 4th easily without losing
the data, or do I have to break it and start over? Any ideas? Thanks!
http://lildude.co.uk/zfs-cheatsheet[5/15/2012 2:25:20 PM]
17
@Jimbo: by RAID5, I assume you mean RAID-Z. Sadly, you can't add another disk to a RAID-Z configuration.
You can only add a set of disks for an additional top-level vdev. See here for more details.
18
Great list!
Typing "zdb" with no arguments produces a list of pools and the storage devices they are using. Its a quick way
to find out the serial number of a drive in a zpool.
Pingbacks
ZFS Cheatsheet Updated for snv_71 :: Cols Tech Stuff
HOWTO: Create a ZFS Filesystem OS X Leopard :: Cols Tech Stuff
Zfs versions feature madness I see 0xDEAD disks
Added Sharing Examples to ZFS Cheatsheet :: Cols Tech Stuff
Chester LUG Blog Tech Meet 1
links for 2009-07-15 /home/servrrockr
kb.hurricane-ridge.com / Bookmarks for October 1, 2009 through October 2, 2009
Topant de cap Blog Archive Sistemes darxiu amb compressi I ZFS
Cooliris Plugin
Comments Closed
If you have any further questions or comments, feel free to send them to me directly.
The views expressed on this web site are my own and do not necessarily reflect the views of Oracle/Sun Microsystems.
Copyright 2005 - 2012 Colin Seymour All rights reserved. Privacy Policy
HTML5 | CSS3