Skip to main content
Home
term:~# less tar.gz.ro
Read-only. Think freely.

Main navigation

  • Home
    • My Yard Projects
  • AIX World
    • AIX Commands
    • HACMP Commands
    • HMC Commands
    • How to assign disks to AIX partition via VIO
    • Misc stuff
    • NIM (Network Installation Management)
    • Virtual I/O (VIO)
  • Apple World
    • News
    • Tips & Tricks
    • iOS
  • CygWin World
    • CygWin Tips and Tricks
    • Cygwin: clone disk with dd
    • Cygwin: how to have multiple tabs in Cygwin's Mintty
    • Cygwin: start and enable sshd
    • config.guess: unable to guess system type
  • ESXi World
    • ESXi 7: Create VMFS Partition Via Command Line
    • ESXi : A bunch of useful commands and information
    • ESXi: How to change the hostname of an ESXi host
    • ESXi: how to change the MTU of vmkernek (vmk) interface (when UI fails)
    • ESXi: how to resize the OS partition
    • How to create a bootable USB installer of ESXi 7.0
  • Games
    • Assetto Corsa Rally vs Real Life – La Bollène-VĂ©subie → Col de Turini | Monte-Carlo Rally
    • Assetto Corsa Rally – Early Access Deep Dive
    • Diablo 3 & Reaper of Souls tips
    • EA Sports WRC Time Trial Locations and Stages
    • EA Sports WRC vs Assetto Corsa Rally | Visual Comparison (Gravel, Asphalt, Wet, Night, Snow)
    • Global Chip Shortage? Build this oddity: PC From 2009 With GeForce GTX 1050ti 4G
    • Left4Dead Lan Play
    • Live Sessions
    • Mafia II Joe's Adventures - Playboy Locations
  • HP-UX World
    • Boot into HPUX L2000
    • How to increase the size of a filesystem in LVM
    • Miscellaneous
    • Performance tools
    • Working with HP VM
  • Hardware
    • 5 Months with iPhone 15 Pro: Not PERFECT But... Must See. From Gaming to ProRes Requirements.
    • Apple Watch Series 9? Not Yet! I Still Love My "Seven of Nine" 19 months later
    • Asus ROG Sheath in 2024: a HUGE Mousepad, Bigger Than Logitech G840 XL
    • Choose Your Perfect Mic / Lavalier | AIQIU M31 vs. Boya BY-M3/BY-M2 & Puluz PU425
    • DJI Mic Mini 2 – Real-World Review and Testing
    • How I Test Mousepads: Glide, Control, and Surface Noise Explained
    • How to build a 25U 600x600 Server Rack
    • I Tested Creative Pebble V2 on My Sim Rig – Surprising Results!
    • Icy Box IB-3805-C31 speed test
    • Is the RX 9060 XT Mercury Class Worth It? Silent Power Meets Real Gameplay
    • Logitech Pro X Wired Gaming Headset (2nd gen): review + mic test with G HUB on Windows 11 and macOS
    • Logitech RS H-Shifter - Amazing Feel, But There’s a Catch (As Always)
    • Mousepad Logitech G840
    • PX8 S2 – A Journey Through Sound, Expectations and Reality
    • Play Steam Games on iPhone with Backbone One Playstation Edition gen2 USB-C / Steam Deck Alternative
    • Qnap TR-004 short review - working with linux
    • Razer Gigantus V2 XXL – 5 Months Later (Still Worth It?)
    • Samsung 870 QVO 2TB: Speed Tests and comparison with Adata SU650 and Kingston K600
    • Server-Ready MS-01 - A Small PC with Everything: SFP+, USB4, 2.5gbps LAN, Enterprise SSD, TPM 2.0
    • The TCL 34R83Q is Insane
    • The TCL 34R83Q is Insane… But There’s a Catch! Honest Review About a Real Product! Read Description.
    • The one with APC Back-UPS BE850G2-GR: Charge Whatever With It, From Phone to Computer And BEYOND :D
    • Thermaltake Pure 20 fan - HUGE and quiet!
    • Ubiquiti EdgeRouter X lift off
    • VIOFO A139 Quad HD Dash Camera - 3 Channels Camera in a 2 Channels Package. Confused?
    • Why Bluetooth Headphones Switch to MONO When Using the Microphone?
    • Why the Logitech PRO Racing Wheel Made Me a Better Driver
  • Home
  • Linux World
    • Alternative to finger command? Sure: pinky :)
    • Backup/restore/reinstall tips
    • Copy one file in linux with progress bar, using pv
    • DNSKEY: verify failed due to bad signature (keyid=19297): RRSIG has expired
    • DRBD: How to replace drbd backend devices
    • Debian 11: Unable to locate package glances
    • Debian 13: missing last command
    • Debian Bullseye (11): zpool command missing
    • Debian DRBD: How to resize drbd and OCFS2 online
    • Debian DRBD: How to resize drbd volume on top of LVM
    • Debian DRBD: Tips, Tricks and Commands
    • Debian Heartbeat: Commands, Tips and Tricks
    • Debian Heartbeat: STONITH errors when configuring CRM cluster
    • Debian Jessie: how to enable and start OpenVPN
    • Debian Tips & Tricks
    • Debian on mac mini: Core temperature above threshold, cpu clock throttled
    • Debian: Can't locate LWP/UserAgent.pm in @INC
    • Debian: HA (cluster) NFS with DRBD and Heartbeat
    • Debian: How to install, configure and manage ZFS
    • Debian: How to split rc.local in rc.local.stop and rc.local.start
    • Debian: Install and configure AFP server
    • Debian: LVM on ISCSI not activated on reboot.
    • Debian: The repository does no longer have a Release file
    • Debian: add and configure VLAN
    • Debian: how to choose default kernel in grub2
    • Debian: how to create bonding device
    • Debian: install open-vm-tools
    • Debian: pdo_mysql.so: undefined symbol: pdo_parse_params in Unknown on line 0
    • Debian: reinstall zfs when changing the linux kernel
    • Debian: ssh key no longer works after upgrading to Debian version 9
    • Docker: Pi-Hole - Failed to set capabilities on file `/usr/bin/pihole-FTL' (Operation not supported)
    • Gnome: Clear "Open With" list
    • How to add a swap file in linux
    • How to add an ISCSI disk from linux server
    • How to add exfat support on RHEL 6
    • How to be sure network interfaces have always the same names
    • How to check which local device is assigned to which iscsi disk
    • How to configure GlusterFS with a volume replicated over 2 nodes
    • How to create an encrypted image
    • How to create bond device under linux
    • How to create/modify a file's timestamp
    • How to give more memory to Lotus Notes in Linux
    • How to install bind (name server) in chroot environment
    • How to install mplayer on RHEL 6
    • How to install openoffice 4.0.1 on Fedora 20/19/18, CentOS/Red Hat (RHEL) 6.5
    • How to install python 2.7 on Red Hat Enterprise Linux Workstation release 6.5 (Santiago)
    • How to modify the hostname on Linux
    • How to mount a HFS partition in linux as Read/Write?
    • How to properly configure oidentd for IRC connections
    • How to read MBR
    • How to remove LVM snapshots if you get message "Can't remove open logical volume"
    • How to setup OpenVPN server for iPhone
    • How to show UUID of a block device, including other attributes too
    • How to speed up things by using tmpfs (your memory)
    • How to switch from pc to efi and recreate boot partition
    • How to test ethernet speed with iperf
    • How to write CD or DVD under linux's console
    • ISCIS: remove disk from linux client
    • LVM
    • Linux Network Tips and Tricks
    • Linux: CPU utilization vs. load average
    • Linux: How to clear (delete) a GUID partition table (GPT)
    • Linux: TCP keepalive or not
    • Linux: Tuning network cards on Linux
    • Linux: how to check if the disk is SSD or not
    • Network Manager - get_secrets_cb(): Couldn't get connection secrets
    • RHEL6: yum update - package is a duplicate with package
    • RPM Tips and Tricks
    • ReiserFS: how to recover deleted files
    • ShellShock - Fix Bash on Debian Lenny
    • ShellShock - Fix Bash on Debian Squeeze
    • Spamassassin: eval/lookup failed: available_nameservers: No DNS servers available!
    • Start restricted graphical apps
    • Systemd startup order
    • The Nano Incident: How a Text Editor Almost Took Down My Database
    • Ubuntu: Fast Install With VMware Fusion
    • User Management
    • Using Mdadm
    • Wi-FI KO after upgrade to RHEL 6.5
    • ZFS: Convert a One Disk Pool in Two Disks Mirror
    • ZFS: cannot import 'whatever': no such pool available
    • how to resize iscsi volume in Linux
    • rc.openvpn for slackware
  • Proxmox
    • Proxmox LXC Recovery: What Happens When Your LVM-Thin Pool Runs Out of Space
  • Solaris World
    • Tips & Tricks
  • Windows World
    • Active Directory Command Line (CMD) Tips & Tricks
    • Excel: extract text between two different characters
    • Excel: seconds in hours:minutes:seconds
    • PowerShell tips and tricks
    • Windows 7: How to repair boot partition
    • Windows 7: Steam not starting
    • Windows 7: how to disable/enable hibernation
    • Windows CMD commands
  • Tips & Tricks
    • Apache Tips & Tricks
    • Audio / Video *nix Command Line Tricks
    • Bombardier: How to use it to Download Boot Camp Drivers
    • Brigadier: How to use to Download Boot Camp Drivers
    • Citrix XEN: Install VM OS via CLI
    • Citrix Xen CLI Tips & Tricks
    • Citrix Xen: Connect to VM's VNC console
    • Citrix Xen: How to "migrate" VHD lv from one XEN to another with dd
    • Citrix Xen: How to attach an existing vdi to any virtual machine
    • Citrix Xen: How to rename a vm via command line
    • Citrix Xen: How to show vm information via command line
    • Citrix Xen: Modify VM memory value via CLI
    • Docker Tips and Tricks
    • Docker: Create a Custom Image
    • Docker: How to Check Which Docker Container is Using the Space in Linux
    • Docker: How to Run Your Own Docker Registry (e.g. Images Repository)
    • Docker: Install on Debian
    • Docker: Playing with consul
    • Docker: UNIX socket and TCP port
    • Docker: how to enable swap limit capabilities
    • Docker: how to increase php memory "the docker way"
    • Docker: syslog-ng setup
    • Drupal 7 to Drupal 10 Migration and Configuration Notes
    • Executing commands remotely on multiple systems via SSH
    • FIO Perf Tool Nutshell
    • Flushing the ARP cache
    • FreeNAS console tricks
    • Gallery2 - Gd - How to create thumbnails with fixed width while keeping the aspect ratio (variable height)
    • Gallery2 - Imagemagick - How to create thumbnails with fixed width while keeping the aspect ratio (variable height)
    • Gallery2 - Netpbm - How to create thumbnails with fixed width while keeping the aspect ratio (variable height)
    • How to change the hostid of a Linux operating system
    • How to create a hash password from text
    • How to delete files or directories that contains special characters
    • How to display the output of a file without the blank lines
    • How to enable rstatd
    • How to encrypt a file in linux (or cygwin)
    • How to find out which process is using some port
    • How to login to youtube account via Apple TV if you have Google Authenticator enabled
    • How to resume failed scp transfer
    • How to rotate pdf files with pdftk tool
    • How to send a json from command line
    • How to use an LVM partition as VirtualBox disk
    • IBM DS System Storage common commands examples
    • ImageMagick Tricks
    • Logging ssh sessions
    • Merge mp3 files
    • Miscellaneous
    • MySQL Commands, Tips and Tricks
    • Nagios Stuff
    • Nagios: UNKNOWN: Drive S/N : No health status line found,
    • Networking - questions and answers
    • Oracle: How to connect to the listener and display a parameter's value
    • Oracle: How to list DBA users for a database
    • Oracle: dbfsize Header block magic number is bad
    • Oracle: display tablespace information with sizes
    • PHP: How to display in a table, information from a text file
    • Python: fake smtp server
    • Render Blocking JavaScript and CSS
    • Runlevels
    • SAP useful commands for UNIX administrator
    • SMF Tips and Tricks
    • Script to get memory usage of desired processes
    • Strings or File Manipulation
    • The Hard Link
    • Using Find Command
    • Using VI Editor
    • VirtualBox Tips&Tricks
    • VirtualBox: How to Add Serial Port for Linux Cluster Heartbeat Monitoring
    • VirtualBox: How to work with ISCSI disks
    • dsmc commands
    • iMessage “Waiting for Activation” Error on iPhone
  • Exclamation!
    • Bash CVE-2014-6278 CVE-2014-6277
    • Heartbleed Bug
    • PHP2Shell: Critical PHP Remote Code Execution Vulnerabilities
    • Ransomware KeRanger attached to Transmission app
    • Shellshock (CVE-2014-6271)
  • About This
    • Cookies, Cookies, Cookies!
  • Donate
User account menu
  • Log in
Popular content

Today's:

  • PHP2Shell: Critical PHP Remote Code Execution Vulnerabilities and Website’s Impact
  • €6,000 MacBook Pro: Should I Throw It Away After 6 Years?
  • Drupal 7 to Drupal 10 Migration and Configuration Notes
  • The Nano Incident: How a Text Editor Almost Took Down My Database
  • Proxmox LXC Recovery: What Happens When Your LVM-Thin Pool Runs Out of Space
  • Assetto Corsa Rally vs Real Life – La Bollène-VĂ©subie → Col de Turini | Monte-Carlo Rally
  • Linux Networking: How to disable/enable offload features, RX/TX checksum, scatter, gather and beyond
  • How I Test Mousepads: Glide, Control, and Surface Noise Explained
  • Windows World
  • Hardware

All time:

  • Linux Networking: How to disable/enable offload features, RX/TX checksum, scatter, gather and beyond
  • Tivoli Storage Manager Client Commands (dsmc commands)
  • Centrify Useful Commands and Information
  • Run ZIM on OS X and create Zim.app
  • How to be sure network interfaces have always the same names
  • Linux backup/restore/reinstall
  • How to add exfat support on RHEL 6
  • Mafia II Joe's Adventures - Playboy Locations
  • HMC commands
  • Command Line Software Update in MacOS

Last viewed:

  • PHP2Shell: Critical PHP Remote Code Execution Vulnerabilities and Website’s Impact
  • Macports: Current platform "darwin 17" does not match expected platform "darwin 16"
  • AIX System Dump Commands
  • Drupal 7 to Drupal 10 Migration and Configuration Notes
  • VIOFO A139 Quad HD Dash Camera - 3 Channels Camera in a 2 Channels Package. Confused?
  • The Nano Incident: How a Text Editor Almost Took Down My Database
  • Proxmox LXC Recovery: What Happens When Your LVM-Thin Pool Runs Out of Space
  • Macports: Current platform "darwin 14" does not match expected platform "darwin 13"
  • How to speed up things by using tmpfs
  • Errpt - Logopen: open: No such file or directory

Breadcrumb

  1. Home

Debian: How to install, configure and manage ZFS

Profile picture for user root
By root, 8 December, 2014

Before starting, I have to mention this tutorial is not about ZFS Fuse which comes by default with Debian. This is the real deal, the native ZFS for Linux, without fuse support. In theory should be faster and more reliable and according to my tests so far, it is amazing!

First of all, install ZFS:

UPDATE: ZFS packages are included in debian repository. So all you have to do now is:

apt update
apt install dpkg-dev linux-headers-$(uname -r) linux-image-amd64
apt install zfs-dkms zfsutils-linux

Details here: https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/index.h…
Moved the wheezy installation instructions at the end of this document.

PS: For Ubuntu, you have to do this:
# apt-add-repository --yes ppa:zfs-native/stable
# aptitude install debootstrap spl-dkms zfs-dkms ubuntu-zfs

Example:

root@ibm:~# apt-add-repository --yes ppa:zfs-native/stable
gpg: keyring `/tmp/tmp74YZpk/secring.gpg' created
gpg: keyring `/tmp/tmp74YZpk/pubring.gpg' created
gpg: requesting key F6B0FC61 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp74YZpk/trustdb.gpg: trustdb created
gpg: key F6B0FC61: public key "Launchpad PPA for Native ZFS for Linux" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
root@ibm:~# aptitude update
[...useless output removed...]
root@ibm:~# aptitude install debootstrap spl-dkms zfs-dkms ubuntu-zfs
The following NEW packages will be installed:
  debootstrap libnvpair1{a} libuutil1{a} libzfs2{a} libzpool2{a} spl{a} spl-dkms ubuntu-zfs zfs-dkms 
  zfsutils 
The following packages will be upgraded:
  mountall 
1 packages upgraded, 10 newly installed, 0 to remove and 592 not upgraded.
Need to get 4,134 kB of archives. After unpacking 17.6 MB will be used.
Do you want to continue? [Y/n/?] 
[....the output is similar with debian...]

Now you can play with it if you have spare disks:

Create a simple pool (no mirror or raid) and list it afterwards:

zpool create zfs /dev/datavg/zfslv
zpool list
Example:
root@eave:~# zpool create zfs /dev/datavg/zfslv
root@eave:~# zpool list
NAME   SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
zfs   4.97G    90K  4.97G     0%  1.00x  ONLINE  -
root@eave:~# zpool status
  pool: zfs
 state: ONLINE
  scan: none requested
config:

	NAME        STATE     READ WRITE CKSUM
	zfs         ONLINE       0     0     0
	  zfslv     ONLINE       0     0     0

The moment you create a pool, an zfs filesystem will be created also so you can list it also like this (the mount point will be the name of the pool):

root@eave:~# zfs list
NAME   USED  AVAIL  REFER  MOUNTPOINT
zfs    106K  4.89G    29K  /zfs

If you want to delete the zfs pool, you can do it with the following command:

root@eave:~# zpool destroy zfs
root@eave:~# zpool list
no pools available

To enable compression to your zfs pool and list it, do the following:

root@eave:~# zfs set compression=lz4 zfs
root@eave:~# zfs get compressratio zfs
NAME  PROPERTY       VALUE  SOURCE
zfs   compressratio  1.00x  -
Compression test:
root@eave:/zfs# tar -cf test.tar /var/log/
tar: Removing leading `/' from member names
root@eave:/zfs# ls -la
total 10116
drwxr-xr-x  2 root root        3 Dec  1 23:11 .
drwxr-xr-x 26 root root      664 Dec  1 23:06 ..
-rw-r--r--  1 root root 31672320 Dec  1 23:11 test.tar
root@eave:/zfs# zfs get compressratio zfs
NAME  PROPERTY       VALUE  SOURCE
zfs   compressratio  3.05x  -

