You are on page 1of 3

ZFS Cheatsheet

Friday, November 4th, 2005

For those of us outside of Sun: With ZFS on the way, I thought Id gather up from some of my resources and create a ZFS cheatsheet so you can get ready for whats to come: There are two main commands for ZFS, zfs and zpool
"zpool "zpool "zpool "zpool list" - Show current usage on zfs pools iostat 5" - Display I/O stats for zfs pools vdevs" - Shows current mirror/pool device properties create pool c0t3d0 c1t1d0 c4t4d0 c5t2d0" - Creates

a pool consisting of

c0t3d0 c1t1d0, c4t4d0, c5t2d0


"zpool create -fv pool slice1 slice2"

- Creates a pool consisting of slice1 and - Creates a mirror consisting of c2t0d0 - Adds mirror to pool

slice2
"zpool create pool mirror c1t0d0 c2t0d0"

and c2t0d0
"zpool add -f pool mirror c0t1d0s3 c0t1d0s4"

"zfs list" - Show current zfs filesystems "zfs create pool/filesystem" - Creates filesystem under pool "zfs create pool/filesystem /mountpoint" - Creates filesystem

under pool and

mounts it to mountpoint
"zfs "zfs "zfs "zfs snapshot pool/filesystem@snapshotname" - Takes snapshot of filesystem mount pool/filesystem /mountpoint" - Mounts a zfs filesystem to mountpoint destroy pool/filesystem" - Deletes filesystem from pool destroy pool" - Deletes pool

Notes on ZFS: (From what Ive gathered, may not be correct) Package Name: SUNWzfs You cant convert a UFS filesystem to a ZFS filesystem as of yet, this means if you want ZFS you will have to install Solaris 10 Express from scratch. If upgrading, ZFS can be used on new disks but not on existing UFS disks. If there is a bad checksum on a disk, ZFS will grab the good checksum from another disk in the mirror and self heal. You can use part of a pool for additional swap space. Other operating systems cant mount ZFS volumes as of yet. There is never a need to fsck a ZFS filesystem.

****

RAID-Z:
A virtual device that stores data and parity on multiple disks, similar to RAID-5. All traditional RAID-5-like algorithms (RAID-4. RAID-5. RAID-6, RDP, and EVENODD, for example) suffer from a problem known as the "RAID-5 write hole". Assume:- If

only part of a RAID-5 stripe is written, and power is lost before all blocks have made it to disk, the parity will remain out of sync with data - and therefore useless - forever (unless a subsequent full-stripe write
overwrites it).

In RAID-Z, ZFS uses variable-width RAID stripes so that all writes are fullstripe writes.

This is only possible because ZFS integrates filesystem and device management in such a way that the filesystem's metadata has enough information about the underlying data replication model to handle variable-width RAID stripes.
RAID-Z is the world's first software-only solution to the RAID-5 write hole

Creating a Basic Filesystem


# # # # zpool create tank c0t0d0 zfs create tank/fs mkfile 100m /tank/fs/foo df -h /tank/fs

Creating a Storage Pool


# zpool create tank mirror c0t0d0 c0t0d1 # zpool list

Creating a Filesystem
# zfs create tank/home/bonwick

Destroying a Filesystem
# zfs destroy tank/home/tabriz # zfs destroy tank/home/ahrens cannot unmount 'tank/home/ahrens': Device busy # zfs destroy -f tank/home/ahrens # zfs destroy tank/ws cannot destroy 'tank/ws': filesystem has children use '-r' to destroy the following datasets: tank/ws/billm tank/ws/bonwick tank/ws/maybee # zfs destroy -r tank/ws # zfs destroy -r tank/home/schrock cannot destroy 'tank/home/schrock': filesystem has dependant clones use '-R' to destroy the following datasets: tank/clones/schrock-clone # zfs destroy -R tank/home/schrock

Renaming a Filesystem
# zfs rename tank/home/kustarz tank/home/kustarz_old # zfs rename tank/home/maybee tank/ws/maybee

You might also like