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.
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 (Oracle 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
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 (Oracle 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
No comments:
Post a Comment