Feeling left out of the ZFS excitement because you don't have a fibre channel disk array sitting at home or don't have spare disks in your box? Fear not! The ZFS team has thought of you. ZFS has the ability to use files as virtual devices! Instead of using a real disk, you can instead create files of 128MB or larger and use them just like a disk. This allows for debugging, testing, and experiementation with complex pool setups without having to require emmense resources.
Lets walk through the process:
root@chloe ~$ mkdir /vdev
root@chloe ~$ mkfile 128m /vdev/disk1
root@chloe ~$ mkfile 128m /vdev/disk2
root@chloe ~$ mkfile 128m /vdev/disk3
root@chloe ~$ mkfile 128m /vdev/disk4
root@chloe ~$ mkfile 128m /vdev/disk5
root@chloe ~$ zpool status
no pools available
root@chloe ~$ zpool create oasis raidz /vdev/disk1 /vdev/disk2 /vdev/disk3
root@chloe ~$ zpool status
pool: oasis
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
oasis ONLINE 0 0 0
raidz ONLINE 0 0 0
/vdev/disk1 ONLINE 0 0 0
/vdev/disk2 ONLINE 0 0 0
/vdev/disk3 ONLINE 0 0 0
root@chloe ~$ df -h /oasis
Filesystem size used avail capacity Mounted on
oasis 354M 16K 354M 1% /oasis
root@chloe ~$ zpool create mirrormirror mirror /vdev/disk4 /vdev/disk5
root@chloe ~$ zpool status
pool: mirrormirror
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
mirrormirror ONLINE 0 0 0
mirror ONLINE 0 0 0
/vdev/disk4 ONLINE 0 0 0
/vdev/disk5 ONLINE 0 0 0
pool: oasis
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
oasis ONLINE 0 0 0
raidz ONLINE 0 0 0
/vdev/disk1 ONLINE 0 0 0
/vdev/disk2 ONLINE 0 0 0
/vdev/disk3 ONLINE 0 0 0
Obviously this is gonna be slow. You've got ZFS on top of UFS, so, don't expect it to be speedy. But the point here isn't performance, its about being able to experiment, play, and learn with ZFS configurations that otherwise be impracticle if not impossible.
One know about importing or exporting pools: in order to import the pool you must pass a long an extra parameter to zpool import pointing to the directory in which the vdev files exist:
Note: This article was originally posted at http://www.cuddletech.com/blog/pivot/entry.php?id=446
root@chloe ~$ zpool export oasis
root@chloe ~$ zpool status oasis
cannot open 'oasis': no such pool
root@chloe ~$ zpool import -d /vdev oasis
root@chloe ~$ zpool status oasis
pool: oasis
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
oasis ONLINE 0 0 0
raidz ONLINE 0 0 0
/vdev/disk1 ONLINE 0 0 0
/vdev/disk2 ONLINE 0 0 0
/vdev/disk3 ONLINE 0 0 0