![]() |
Technical
Tip
|
|
QUESTION
ANSWER This is a brief example of setting up a ZFS storage pool and a couple of filesystems ("datasets") on Solaris 10. You'll need the Solaris Update 2 release (dated June 2006) or later, as ZFS was not in the earlier standard releases of Solaris 10. Useful documentation reference:- http://www.opensolaris.org/os/community/zfs/docs Once you have the Solaris system up and running, this is how to proceed:- 1. You'll need a spare disk partition or two for the storage pool. You can use files (see mkfile) if you're stuck for spare hard partitions, but only for experimentation. The partitions will be OVERWRITTEN by this procedure. 2. Login as root and create a storage pool using the spare partitions:- # zpool create lake c0t2d0s0 c0t2d0s1 (The # indicates the type-in prompt) If the above partitions contain exiting file systems, you may need to use the -f (force) option:- # zpool create -f lake c0t2d0s0 c0t2d0s1 The pool(called lake) has been created. 3. Use zpool list to view your pool stats:- # zpool list NAME SIZE USED AVAIL CAP HEALTH ALTROOT lake 38.2G 32.5K 38.2G 0% ONLINE - A df listing will also show it:- # df -h /lake Filesystem size used avail capacity Mounted on lake 38G 8K 38G 1% /lake 4. Now create a file system within the pool (Sun call these datasets):- # zfs create lake/fa # zfs list NAME USED AVAIL REFER MOUNTPOINT lake 43.0K 38.0G 8.50K /lake lake/fa 8K 38.0G 8K /lake/fa To destroy a storage pool (AND ALL ITS DATA) # zpool destroy lake To destroy a dataset:- # zfs destroy lake/fa 5. zpool can also create mirror devices:- # zpool create lake mirror c0t2d0s0 c0t2d0s1 and something called RAID Z (similar to RAID 5):- # zpool create lake raidz c0t2d0s0 c0t2d0s1 c0t2d0s3 6. To add further devices to a pool (not mirrors or RAIDZ - these must be extended only with similar datasets):- # zpool add lake c0t2d0s3 c0t2d0s4 # zpool status pool: lake state: ONLINE scrub: none requested config: NAME STATE READ WRITE CKSUM lake ONLINE 0 0 0 c0t2d0s0 ONLINE 0 0 0 c0t2d0s1 ONLINE 0 0 0 c0t2d0s3 ONLINE 0 0 0 c0t2d0s4 ONLINE 0 0 0 Note that datasets are automatically mounted, so no more updating of /etc/vfstab! You can also offline/online components, take snapshots (recursive since update 3), clone filesystems, and apply properties such as quotas, NFS sharing, etc. Entire pools can be exported, then imported on another system, Intel or SPARC. There are even built-in backup and restore facilities, not to mention performance tools:- # zpool iostat -v capacity operations bandwidth pool used avail read write read write ------------ ----- ----- ----- ----- ----- ----- lake 305M 9.39G 0 0 43.7K 74.7K mirror 153M 4.69G 0 0 38.6K 37.5K c0t2d0s0 - - 0 0 39.1K 38.5K c0t2d0s1 - - 0 1 81 114K mirror 152M 4.69G 0 0 5.11K 37.5K c0t2d0s3 - - 0 0 5.13K 38.2K c0t2d0s4 - - 0 0 27 38.2K ------------ ----- ----- ----- ----- ----- ----- For more information on ZFS, why not attend our 4-day Solaris 10 Update course see: http://www.firstalt.co.uk/courses/s10up.html ZFS is also included in our standard Solaris 10 Systems Administration courses. How do I set up and configure a Zone in
Solaris 10? First Alternative course tutors can answer questions like this ... and are happy to do so. Look around our site for relevant courses in Linux -Unix - Perl - Solaris - FrameMaker |