Storage: ZFS: Difference between revisions

From Proxmox VE
Jump to navigation Jump to search
No edit summary
No edit summary
 
(216 intermediate revisions by 16 users not shown)
Line 1: Line 1:
=zfs notes=
<!--PVE_IMPORT_START_MARKER-->
== How to install ZFS-fuse under Proxmox ==
<!-- Do not edit - this is autogenerated content -->
 
{{#pvedocs:pve-storage-zfspool-plain.html}}
(Tested with Kernel 2.6.32)
[[Category:Reference Documentation]]
 
<pvehide>
  apt-get install build-essential libaio-dev libattr1-dev libacl1-dev libz-dev libz-dev libfuse-dev libfuse2 scons libssl-dev
Storage pool type: zfspool
  wget -nd http://zfs-fuse.net/releases/0.6.0/zfs-fuse-0.6.0.tar.bz2
This backend allows you to access local ZFS pools (or ZFS file systems
  tar jxvf zfs-fuse-0.6.0.tar.bz2
inside such pools).
  cd zfs-fuse-0.6.0
Configuration
  cd src
The backend supports the common storage properties content, nodes,
  scons
disable, and the following ZFS specific properties:
  scond install
pool
 
Select the ZFS pool/filesystem. All allocations are done within that
Fire up ZFS-fuse daemon
pool.
  /usr/local/sbin/zfs-fuse
blocksize
 
Set ZFS blocksize parameter.
Create Zpool
sparse
  zpool create -m /var/lib/vz/images2 /dev/sdb
Use ZFS thin-provisioning. A sparse volume is a volume whose
 
reservation is not equal to the volume size.
Create ZFS
mountpoint
  zfs create images2/109
The mount point of the ZFS pool/filesystem. Changing this does not
 
affect the mountpoint property of the dataset seen by zfs.
ZFS clone a vm 109 to vm 110
Defaults to /&lt;pool&gt;.
  zfs snapshot images2/109@master
Configuration Example (/etc/pve/storage.cfg)
  zfs clone images2/109@master images2/110
zfspool: vmdata
 
        pool tank/vmdata
== Debian GNU/kFreeBSD ==
        content rootdir,images
'''As of 2012-02 this does not have NFS, so AFAIK can not be used for Proxmox storage.''' When  Debsd has nfs support then I'd use this for storage of iso's and backups to start.  In the mean time this works as a samba server..
        sparse
 
File naming conventions
zfs works much better using  Debian/GNU kFreeBSD  then fuse.
The backend uses the following naming scheme for VM images:
 
vm-&lt;VMID&gt;-&lt;NAME&gt;      // normal VM images
after installing the system to kvm or hardware:
base-&lt;VMID&gt;-&lt;NAME&gt;    // template VM image (read-only)
 
subvol-&lt;VMID&gt;-&lt;NAME&gt; // subvolumes (ZFS filesystem for containers)
*add some disks .  in KVM i was only able to get ide to work.
&lt;VMID&gt;
 
This specifies the owner VM.
*the scsi disks look like:
&lt;NAME&gt;
<pre>
This can be an arbitrary name (ascii) without white space. The
ls /dev/ad*
backend uses disk[N] as default, where [N] is replaced by an
/dev/ad10 /dev/ad10s1  /dev/ad10s2  /dev/ad11  /dev/ad12  /dev/ad13
integer to make the name unique.
</pre>
Storage Features
 
ZFS is probably the most advanced storage type regarding snapshot and
*  per http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide  - if I read it right - use entire disk not slices for zfs (I assume slices = partitions).
cloning. The backend uses ZFS datasets for both VM images (format
 
raw) and container data (format subvol). ZFS properties are
*if the disks have partition tables, then clear them. just not the operating system disk!  I used fdisk to clear the tables. This may not be necessary , if it is not then please delete this part.
inherited from the parent dataset, so you can simply set defaults
<pre>
on the parent dataset.
fdisk /dev/ad11
Table 1. Storage features for backend zfs
o
Content types
w
Image formats
</pre>
Shared
then same for ad12 and ad13
Snapshots
 
Clones
images rootdir
*install this
raw subvol
aptitude install zfsutils
no
 
yes
*make a pool
yes
zpool create -f  zfs-pool /dev/ad11 /dev/ad12  /dev/ad13
Examples
 
It is recommended to create an extra ZFS file system to store your VM images:
df | grep zfs-pool
# zfs create tank/vmdata
zfs-pool      zfs    1.4T  18K  1.4T  1% /zfs-pool
To enable compression on that newly allocated file system:
 
# zfs set compression=on tank/vmdata
===links===
You can get a list of available ZFS filesystems with:
*http://wiki.debian.org/Debian_GNU/kFreeBSD
# pvesm zfsscan
*http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide
See Also
*http://hub.opensolaris.org/bin/download/Community+Group+zfs/docs/zfslast.pdf
Storage
ZFS on Linux
</pvehide>
<!--PVE_IMPORT_END_MARKER-->

Latest revision as of 08:08, 6 December 2019

Storage pool type: zfspool

This backend allows you to access local ZFS pools (or ZFS file systems inside such pools).

Configuration

The backend supports the common storage properties content, nodes, disable, and the following ZFS specific properties:

pool

Select the ZFS pool/filesystem. All allocations are done within that pool.

blocksize

Set ZFS blocksize parameter.

sparse

Use ZFS thin-provisioning. A sparse volume is a volume whose reservation is not equal to the volume size.

mountpoint

The mount point of the ZFS pool/filesystem. Changing this does not affect the mountpoint property of the dataset seen by zfs. Defaults to /<pool>.

Configuration Example (/etc/pve/storage.cfg)
zfspool: vmdata
        pool tank/vmdata
        content rootdir,images
        sparse

File naming conventions

The backend uses the following naming scheme for VM images:

vm-<VMID>-<NAME>      // normal VM images
base-<VMID>-<NAME>    // template VM image (read-only)
subvol-<VMID>-<NAME>  // subvolumes (ZFS filesystem for containers)
<VMID>

This specifies the owner VM.

<NAME>

This can be an arbitrary name (ascii) without white space. The backend uses disk[N] as default, where [N] is replaced by an integer to make the name unique.

Storage Features

ZFS is probably the most advanced storage type regarding snapshot and cloning. The backend uses ZFS datasets for both VM images (format raw) and container data (format subvol). ZFS properties are inherited from the parent dataset, so you can simply set defaults on the parent dataset.

Table 1. Storage features for backend zfs
Content types Image formats Shared Snapshots Clones

images rootdir

raw subvol

no

yes

yes

Examples

It is recommended to create an extra ZFS file system to store your VM images:

# zfs create tank/vmdata

To enable compression on that newly allocated file system:

# zfs set compression=on tank/vmdata

You can get a list of available ZFS filesystems with:

# pvesm zfsscan