root@eave:/zfs# cp test.tar /tmp
root@eave:/zfs# du -sh test.tar 
9.9M	test.tar
root@eave:/zfs# du -sh /tmp/test.tar 
31M	/tmp/test.tar

How to create a mirror zfs pool:

 zpool create backups mirror oglebkp-part1 sunbkp-part1
Example:
root@pluto:~# zpool create backups mirror oglebkp-part1 sunbkp-part1
root@pluto:~# zpool list
NAME      SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
backups  99.5G  92.5K  99.5G     0%  1.00x  ONLINE  -

root@pluto:~# df -h /backups
Filesystem      Size  Used Avail Use% Mounted on
backups          98G     0   98G   0% /backups

If one of your disk was gone form the pool and is back now, you can do the following:

zpool clear backups
Example:
root@pluto:~# zpool status backups
  pool: backups
 state: DEGRADED
status: One or more devices are faulted in response to persistent errors.
	Sufficient replicas exist for the pool to continue functioning in a
	degraded state.
action: Replace the faulted device, or use 'zpool clear' to mark the device
	repaired.
  scan: none requested
config:

	NAME               STATE     READ WRITE CKSUM
	backups            DEGRADED     0     0     0
	  mirror-0         DEGRADED     0     0     0
	    oglebkp-part1  FAULTED      0     0     0  too many errors
	    sunbkp-part1   ONLINE       0     0     0

