====== ZFS ====== === RAID === == RAID1 == * Create RAID1 without mount point # zpool create -m none data-pool mirror /dev/disk/by-id/ata-Hitachi_... /dev/disk/by-id/ata-SAMSUNG_... === Replacing disk === * Replace disk # zpool replace tank /dev/disk/by-id/ata-Hitachi_... /dev/disk/by-id/ata-SAMSUNG_... * Replace already removed device # zpool replace data-pool /dev/disk/by-id/ata-QEMU_HARDDISK_QM00011-part1 === Add devices to pool === * Add vdev (raidz1) to existing pool zpool add hdd-pool raidz1 /dev/xvdf /dev/xvdg /dev/xvdh === Enable periodic scrub (FreeBSD only) === # cat << EOF >> /etc/periodic.conf daily_scrub_zfs_enable="YES" daily_scrub_zfs_default_threshold="28" === TRIM (Linux only) === * Run trim on zpool # zpool trim data-pool * Check trim status # zpool status -t data-pool === Misc === * Create volume # zfs create -V 10G tank/storage * Get volume size # zfs get volsize tank/storage * Resize volume # zfs set volsize=50G tank/storage * SWAP # zfs create -V 4G -b $(getconf PAGESIZE) -o compression=zle \ -o logbias=throughput -o sync=always \ -o primarycache=metadata -o secondarycache=none \ -o com.sun:auto-snapshot=false rpool/swap * Enable/disable compression # zfs set compression=lz4 data-pool/data/logs # zfs set compression=off data-pool/data/logs * Set quota # zfs set quota=20G data-pool/data/ISO * Get all properties # zfs get all data-pool