create ZFS pools on normal files

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:


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
Note: This article was originally posted at http://www.cuddletech.com/blog/pivot/entry.php?id=446
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值