errors: No known data errors
root@pluto:~# zpool clear backups
root@pluto:~# zpool status backups
  pool: backups
 state: ONLINE
  scan: none requested
config:

	NAME               STATE     READ WRITE CKSUM
	backups            ONLINE       0     0     0
	  mirror-0         ONLINE       0     0     0
	    oglebkp-part1  ONLINE       0     0     0
	    sunbkp-part1   ONLINE       0     0     0

errors: No known data errors

How to replace a disk in a zfs pool:

zpool replace rex sdb sdx

How to check the history of events in a zfs pool:

root@pluto:~# zpool history backups
History for 'backups':
2014-12-07.22:03:38 zpool create backups mirror oglebkp-part1 sunbkp-part1
2014-12-07.22:06:33 zfs set compression=lz4 backups
2014-12-07.22:58:20 zpool clear backups
2014-12-08.09:09:13 zpool scrub backups

How to scrub a zfs pool:

The simplest way to check your data integrity is to initiate an explicit scrubbing of all data within the pool. This operation traverses all the data in the pool once and verifies that all blocks can be read. Scrubbing proceeds as fast as the devices allow, though the priority of any I/O remains below that of normal operations. This operation might negatively impact performance, though the file system should remain usable and nearly as responsive while the scrubbing occurs.
root@pluto:~# zpool scrub backups
root@pluto:~# zpool status backups
  pool: backups
 state: ONLINE
  scan: scrub in progress since Mon Dec  8 09:09:04 2014
    5.26G scanned out of 23.2G at 20.2M/s, 0h15m to go
    0 repaired, 22.63% done
