OS Hacking and more.

7.22.2008

ZFS on Disk Images: The Ultimate Simulation

It appears that ZFS can be installed on a series of disk images in a manner akin to that on other devices... and it works flawlessly! Because disk images are virtual block devices, essentially sets of blocks in a file, we would expect them to work like normal HDs with ZFS. Recalling that ZFS is pretty much hardware independent and managed by soft frameworks, there shouldn't be a need to have hard devices. They in fact do display this property, opening the door to a host of possibilities. Now, you can test ZFS raid setups and their fault tolerance virtually, without trashing any hardware. As a simulation tool this provides system administrators an environment to test and debug potential troubles in their larger scale systems, which need to remain stable at all times.

Pretty much everything worked as expected...the only changes that needed to be made were with the location of the virtual devices I specified: instead of /dev/disksomething, i just specified the Disk Image path. importing and exporting the pool was possible as long as I specified the device directory during import.

The process:
Use a disk utility to create 3 (or more) disk images:
let their location be /ZFS for the purpose of this trial


create pool and volume(s)
sudo -s or su, then


$ zpool create virtpool raidz /ZFS/zdisk1.img /ZFS/zdisk2.img /ZFS/zdisk3.img
$ zpool status
$ zfs create virtpool/zvol


do whatever you need to do in zvol
cp...touch...mkdir...whatever

now you can try a zfs test procedure
all zfs functions should work fine...note:
zpool import virtpool will be different because we don't want to search /dev


$ zpool import -d /ZFS/ virtpool



No comments: