Linux Administration/Devices and Filesystems/ZFS

From Wikiversity
Jump to navigation Jump to search

ZFS is a combined file system and volume manager included in Solaris 10 update 2 (06/2006) and Ubuntu 16.04 LTS onwards. ZFS support advances features such as

Commands: zfs, zpool, zdb

  • Installation: sudo apt install zfsutils-linux

Configuration files[edit | edit source]

  • /etc/default/zfs

Commands[edit | edit source]

  • List your block/disk devices: lsblk or lsblk -f or fdisk -l
  • Show pool status: zpool status
  • List ZFS pools : zpool list
zpool list -v
  • zfs mount -a
  • zfs umount

Create a new pool:

  • Create a new pool: sudo zpool create DATA /dev/sdbbbbbbb11
  • Create a new stripped pool: sudo zpool create MY-NEW-STRIPPED-POOL /dev/sdb /dev/sdc
  • Create a new mirrored pool: sudo zpool create MY-NEW-MIRROR-POOL mirror /dev/sdb /dev/sdc

To Modify Disk identification to use disk/by-id:

  • zpool export DATA
  • zpool import -d /dev/disk/by-id DATA
  • Verify: zdb -C

Pools[edit | edit source]

  • zpool destroy YOUR_POOL
  • Show pool status: zpool status
  • List ZFS pools : zpool list

Filesystems[edit | edit source]

  • Create a new filesystem: sudo zfs create DATA/datafs[4]
  • Destroy a zfs filesystem: sudo zfs destroy DATA/datafs_TO_DESTROY (Warning: no confirmation requested[5])
    • sudo zfs destroy -r DATA/datafs_TO_DESTROY
  • Set a quota to a filesystems: zfs set quota=50G pool/home/bob[6]
  • Check zfs service status: systemctl status "zfs*" "zpool*"
  • Display configuration information: zdb -C

List information[edit | edit source]

  • Show pool status: zpool status
  • List ZFS pools : zpool list
  • List FS/Volumens/snapshots: zfs list
  • zfs get all
zfs get all | grep mountpoint

Advanced[edit | edit source]

  • zpool import

Activities[edit | edit source]

  1. Read selecting dev names when creating a pool before you create your first ZFS pool: and
  2. Read ArchLinux documentation about ZFS:
  3. Follow Ubuntu Tutorial about Setup a ZFS storage pool:
  4. Create you first ZFS pool: zpool create

See also[edit | edit source]