config:

	NAME               STATE     READ WRITE CKSUM
	backups            ONLINE       0     0     0
	  mirror-0         ONLINE       0     0     0
	    oglebkp-part1  ONLINE       0     0     0
	    sunbkp-part1   ONLINE       0     0     0

errors: No known data errors

How to put offline/online a disk in zfs pool:

root@pluto:~# zpool offline backups sdx
root@pluto:~# zpool online backups sdx

How to enable ZFS deduplication and see it's magic:

The basic concept is that when data is written to a ZFS filesystem with dedup turned on, ZFS only stored blocks that are unique within the ZFS pool, rather than storing redundant copies of identical data. See Jeff Bonwick's blog for more information on concepts and implementation.
root@pluto:~# zpool list
NAME      SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
backups  99.5G  26.1G  73.4G    26%  1.00x  DEGRADED  -
root@pluto:~# zpool get dedup backups
NAME     PROPERTY    VALUE  SOURCE
backups  dedupratio  1.00x  -

root@pluto:~# zfs get dedup backups
NAME     PROPERTY  VALUE          SOURCE
backups  dedup     off            default
root@pluto:~# zfs set dedup=on backups
root@pluto:~# zfs get dedup backups
NAME     PROPERTY  VALUE          SOURCE
backups  dedup     on             local


root@pluto:/backups/test/v1# ls -la
total 21289
drwxr-xr-x 2 root root        3 Dec  8 23:16 .
drwxr-xr-x 6 root root        6 Dec  8 23:10 ..
-rw-r--r-- 1 root root 22341640 Dec  8 23:16 etc.zip


root@pluto:/backups/test/v1# cp etc.zip ../v2
root@pluto:/backups/test/v1# cp etc.zip ../v3
root@pluto:/backups/test/v1# cp etc.zip ../v4

root@pluto:/backups/test# ls -la */*.zip
-rw-r--r-- 1 root root 22341640 Dec  8 23:16 v1/etc.zip
-rw-r--r-- 1 root root 22341640 Dec  8 23:16 v2/etc.zip
-rw-r--r-- 1 root root 22341640 Dec  8 23:17 v3/etc.zip
-rw-r--r-- 1 root root 22341640 Dec  8 23:20 v4/etc.zip
root@pluto:/backups/test# zpool list
NAME      SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
backups  99.5G  26.2G  73.3G    26%  4.00x  DEGRADED  -
You will have to verify if dedup is needed for you because it consumes a lot of memory and sometimes it is not necessary. For example, after you have all your files in place, you can do the following command and see. If the deduplication ratio is less than 2, enabling dedup is not recommended.
In my example below, it is not recommended:
root@pluto:/backups/test# zdb -S backups
Simulated DDT histogram:

bucket              allocated                       referenced          
______   ______________________________   ______________________________
refcnt   blocks   LSIZE   PSIZE   DSIZE   blocks   LSIZE   PSIZE   DSIZE
------   ------   -----   -----   -----   ------   -----   -----   -----
     1     499K   23.5G   14.1G   14.1G     499K   23.5G   14.1G   14.1G
     2    83.9K   4.39G   3.08G   3.08G     188K   9.71G   6.62G   6.62G
     4    55.2K   1.62G    874M    874M     256K   7.06G   3.70G   3.70G
     8    14.6K    172M   91.6M   91.6M     141K   1.51G    841M    841M
    16    1.67K   11.9M   6.89M   6.89M    31.8K    230M    133M    133M
    32      140    298K    236K    236K    5.45K   11.4M   9.00M   9.00M
    64       32   1.03M    743K    743K    2.89K    110M   77.2M   77.2M
   128        6      3K      3K      3K    1.09K    556K    556K    556K
   256       11   1.13M    802K    802K    4.36K    482M    335M    335M
   512        1     512     512     512      942    471K    471K    471K
    1K        1     512     512     512    1.76K    901K    901K    901K
    2K        1     512     512     512    2.11K   1.05M   1.05M   1.05M
 Total     655K   29.7G   18.1G   18.1G    1.11M   42.6G   25.8G   25.8G

dedup = 1.42, compress = 1.66, copies = 1.00, dedup * compress / copies = 2.35

How to create swap device in ZFS with ZVOL:

root@pluto:/backups# [color=green]zfs create -V 1G backups/swap[/color]
root@pluto:/backups# zfs list
NAME           USED  AVAIL  REFER  MOUNTPOINT
backups       70.1G   126G  69.1G  /backups
[color=green]backups/swap  1.03G   127G  16.5K  -[/color]
root@pluto:/backups# [color=green]mkswap /dev/zvol/backups/swap[/color]
mkswap: /dev/zvol/backups/swap: warning: don't erase bootbits sectors
        on whole disk. Use -f to force.
Setting up swapspace version 1, size = 1048572 KiB
no label, UUID=2b7167ab-0c05-401a-90f3-5bcecb36663d
root@pluto:/backups# [color=green]swapon -p 16500 /dev/zvol/backups/swap[/color]
root@pluto:/backups# swapon -s
Filename				Type		Size	Used	Priority
/dev/mapper/rootvg-swap                 partition	1048572	13888	-1
/dev/zd0                                partition	1048572	0	16500

How to resize (set quota) a zfs filesystem:

root@uranus:/var/cache# zfs list
NAME           USED  AVAIL  REFER  MOUNTPOINT
data           150K  49.0G    31K  /data
data/fscache    30K  49.0G    30K  /data/fscache
root@uranus:/var/cache# [color=green]zfs set quota=20G data/fscache[/color]
root@uranus:/var/cache# zfs list
NAME           USED  AVAIL  REFER  MOUNTPOINT
data           150K  49.0G    31K  /data
data/fscache    30K  20.0G    30K  /data/fscache

How to speedup zfs on linux:

ZFS on Linux stores xattrs in a hidden folder, as regular files! This is very slow, requiring multiple seeks per xattr, and it doesn't appear to cache very well either.
The fix is to store the data in the inodes, which will boost up the speed too:

# zfs set xattr=sa (pool)

How to create zfs volume with different mount point:

# zfs create -o atime=off -o mountpoint=/var/spool/squid3 cache/squid

How to modify zfs mount point or remove the mount point of a zfs:

You have to modfy the mountpoint value to the desired mount point or to none to remove it.

# zfs set mountpoint=none zfs_device

Example:

