2022年12月15日 星期四

[zfs, create pool] How to create a zfs pool from file vdevs

 How to create a zfs pool from file vdevs

井民全, Jing, mqjing@gmail.com


1. Procedure

1.1. Step 1: Create 3 virtaul devices for test

Here, I use 3 files as the vdev to service the pool.


for i in {1..3}; do truncate -s 2G vdev_$i.img; done


E.g.


1.2. Step 2: Create a raid pool

Assemble to the raidz1 pool. 

sudo zpool create myzpool raidz1 /home/jing/test/tank/vdev_1.img /home/jing/test/tank/vdev_2.img /home/jing/test/tank/vdev_3.img


E.g.

1.3. Verify


zpool list


Now, we got a 5.5G zpool.


zpool status myzpool

E.g.





2. Destroy

To destroy a zpool, you can do this.

zpool destory myzpool


3. Reference

  1. https://wiki.archlinux.org/title/ZFS/Virtual_disks