Zeta File System Cheat Sheet Serge Y. Stroobandt Copyright 2014–2015, licensed under Creative Commons BY-NC-SA This page is still under construction! Mirrored storage pool A mirrored storage pool configuration requires at least two disks, preferably on separate controllers. A virtual device is an internal representation of the storage pool that describes the layout of physical storage and its fault characteristics. As such, a virtual device represents the disk devices or files that are used to create the storage pool. copy ssh key Server energy saving The BIOS of the Gigabyte motherboard allows to reduce the bus clock from 166 to 100MHz. This results in a CPU speed of 1GHz. This should save a little bit of power and allow a reduced fan speed setting. corsair cm2x2048-6400c5c 800MHz 2048MB ddr2 5-5-5-18 1.80V ver6.1 $ sudo /usr/sbin/laptop_mode start $ sudo /usr/sbin/laptop_mode status $ cat /proc/sys/vm/laptop_mode $ sudo nano /etc/laptop-mode/laptop-mode.conf HDD energy saving $ apcupsd $ sudo nano /etc/apcupsd/apcupsd.conf $ sudo nano /etc/default/apcupsd 1 $ sudo nano /etc/init.d/halt $ sudo hdparm -B96 /dev/sdc #laptop root drive $ sudo hdparm -S244 /dev/sda $ sudo hdparm -S244 /dev/sdb $ sudo hdparm -S240 /dev/sdc #laptop root drive $ sudo powertop Zpool mirror creation $ ls /dev/disk/by-id/ $ cat /sys/block/sda/queue/physical_block_size 512 $ sudo blktool /dev/sda sector-sz 512 WD EARS drives lie! 4096 $ sudo zpool create -f -o ashift=12 -O compression=on -O dedup=off tank0 mirror /dev/disk/by-id/scsi-SATA_WDC_WD10EARS-00_WD-WCAV56475795 /dev/disk/by-id/scsi-SATA_WDC_WD10EARS-00_WD-WCAV56524564 $ sudo zfs create tank/home Samba server $ sudo zfs set mountpoint=legacy tank0/home $ sudo nano /etc/fstab # <file system> <mount point> <type> <options> <dump> <pass> /tank0/home /home zfs defaults 0 0 $ cd / $ sudo mv home home.install $ sudo reboot 0 $ sudo mv home.install/ home/ $ sudo rmdir home.install 2 Copying old filesystem $ sudo mount -t ext3 /dev/bubba/storage /bubba $ cd /bubba $ sudo cp -av username/ /home $ sudo zpool iostat -v 5 Samba server tank ZFS has been integrated with the Linux Samba servers. A ZFS file system can be shared by setting the sharesmb file system property. $ sudo zfs set sharesmb=on tank0/home Make sure the samba packages are installed. Furthermore, the network must manually be configured to allow SMB. Monitoring Verbose status monitoring, every five seconds: $ sudo zpool status -v 5 Verbose input/output monitoring, every five seconds: $ sudo zpool iostat -v 5 Scrubbing Scrubbing examines all data to discover hardware faults or disk failures, whereas resilvering examines only that data known to be out of date. Scrubbing ZFS storage pools does not happen automatically. It is intiated manually. For consumer grade SATA or SCSI, it is highly recommended to scrub weekly. $ sudo zpool scrub tank0 Attaching more drives 3 $ sudo zpool attach tank0 /dev/disk/by-id/scsi-SATA_WDC_WD10EADS-00_WD-WCAV51264701 /dev/disk/by-id/scsi-SATA_WDC_WD10EARS-00_WD-WCAV56524564 $ sudo zpool attach -f tank0 /dev/disk/by-id/scsi-SATA_WDC_WD10EADS-00_WD-WCAU4D512265 /dev/disk/by-id/scsi-SATA_WDC_WD10EARS-00_WD-WCAV56475795 $ sudo hdparm -I /dev/sdx | grep Serial Other cheat sheets • http://www.datadisk.co.uk/html_docs/sun/sun_zfs_cs.htm • http://lildude.co.uk/zfs-cheatsheet Advanced topics Splitting off a backup Splitting off a backup to a stand-alone zpool $ sudo zpool split tank0 backup0 /dev/disk/by-id/scsi-SATA_WDC_WD10EADS-00_WD-WCAV51264701 Backup? ls /dev/disk/by-id/ $ sudo zpool attach tank0 /dev/disk/by-id/scsi-SATA_WDC_WD10EARS-00_WD-WCAV56475795 /dev/disk/by-id/scsi-SATA_WDC_WD10EADS-00_WD-WCAV51264701 $ sudo zpool detach tank0 /dev/disk/by-id/scsi-SATA_WDC_WD10EADS-00_WD-WCAV51264701 $ sudo zpool attach tank0 /dev/disk/by-id/scsi-SATA_WDC_WD10EARS-00_WD-WCAV56524564 /dev/disk/by-id/scsi-SATA_WDC_WD10EADS-00_WD-WCAU4D512265 $ sudo zpool detach tank0 /dev/disk/by-id/scsi-SATA_WDC_WD10EADS-00_WD-WCAU4D512265 resilvered 368G in 1h59m = 53MB/s 4 Snapshot creation $ sudo zfs snapshot tank0/home@20120722 $ sudo zfs list -t snapshot Snapshots of file systems are accessible in the .zfs/snapshot directory within the root of the containing file system. cd /tank0/.zfs/snapshot/home@20120722 $ sudo zdb $ sudo zpool attach tank0 15687870673060007972 /dev/disk/by-id/scsi-SATA_WDC_WD10EADS-00_WD-WCAV51264701 Copying between zpools $ sudo zfs snapshot tank0/home@20120722 $ sudo zfs send tank0/home@20120722 | $ sudo zfs recv -d tank1 Destroying a zpool $ sudo zpool offline tank1 /dev/disk/by-id/scsi-SATA_WDC_WD10EARS-00_WD-WCAV56475795 $ sudo zpool destroy tank1 Zpool conversion For those interested, I converted my zpool from /dev/sda1 type devices to /dev/disk/by-id/ device by doing the following: $ sudo zpool export tank0 $ sudo zpool import -d /dev/disk/by-id/ tank0 /home is in use! $ sudo zpool detach tank0 sdb $ sudo zpool attach tank0 sda /dev/disk/by-id/scsi-SATA_WDC_WD10EARS-00_WD-WCAV56475795 $ sudo zpool detach tank0 sda $ sudo zpool attach tank0 5 /dev/disk/by-id/scsi-SATA_WDC_WD10EARS-00_WD-WCAV56475795 /dev/disk/by-id/scsi-SATA_WDC_WD10EARS-00_WD-WCAV56524564 $ sudo zpool detach tank0 /dev/disk/by-id/scsi-SATA_WDC_WD10EADS-00_WD-WCAV51264701 References This work is licensed under a Creative Commons Attribution‑NonCommercial‑ShareAlike 4.0 International License. Other licensing available on request. Unattended CSS typesetting with . This work is published at http://hamwaves.com/zfs/en/. Last update: Tuesday, January 5, 2016. 6