root@ibm:~# df -h | grep ibm
ibm                      196G     0  196G   0% /ibm
root@ibm:~# zfs get mountpoint ibm
NAME  PROPERTY    VALUE       SOURCE
ibm   mountpoint  /ibm        default
root@ibm:~# [color=green]zfs set mountpoint=none ibm[/color]
root@ibm:~# zfs get mountpoint ibm
NAME  PROPERTY    VALUE       SOURCE
ibm   mountpoint  none        local
root@ibm:~# zfs list
NAME   USED  AVAIL  REFER  MOUNTPOINT
ibm    120K   196G    30K  none
root@ibm:~# df -h | grep ibm
root@ibm:~# 
root@ibm:~# [color=green]zfs set mountpoint=/bah ibm[/color]
root@ibm:~# zfs list
NAME   USED  AVAIL  REFER  MOUNTPOINT
ibm    120K   196G    30K  /bah
root@ibm:~# df -h | grep bah
ibm                      196G     0  196G   0% /bah

ZFS install on wheezy - follow only if you have to.

wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_6_all.deb
dpkg -i zfsonlinux_6_all.deb
aptitude update
aptitude install debian-zfs
Example (the example below is from previously wheezy installation but the main package has been replaced to zfsonlinux_6_all.deb above):
root@eave:~# wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_3~wheezy_all.deb
--2014-12-01 22:35:38--  http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_3~wheezy_all.deb
Resolving archive.zfsonlinux.org (archive.zfsonlinux.org)... 54.231.33.81
Connecting to archive.zfsonlinux.org (archive.zfsonlinux.org)|54.231.33.81|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2038712 (1.9M) [application/x-debian-package]
Saving to: `zfsonlinux_3~wheezy_all.deb'

100%[=========================================================>] 2,038,712   1012K/s   in 2.0s    

2014-12-01 22:35:41 (1012 KB/s) - `zfsonlinux_3~wheezy_all.deb' saved [2038712/2038712]

root@eave:~# dpkg -i zfsonlinux_3~wheezy_all.deb 
Selecting previously unselected package zfsonlinux.
(Reading database ... 41395 files and directories currently installed.)
Unpacking zfsonlinux (from zfsonlinux_3~wheezy_all.deb) ...
Setting up zfsonlinux (3~wheezy) ...

root@eave:~# aptitude update
Get: 1 http://security.debian.org wheezy/updates Release.gpg [836 B]
Get: 2 http://security.debian.org wheezy/updates Release [102 kB]                
Get: 3 http://archive.zfsonlinux.org wheezy Release.gpg [836 B]               
Hit http://ftp.us.debian.org wheezy Release.gpg                                          
Get: 4 http://security.debian.org wheezy/updates/main Sources [141 kB]
Get: 5 http://archive.zfsonlinux.org wheezy Release [3,598 B]                
Get: 6 http://ftp.us.debian.org wheezy-updates Release.gpg [836 B]                       
Get: 7 http://security.debian.org wheezy/updates/contrib Sources [14 B]
Get: 8 http://security.debian.org wheezy/updates/non-free Sources [14 B]                   
Get: 9 http://security.debian.org wheezy/updates/main amd64 Packages [224 kB]              
Get: 10 http://security.debian.org wheezy/updates/contrib amd64 Packages [14 B]             
Hit http://ftp.us.debian.org wheezy Release                                                     
Get: 11 http://security.debian.org wheezy/updates/non-free amd64 Packages [14 B]
Get: 12 http://security.debian.org wheezy/updates/contrib Translation-en [14 B]
Get: 13 http://security.debian.org wheezy/updates/main Translation-en [127 kB]                                              
Get: 14 http://archive.zfsonlinux.org wheezy/main amd64 Packages [10.5 kB]                                                     
Get: 15 http://security.debian.org wheezy/updates/non-free Translation-en [14 B]                                          
Get: 16 http://ftp.us.debian.org wheezy-updates Release [124 kB]                              
Hit http://ftp.us.debian.org wheezy/main Sources                           
Hit http://ftp.us.debian.org wheezy/non-free Sources
Hit http://ftp.us.debian.org wheezy/contrib Sources               
Hit http://ftp.us.debian.org wheezy/main amd64 Packages           
Hit http://ftp.us.debian.org wheezy/non-free amd64 Packages
Ign http://archive.zfsonlinux.org wheezy/main Translation-en_US
Hit http://ftp.us.debian.org wheezy/contrib amd64 Packages
Ign http://archive.zfsonlinux.org wheezy/main Translation-en      
Hit http://ftp.us.debian.org wheezy/contrib Translation-en
Hit http://ftp.us.debian.org wheezy/main Translation-en
Hit http://ftp.us.debian.org wheezy/non-free Translation-en
Get: 17 http://ftp.us.debian.org wheezy-updates/main Sources [1,215 B]
Get: 18 http://ftp.us.debian.org wheezy-updates/contrib Sources [14 B]
Get: 19 http://ftp.us.debian.org wheezy-updates/non-free Sources [14 B]
Get: 20 http://ftp.us.debian.org wheezy-updates/main amd64 Packages/DiffIndex [1,747 B]
Get: 21 http://ftp.us.debian.org wheezy-updates/contrib amd64 Packages [14 B]
Get: 22 http://ftp.us.debian.org wheezy-updates/non-free amd64 Packages [14 B]
Get: 23 http://ftp.us.debian.org wheezy-updates/contrib Translation-en [14 B]
Get: 24 http://ftp.us.debian.org wheezy-updates/main Translation-en/DiffIndex [1,195 B]
Get: 25 http://ftp.us.debian.org wheezy-updates/non-free Translation-en [14 B]
Get: 26 http://ftp.us.debian.org wheezy-updates/main amd64 Packages [2,738 B]
Get: 27 http://ftp.us.debian.org wheezy-updates/main Translation-en [1,940 B]
Fetched 743 kB in 6s (122 kB/s)                                                                                                              
                            
Current status: 6 updates [+6], 32 new [+26].


root@eave:~# aptitude install debian-zfs
The following NEW packages will be installed:
  build-essential debian-zfs dpkg-dev{a} g++{a} g++-4.7{a} libalgorithm-diff-perl{a} libalgorithm-diff-xs-perl{a} 
  libalgorithm-merge-perl{a} libdpkg-perl{a} libfile-fcntllock-perl{a} libnvpair1{a} libstdc++6-4.7-dev{a} libuutil1{a} libzfs2{a} 
  libzpool2{a} spl spl-dkms{a} zfs-dkms zfsutils{a} 
0 packages upgraded, 19 newly installed, 0 to remove and 6 not upgraded.
Need to get 15.3 MB of archives. After unpacking 44.9 MB will be used.
Do you want to continue? [Y/n/?] 
Get: 1 http://ftp.us.debian.org/debian/ wheezy/main libstdc++6-4.7-dev amd64 4.7.2-5 [1,726 kB]
Get: 2 http://archive.zfsonlinux.org/debian/ wheezy/main spl-dkms all 0.6.3-7~wheezy [554 kB]
Get: 3 http://archive.zfsonlinux.org/debian/ wheezy/main zfs-dkms all 0.6.3-1~wheezy [1,475 kB]
Get: 4 http://ftp.us.debian.org/debian/ wheezy/main g++-4.7 amd64 4.7.2-5 [8,011 kB]
Get: 5 http://archive.zfsonlinux.org/debian/ wheezy/main spl amd64 0.6.3-7~wheezy [15.8 kB]
Get: 6 http://archive.zfsonlinux.org/debian/ wheezy/main libuutil1 amd64 0.6.3-1~wheezy [53.4 kB]
Get: 7 http://archive.zfsonlinux.org/debian/ wheezy/main libnvpair1 amd64 0.6.3-1~wheezy [50.8 kB]
Get: 8 http://archive.zfsonlinux.org/debian/ wheezy/main libzpool2 amd64 0.6.3-1~wheezy [465 kB]
Get: 9 http://archive.zfsonlinux.org/debian/ wheezy/main libzfs2 amd64 0.6.3-1~wheezy [144 kB]
Get: 10 http://ftp.us.debian.org/debian/ wheezy/main g++ amd64 4:4.7.2-1 [1,374 B]
Get: 11 http://archive.zfsonlinux.org/debian/ wheezy/main zfsutils amd64 0.6.3-1~wheezy [401 kB]
Get: 12 http://ftp.us.debian.org/debian/ wheezy/main libdpkg-perl all 1.16.15 [958 kB]
Get: 13 http://archive.zfsonlinux.org/debian/ wheezy/main debian-zfs amd64 7~wheezy [7,052 B]
Get: 14 http://ftp.us.debian.org/debian/ wheezy/main dpkg-dev all 1.16.15 [1,356 kB]
Get: 15 http://ftp.us.debian.org/debian/ wheezy/main build-essential amd64 11.5 [7,178 B]
Get: 16 http://ftp.us.debian.org/debian/ wheezy/main libalgorithm-diff-perl all 1.19.02-2 [51.5 kB]
Get: 17 http://ftp.us.debian.org/debian/ wheezy/main libalgorithm-diff-xs-perl amd64 0.04-2+b1 [12.9 kB]
Get: 18 http://ftp.us.debian.org/debian/ wheezy/main libalgorithm-merge-perl all 0.08-2 [13.5 kB]
Get: 19 http://ftp.us.debian.org/debian/ wheezy/main libfile-fcntllock-perl amd64 0.14-2 [17.2 kB]
Fetched 15.3 MB in 5s (2,603 kB/s)                   
Preconfiguring packages ...
Selecting previously unselected package spl-dkms.
(Reading database ... 41401 files and directories currently installed.)
Unpacking spl-dkms (from .../spl-dkms_0.6.3-7~wheezy_all.deb) ...
Setting up spl-dkms (0.6.3-7~wheezy) ...
Loading new spl-0.6.3 DKMS files...
First Installation: checking all kernels...
Building only for 3.2.0-4-amd64
Building initial module for 3.2.0-4-amd64
Done.

spl:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.2.0-4-amd64/updates/dkms/

splat.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.2.0-4-amd64/updates/dkms/

Running the post_install script:

depmod..............

DKMS: install completed.
Selecting previously unselected package zfs-dkms.
(Reading database ... 41649 files and directories currently installed.)
Unpacking zfs-dkms (from .../zfs-dkms_0.6.3-1~wheezy_all.deb) ...
Selecting previously unselected package libstdc++6-4.7-dev.
Unpacking libstdc++6-4.7-dev (from .../libstdc++6-4.7-dev_4.7.2-5_amd64.deb) ...
Selecting previously unselected package g++-4.7.
Unpacking g++-4.7 (from .../g++-4.7_4.7.2-5_amd64.deb) ...
Selecting previously unselected package g++.
Unpacking g++ (from .../g++_4%3a4.7.2-1_amd64.deb) ...
Selecting previously unselected package libdpkg-perl.
Unpacking libdpkg-perl (from .../libdpkg-perl_1.16.15_all.deb) ...
Selecting previously unselected package dpkg-dev.
Unpacking dpkg-dev (from .../dpkg-dev_1.16.15_all.deb) ...
Selecting previously unselected package build-essential.
Unpacking build-essential (from .../build-essential_11.5_amd64.deb) ...
Selecting previously unselected package spl.
Unpacking spl (from .../spl_0.6.3-7~wheezy_amd64.deb) ...
Selecting previously unselected package libuutil1.
Unpacking libuutil1 (from .../libuutil1_0.6.3-1~wheezy_amd64.deb) ...
Selecting previously unselected package libnvpair1.
Unpacking libnvpair1 (from .../libnvpair1_0.6.3-1~wheezy_amd64.deb) ...
Selecting previously unselected package libzpool2.
Unpacking libzpool2 (from .../libzpool2_0.6.3-1~wheezy_amd64.deb) ...
Selecting previously unselected package libzfs2.
Unpacking libzfs2 (from .../libzfs2_0.6.3-1~wheezy_amd64.deb) ...
Selecting previously unselected package zfsutils.
Unpacking zfsutils (from .../zfsutils_0.6.3-1~wheezy_amd64.deb) ...
Selecting previously unselected package debian-zfs.
Unpacking debian-zfs (from .../debian-zfs_7~wheezy_amd64.deb) ...
Selecting previously unselected package libalgorithm-diff-perl.
Unpacking libalgorithm-diff-perl (from .../libalgorithm-diff-perl_1.19.02-2_all.deb) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
Unpacking libalgorithm-diff-xs-perl (from .../libalgorithm-diff-xs-perl_0.04-2+b1_amd64.deb) ...
Selecting previously unselected package libalgorithm-merge-perl.
Unpacking libalgorithm-merge-perl (from .../libalgorithm-merge-perl_0.08-2_all.deb) ...
Selecting previously unselected package libfile-fcntllock-perl.
Unpacking libfile-fcntllock-perl (from .../libfile-fcntllock-perl_0.14-2_amd64.deb) ...
Processing triggers for man-db ...
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.2.0-4-amd64
Setting up zfs-dkms (0.6.3-1~wheezy) ...
Loading new zfs-0.6.3 DKMS files...
First Installation: checking all kernels...
Building only for 3.2.0-4-amd64
Building initial module for 3.2.0-4-amd64
Done.

zavl:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.2.0-4-amd64/updates/dkms/

zcommon.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.2.0-4-amd64/updates/dkms/

znvpair.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.2.0-4-amd64/updates/dkms/

zpios.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.2.0-4-amd64/updates/dkms/

zunicode.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.2.0-4-amd64/updates/dkms/

zfs.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/3.2.0-4-amd64/updates/dkms/

depmod.............

DKMS: install completed.
Setting up libdpkg-perl (1.16.15) ...
Setting up dpkg-dev (1.16.15) ...
Setting up spl (0.6.3-7~wheezy) ...
Setting up libuutil1 (0.6.3-1~wheezy) ...
Setting up libnvpair1 (0.6.3-1~wheezy) ...
Setting up libzpool2 (0.6.3-1~wheezy) ...
Setting up libzfs2 (0.6.3-1~wheezy) ...
Setting up zfsutils (0.6.3-1~wheezy) ...
Setting up libalgorithm-diff-perl (1.19.02-2) ...
Setting up libalgorithm-diff-xs-perl (0.04-2+b1) ...
Setting up libalgorithm-merge-perl (0.08-2) ...
Setting up libfile-fcntllock-perl (0.14-2) ...
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.2.0-4-amd64
Setting up debian-zfs (7~wheezy) ...
Setting up g++-4.7 (4.7.2-5) ...
Setting up g++ (4:4.7.2-1) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up build-essential (11.5) ...
Setting up libstdc++6-4.7-dev (4.7.2-5) ...

Inspiration:
https://pthree.org/2012/04/17/install-zfs-on-debian-gnulinux/
http://docs.oracle.com/cd/E19082-01/817-2271/gavwg/index.html
https://blogs.oracle.com/jsavit/entry/deduplication_now_in_zfs
http://www.oracle.com/technetwork/articles/servers-storage-dev/o11-113-…

  • Log in to post comments
  • 24347 views

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself!
Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Popular content

Today's:

  • PHP2Shell: Critical PHP Remote Code Execution Vulnerabilities and Website’s Impact
  • €6,000 MacBook Pro: Should I Throw It Away After 6 Years?
  • Drupal 7 to Drupal 10 Migration and Configuration Notes
  • The Nano Incident: How a Text Editor Almost Took Down My Database
  • Proxmox LXC Recovery: What Happens When Your LVM-Thin Pool Runs Out of Space
  • Assetto Corsa Rally vs Real Life – La Bollène-VĂ©subie → Col de Turini | Monte-Carlo Rally
  • Linux Networking: How to disable/enable offload features, RX/TX checksum, scatter, gather and beyond
  • How I Test Mousepads: Glide, Control, and Surface Noise Explained
  • Windows World
  • Hardware

All time:

  • Linux Networking: How to disable/enable offload features, RX/TX checksum, scatter, gather and beyond
  • Tivoli Storage Manager Client Commands (dsmc commands)
  • Centrify Useful Commands and Information
  • Run ZIM on OS X and create Zim.app
  • How to be sure network interfaces have always the same names
  • Linux backup/restore/reinstall
  • How to add exfat support on RHEL 6
  • Mafia II Joe's Adventures - Playboy Locations
  • HMC commands
  • Command Line Software Update in MacOS

Last viewed:

  • PHP2Shell: Critical PHP Remote Code Execution Vulnerabilities and Website’s Impact
  • Macports: Current platform "darwin 17" does not match expected platform "darwin 16"
  • AIX System Dump Commands
  • Drupal 7 to Drupal 10 Migration and Configuration Notes
  • VIOFO A139 Quad HD Dash Camera - 3 Channels Camera in a 2 Channels Package. Confused?
  • The Nano Incident: How a Text Editor Almost Took Down My Database
  • Proxmox LXC Recovery: What Happens When Your LVM-Thin Pool Runs Out of Space
  • Macports: Current platform "darwin 14" does not match expected platform "darwin 13"
  • How to speed up things by using tmpfs
  • Errpt - Logopen: open: No such file or directory

@ gz.ro 2011-2026
Page generated in 0.0615 seconds. Served by tar.